Package com.sun.mirror.declaration

Examples of com.sun.mirror.declaration.ClassDeclaration


        this.primitiveByte = env.getTypeUtils().getPrimitiveType(PrimitiveType.Kind.BYTE);
    }

    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;
        }
View Full Code Here


    public boolean isBridgeMethod(MethodDeclaration method) {
        return method.getModifiers().contains(Modifier.VOLATILE);
    }

    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();
        }
    }
View Full Code Here

    public boolean hasDefaultConstructor(TypeDeclaration t) {
        if(!(t instanceof ClassDeclaration))
            return false;

        ClassDeclaration c = (ClassDeclaration) t;
        for( ConstructorDeclaration init : c.getConstructors() ) {
            if(init.getParameters().isEmpty())
                return true;
        }
        return false;
    }
View Full Code Here

    if ( classDeclarations.size() == 1 ) {
      return classDeclarations.get( 0 );
    }

    //Find the shortest
    ClassDeclaration shortest = findClassDeclarationWithShortestFQName();

    //Verify the other are just inner classes!
    for ( ClassDeclaration classDeclaration : classDeclarations ) {
      if ( !classDeclaration.getQualifiedName().startsWith( shortest.getQualifiedName() ) ) {
        throw new IllegalStateException( "Invalid class declarations count found: " + classDeclarations.size() + " (" + classDeclarations + ")" );
      }
    }

    return shortest;
View Full Code Here

  }

  @Deprecated
  @NotNull
  public ClassDeclaration findClassDeclarationWithShortestFQName() {
    ClassDeclaration shortest = null;
    for ( ClassDeclaration classDeclaration : classDeclarations ) {
      if ( shortest == null || shortest.getQualifiedName().length() > classDeclaration.getQualifiedName().length() ) {
        shortest = classDeclaration;
      }
    }

    if ( shortest == null ) {
View Full Code Here

  @NotNull
  public static Collection<FieldDeclaration> findFieldsIncludingSuperClasses( @NotNull 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;
  }
View Full Code Here

  @NotNull
  public static Collection<? extends MethodDeclaration> findMethodsIncludingSuperClass( @NotNull 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;
  }
View Full Code Here

        String beanPackage = packageName + PD_JAXWS_PACKAGE_PD;
        if (packageName.length() == 0)
            beanPackage = JAXWS_PACKAGE_PD;
        boolean beanGenerated = false;
        for (ReferenceType thrownType : method.getThrownTypes()) {
            ClassDeclaration typeDecl = ((ClassType)thrownType).getDeclaration();
            if (typeDecl == null){
                builder.onError(WebserviceapMessages.WEBSERVICEAP_COULD_NOT_FIND_TYPEDECL(thrownType.toString(), context.getRound()));
                return false;
            }
            boolean tmp = generateExceptionBean(typeDecl, beanPackage);
View Full Code Here

                }

                for (TypeDeclaration t : optionBeans) {
                    // make sure that they are on classes
                    if(t instanceof ClassDeclaration) {
                        ClassDeclaration cd = (ClassDeclaration)t;
                        try {
                            AnnotationVisitor writer = createAnnotationVisitor(cd);
                            env.getMessager().printNotice("Processing "+cd.getQualifiedName());
                            scan(cd, writer);
                        } catch (IOException e) {
                            env.getMessager().printError(e.getMessage());
                        }
                    } else {
View Full Code Here

        this.primitiveByte = env.getTypeUtils().getPrimitiveType(PrimitiveType.Kind.BYTE);
    }

    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;
        }
View Full Code Here

TOP

Related Classes of com.sun.mirror.declaration.ClassDeclaration

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.