for (TypeMirror iface: element.getInterfaces()) {
newClass._implements((AbstractJClass)toJType(iface, environment));
}
for (Element enclosedElement: element.getEnclosedElements()) {
if (enclosedElement.getKind().equals(ElementKind.METHOD)) {
ExecutableElement executable = (ExecutableElement)enclosedElement;
JMethod method = newClass.method(toJMod(executable.getModifiers()), codeModel.VOID, executable.getSimpleName().toString());
TypeEnvironment methodEnvironment = environment.enclosed();
Annotator methodAnnotator = new Annotator(method, environment);
methodAnnotator.annotate(executable.getAnnotationMirrors());
for (TypeParameterElement parameter: executable.getTypeParameters()) {
JTypeVar typeVariable = method.generify(parameter.getSimpleName().toString());
methodEnvironment.put(typeVariable.name(), typeVariable);
for (TypeMirror type: parameter.getBounds()) {
typeVariable.bound((AbstractJClass)toJType(type, methodEnvironment));
}
}
method.type(toJType(executable.getReturnType(), methodEnvironment));
for (TypeMirror type: executable.getThrownTypes()) {
AbstractJClass throwable = (AbstractJClass)toJType(type, methodEnvironment);
method._throws(throwable);
}
List<? extends VariableElement> parameters = executable.getParameters();
int n = 0;
for (VariableElement variable: parameters) {
String parameterName = variable.getSimpleName().toString();
TypeMirror parameterTypeMirror = variable.asType();
AbstractJType parameterType = toJType(parameterTypeMirror, methodEnvironment);
JVar param;
if (executable.isVarArgs() && n == parameters.size() - 1) {
param = method.varParam(toJMod(variable.getModifiers()), parameterType.elementType(), parameterName);
} else {
param = method.param(toJMod(variable.getModifiers()), parameterType, parameterName);
}
Annotator parametorAnnotator = new Annotator(param, methodEnvironment);