use of org.whole.lang.java.model.Type in project whole by wholeplatform.
the class JDTTransformerVisitor method visit.
public boolean visit(EnumDeclaration node) {
// FIXME workaround for type nesting
org.whole.lang.java.model.Type type = this.type;
org.whole.lang.java.model.Name name = this.name;
org.whole.lang.java.model.TypeParameter typeParameter = this.typeParameter;
org.whole.lang.java.model.Parameters params = this.params;
org.whole.lang.java.model.Types thrownExceptions = this.thrownExceptions;
org.whole.lang.java.model.SingleVariableDeclaration varDecl = this.varDecl;
org.whole.lang.java.model.Block block = this.block;
org.whole.lang.java.model.Statement stm = this.stm;
org.whole.lang.java.model.Expression exp = this.exp;
org.whole.lang.java.model.VariableDeclarationFragment varFrag = this.varFrag;
org.whole.lang.java.model.CatchClauses catchClauses = this.catchClauses;
env().wEnterScope();
org.whole.lang.java.model.EnumDeclaration enumDeclaration;
appendBodyDeclaration(enumDeclaration = lf.create(JavaEntityDescriptorEnum.EnumDeclaration));
if (acceptChild(node.getJavadoc()))
enumDeclaration.setJavadoc(this.javadoc);
List<?> modifiers = node.modifiers();
if (!modifiers.isEmpty()) {
enumDeclaration.setModifiers(lf.create(JavaEntityDescriptorEnum.ExtendedModifiers));
setExtendedModifiers(enumDeclaration.getModifiers(), modifiers);
}
if (acceptChild(node.getName()))
enumDeclaration.setName((org.whole.lang.java.model.SimpleName) this.name);
Iterator<?> i = node.superInterfaceTypes().iterator();
while (i.hasNext()) {
((ASTNode) i.next()).accept(this);
enumDeclaration.getSuperInterfaceTypes().wAdd(this.type);
}
org.whole.lang.java.model.EnumConstants enumConstants = lf.create(JavaEntityDescriptorEnum.EnumConstants);
enumDeclaration.setEnumConstants(enumConstants);
env().wDef("typeDeclarationsContainer", enumConstants);
acceptChildren(node.enumConstants());
org.whole.lang.java.model.BodyDeclarations bodyDecl = lf.createBodyDeclarations();
enumDeclaration.setBodyDeclarations(bodyDecl);
env().wDef("typeDeclarationsContainer", bodyDecl);
acceptChildren(node.bodyDeclarations());
env().wExitScope();
// FIXME workaround for type nesting
this.type = type;
this.name = name;
this.typeParameter = typeParameter;
this.params = params;
this.thrownExceptions = thrownExceptions;
this.varDecl = varDecl;
this.block = block;
this.stm = stm;
this.exp = exp;
this.varFrag = varFrag;
this.catchClauses = catchClauses;
return false;
}
use of org.whole.lang.java.model.Type in project whole by wholeplatform.
the class JDTTransformerVisitor method visit.
public boolean visit(CastExpression node) {
acceptChild(node.getType());
org.whole.lang.java.model.Type type1 = type;
acceptChild(node.getExpression());
exp = lf.createCastExpression(type1, exp);
return false;
}
use of org.whole.lang.java.model.Type in project whole by wholeplatform.
the class Helpers method isFactoryMethod.
public static boolean isFactoryMethod(MethodDeclaration entity) {
if (!Matcher.matchImpl(JavaEntityDescriptorEnum.SimpleName, entity.getName().wGetAdaptee(false)))
return false;
String methodName = entity.getName().getValue();
Type returnType = entity.getReturnType();
return (methodName.startsWith("create") || methodName.startsWith("new")) && !returnType.wGetEntityDescriptor().equals(JavaEntityDescriptorEnum.PrimitiveType);
}
Aggregations