private boolean shouldProcessClass(ClassType superclass) { return superclass != null && superclass.getDeclaration() != null && !superclass.getDeclaration().getQualifiedName().equals("java.lang.Object"); }
public ClassDeclaration getDeclaration() { return DeclarationDecorator.decorate(((ClassType) delegate).getDeclaration()); }
@Override public boolean isBaseObject() { return getSuperclass().getDeclaration() == null || Object.class.getName().equals(getSuperclass().getDeclaration().getQualifiedName()); }
@Override public boolean isBaseObject() { return getSuperclass().getDeclaration() == null || Object.class.getName().equals(getSuperclass().getDeclaration().getQualifiedName()) || isXmlTransient(getSuperclass().getDeclaration()); }
public TypeDeclaration getSuperClass(TypeDeclaration t) { if (t instanceof ClassDeclaration) { ClassDeclaration c = (ClassDeclaration) t; ClassType sup = c.getSuperclass(); if(sup!=null) return sup.getDeclaration(); else return null; } return env.getTypeDeclaration(Object.class.getName()); }
public TypeDeclaration getSuperClass(TypeDeclaration t) { if (t instanceof ClassDeclaration) { ClassDeclaration c = (ClassDeclaration) t; ClassType sup = c.getSuperclass(); if(sup!=null) return sup.getDeclaration(); else return null; } return env.getTypeDeclaration(Object.class.getName()); }
@Nonnull public static Collection<? extends MethodDeclaration> findMethodsIncludingSuperClass( @Nonnull ClassDeclaration classDeclaration ) { Collection<MethodDeclaration> methods = new ArrayList<MethodDeclaration>(); ClassDeclaration current = classDeclaration; while ( current != null && isNotObject( current ) ) { methods.addAll( current.getMethods() ); current = current.getSuperclass().getDeclaration(); } return methods; }
@Nonnull public static Collection<FieldDeclaration> findFieldsIncludingSuperClasses( @Nonnull ClassDeclaration classDeclaration ) { Collection<FieldDeclaration> fields = new ArrayList<FieldDeclaration>(); ClassDeclaration current = classDeclaration; while ( current != null && isNotObject( current ) ) { fields.addAll( current.getFields() ); current = current.getSuperclass().getDeclaration(); } return fields; }
/** * The element for the XML representation, if any. * * @return The element for the XML representation, if any. */ public ElementDeclaration getXmlElement() { if (delegate instanceof ClassType) { ClassDeclaration declaration = ((ClassType) delegate).getDeclaration(); if (declaration != null) { return ((EnunciateFreemarkerModel) FreemarkerModel.get()).findElementDeclaration(declaration); } } return null; }
/** * The type for the JSON representation, if any. * * @return The type for the JSON representation, if any. */ public JsonType getJsonType() { if (delegate instanceof ClassType) { ClassDeclaration declaration = ((ClassType) delegate).getDeclaration(); if (declaration != null) { return ((EnunciateFreemarkerModel) FreemarkerModel.get()).findJsonTypeDefinition(declaration); } } return null; }
/** * Gets all properties, including properties from the superclass. * * @param declaration The declaration from which to get all properties. * @return All properties. */ protected Collection<PropertyDeclaration> getAllProperties(DecoratedClassDeclaration declaration) { ArrayList<PropertyDeclaration> properties = new ArrayList<PropertyDeclaration>(); while ((declaration != null) && (!Object.class.getName().equals(declaration.getQualifiedName()))) { properties.addAll(declaration.getProperties()); declaration = (DecoratedClassDeclaration) declaration.getSuperclass().getDeclaration(); } return properties; }
/** * The JSON element associated with the entity parameter, or null if none (or unknown). * * @return The JSON element associated with the entity parameter, or null if none (or unknown). */ public JsonType getJsonType() { if (this.type instanceof ClassType) { ClassDeclaration declaration = ((ClassType) this.type).getDeclaration(); if (declaration != null) { return ((EnunciateFreemarkerModel) FreemarkerModel.get()).findJsonTypeDefinition(declaration); } } return null; }
/** * The XML element associated with the entity parameter, or null if none (or unknown). * * @return The XML element associated with the entity parameter, or null if none (or unknown). */ public ElementDeclaration getXmlElement() { if (this.type instanceof ClassType) { ClassDeclaration declaration = ((ClassType) this.type).getDeclaration(); if (declaration != null) { return ((EnunciateFreemarkerModel) FreemarkerModel.get()).findElementDeclaration(declaration); } } return null; }
@Override public <A extends Annotation> A getAnnotation(Class<A> annotationType) { A annotation = super.getAnnotation(annotationType); if ((annotation == null) && (annotationType.getAnnotation(Inherited.class) != null) && (getSuperclass() != null)) { ClassDeclaration superDecl = getSuperclass().getDeclaration(); if ((superDecl != null) && (!Object.class.getName().equals(superDecl.getQualifiedName()))) { return superDecl.getAnnotation(annotationType); } } return annotation; }
/** * Whether the specified type definition has neither attributes nor elements. * * @param typeDef The type def. * @return Whether the specified type definition has neither attributes nor elements. */ protected boolean hasNeitherAttributesNorElements(GenericTypeDefinition typeDef) { boolean none = (typeDef.getAttributes().isEmpty()) && (typeDef.getElements().isEmpty()); ClassDeclaration superDeclaration = ((ClassDeclaration) typeDef.getDelegate()).getSuperclass().getDeclaration(); if (!Object.class.getName().equals(superDeclaration.getQualifiedName())) { none &= hasNeitherAttributesNorElements(new GenericTypeDefinition(superDeclaration)); } return none; }
/** * Whether the specified type definition has neither attributes nor elements. * * @param typeDef The type def. * @return Whether the specified type definition has neither attributes nor elements. */ protected boolean hasNeitherAttributesNorElements(GenericTypeDefinition typeDef) { boolean none = (typeDef.getAttributes().isEmpty()) && (typeDef.getElements().isEmpty()); ClassDeclaration superDeclaration = ((ClassDeclaration) typeDef.getDelegate()).getSuperclass().getDeclaration(); if (!Object.class.getName().equals(superDeclaration.getQualifiedName())) { none &= hasNeitherAttributesNorElements(new GenericTypeDefinition(superDeclaration)); } return none; }
public void printMethods(ClassDeclaration d) { for (MethodDeclaration decl : getCollectedMethodDeclations()) { if (d.getQualifiedName(). equals(decl.getDeclaringType().getQualifiedName())) { System.out.println("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"); printMethodDeclaration(decl); } } if (d.getSuperclass() != null) { printMethods(d.getSuperclass().getDeclaration()); } }
public void printMethods(ClassDeclaration d) { for (MethodDeclaration decl : getCollectedMethodDeclations()) { if (d.getQualifiedName(). equals(decl.getDeclaringType().getQualifiedName())) { System.out.println("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"); printMethodDeclaration(decl); } } if (d.getSuperclass() != null) { printMethods(d.getSuperclass().getDeclaration()); } }
public boolean isOverriding(MethodDeclaration method, TypeDeclaration base) { ClassDeclaration sc = (ClassDeclaration) base; Declarations declUtil = env.getDeclarationUtils(); while(true) { for (MethodDeclaration m : sc.getMethods()) { if(declUtil.overrides(method,m)) return true; } if(sc.getSuperclass()==null) return false; sc = sc.getSuperclass().getDeclaration(); } }
public boolean isOverriding(MethodDeclaration method, TypeDeclaration base) { ClassDeclaration sc = (ClassDeclaration) base; Declarations declUtil = env.getDeclarationUtils(); while(true) { for (MethodDeclaration m : sc.getMethods()) { if(declUtil.overrides(method,m)) return true; } if(sc.getSuperclass()==null) return false; sc = sc.getSuperclass().getDeclaration(); } }