Package com.sun.mirror.declaration

Examples of com.sun.mirror.declaration.MethodDeclaration


     */
    protected void handleMethod(AttributeMetaDesc attributeMetaDesc,
            ClassDeclaration classDeclaration,
            FieldDeclaration fieldDeclaration,
            List<MethodDeclaration> methodDeclarations) {
        MethodDeclaration readMethodDeclaration = null;
        MethodDeclaration wirteMethodDeclaration = null;
        for (MethodDeclaration m : methodDeclarations) {
            if (isReadMethod(m, attributeMetaDesc, fieldDeclaration)) {
                readMethodDeclaration = m;
                attributeMetaDesc.setReadMethodName(m.getSimpleName());
                if (attributeMetaDesc.getWriteMethodName() != null) {
View Full Code Here


     */
    protected void handleMethod(AttributeMetaDesc attributeMetaDesc,
            ClassDeclaration classDeclaration,
            FieldDeclaration fieldDeclaration,
            List<MethodDeclaration> methodDeclarations) {
        MethodDeclaration readMethodDeclaration = null;
        MethodDeclaration wirteMethodDeclaration = null;
        for (MethodDeclaration m : methodDeclarations) {
            if (isReadMethod(m, attributeMetaDesc, fieldDeclaration)) {
                readMethodDeclaration = m;
                attributeMetaDesc.setReadMethodName(m.getSimpleName());
                if (attributeMetaDesc.getWriteMethodName() != null) {
View Full Code Here

        }

        ParameterDeclaration tpd = paramMap.get(paramNameQualifiers[0]);
        TypeMirror type = tpd.getType();

        MethodDeclaration getterMethod = null;
        FieldDeclaration field = null;

        for (int i = 1; i < paramNameQualifiers.length; i++) {

            getterMethod = null;
            field = null;

            // loop through superclasses until we find a match or run out of superclasses
            while (type != null) {

                if (type instanceof DeclaredType == false) {
                    throw new ControlException(buildMessage(parameterName, method.getSimpleName()));
                }

                TypeDeclaration td = ((DeclaredType) type).getDeclaration();
                //
                // abort if Map!!! No further checking can be done.
                //
                if (td.getQualifiedName().equals("java.util.Map")) {
                    return;
                }

                Collection<? extends MethodDeclaration> methods =
                        DeclarationFilter.FILTER_PUBLIC.filter(td.getMethods());
                for (MethodDeclaration m : methods) {
                    String upperFirst = paramNameQualifiers[i].substring(0,1).toUpperCase();
                    if (paramNameQualifiers[i].length() > 1) {
                        upperFirst = upperFirst + paramNameQualifiers[i].substring(1);
                    }
                    if (m.getSimpleName().equals("get" + upperFirst)
                        || m.getSimpleName().equals("is" + upperFirst)) {
                        getterMethod = m;
                    }
                }

                if (getterMethod == null) {
                    Collection<FieldDeclaration> fields =
                            DeclarationFilter.FILTER_PUBLIC.filter(td.getFields());
                    for (FieldDeclaration fd : fields) {
                        if (fd.getSimpleName().equals(paramNameQualifiers[i])) {
                            field = fd;
                        }
                    }
                }

                // try the super-class
                if (getterMethod == null && field == null) {
                    if (td instanceof ClassDeclaration) {
                        type = ((ClassDeclaration) td).getSuperclass();
                        continue;
                    }
                }

                break;
            } // while

            // found a match, get its type and continue within the for loop
            if (getterMethod != null) {
                type = getterMethod.getReturnType();
            } else if (field != null) {
                type = field.getType();
            } else {
                throw new ControlException(buildMessage(parameterName, method.getSimpleName()));
            }
View Full Code Here

        }

        ParameterDeclaration tpd = paramMap.get(paramNameQualifiers[0]);
        TypeMirror type = tpd.getType();

        MethodDeclaration getterMethod = null;
        FieldDeclaration field = null;

        for (int i = 1; i < paramNameQualifiers.length; i++) {

            getterMethod = null;
            field = null;

            // loop through superclasses until we find a match or run out of superclasses
            while (type != null) {

                if (type instanceof DeclaredType == false) {
                    throw new ControlException(buildMessage(parameterName, method.getSimpleName()));
                }

                TypeDeclaration td = ((DeclaredType) type).getDeclaration();
                //
                // abort if Map!!! No further checking can be done.
                //
                if (td.getQualifiedName().equals("java.util.Map")) {
                    return;
                }

                Collection<? extends MethodDeclaration> methods =
                        DeclarationFilter.FILTER_PUBLIC.filter(td.getMethods());
                for (MethodDeclaration m : methods) {
                    String upperFirst = paramNameQualifiers[i].substring(0,1).toUpperCase();
                    if (paramNameQualifiers[i].length() > 1) {
                        upperFirst = upperFirst + paramNameQualifiers[i].substring(1);
                    }
                    if (m.getSimpleName().equals("get" + upperFirst)
                        || m.getSimpleName().equals("is" + upperFirst)) {
                        getterMethod = m;
                    }
                }

                if (getterMethod == null) {
                    Collection<FieldDeclaration> fields =
                            DeclarationFilter.FILTER_PUBLIC.filter(td.getFields());
                    for (FieldDeclaration fd : fields) {
                        if (fd.getSimpleName().equals(paramNameQualifiers[i])) {
                            field = fd;
                        }
                    }
                }

                // try the super-class
                if (getterMethod == null && field == null) {
                    if (td instanceof ClassDeclaration) {
                        type = ((ClassDeclaration) td).getSuperclass();
                        continue;
                    }
                }

                break;
            } // while

            // found a match, get its type and continue within the for loop
            if (getterMethod != null) {
                type = getterMethod.getReturnType();
            } else if (field != null) {
                type = field.getType();
            } else {
                throw new ControlException(buildMessage(parameterName, method.getSimpleName()));
            }
View Full Code Here

     *
     * @param declarations a collection of Declarations annotated with handler annotations.
     */
    protected void processHandlerAnnotations(Collection<Declaration> declarations) {
        for (Declaration declaration : declarations) {
            MethodDeclaration methodDec = (MethodDeclaration) declaration;
            ClassDeclaration classDec = (ClassDeclaration) methodDec.getDeclaringType();

            EventInfo event = new EventInfo();
            event.setMethodName(methodDec.getSimpleName());

            DefaultHandler defaultHandler = methodDec.getAnnotation(DefaultHandler.class);
            if (defaultHandler != null) {
                event.setDefaultEvent(true);
            }

            HandlesEvent handlesEvent = methodDec.getAnnotation(HandlesEvent.class);
            if (handlesEvent != null) {
                event.setName(handlesEvent.value());
            }

            // Now find the resolutions and add those to the event info
View Full Code Here

        }

        ParameterDeclaration tpd = paramMap.get(paramNameQualifiers[0]);
        TypeMirror type = tpd.getType();

        MethodDeclaration getterMethod = null;
        FieldDeclaration field = null;

        for (int i = 1; i < paramNameQualifiers.length; i++) {

            getterMethod = null;
            field = null;

            // loop through superclasses until we find a match or run out of superclasses
            while (type != null) {

                if (type instanceof DeclaredType == false) {
                    throw new ControlException(buildMessage(parameterName, method.getSimpleName()));
                }

                TypeDeclaration td = ((DeclaredType) type).getDeclaration();
                //
                // abort if Map!!! No further checking can be done.
                //
                if (td.getQualifiedName().equals("java.util.Map")) {
                    return;
                }

                Collection<? extends MethodDeclaration> methods =
                        DeclarationFilter.FILTER_PUBLIC.filter(td.getMethods());
                for (MethodDeclaration m : methods) {
                    String upperFirst = paramNameQualifiers[i].substring(0,1).toUpperCase();
                    if (paramNameQualifiers[i].length() > 1) {
                        upperFirst = upperFirst + paramNameQualifiers[i].substring(1);
                    }
                    if (m.getSimpleName().equals("get" + upperFirst)
                        || m.getSimpleName().equals("is" + upperFirst)) {
                        getterMethod = m;
                    }
                }

                if (getterMethod == null) {
                    Collection<FieldDeclaration> fields =
                            DeclarationFilter.FILTER_PUBLIC.filter(td.getFields());
                    for (FieldDeclaration fd : fields) {
                        if (fd.getSimpleName().equals(paramNameQualifiers[i])) {
                            field = fd;
                        }
                    }
                }

                // try the super-class
                if (getterMethod == null && field == null) {
                    if (td instanceof ClassDeclaration) {
                        type = ((ClassDeclaration) td).getSuperclass();
                        continue;
                    }
                }

                break;
            } // while

            // found a match, get its type and continue within the for loop
            if (getterMethod != null) {
                type = getterMethod.getReturnType();
            } else if (field != null) {
                type = field.getType();
            } else {
                throw new ControlException(buildMessage(parameterName, method.getSimpleName()));
            }
View Full Code Here

      Accessor accessor = ((Accessor) declaration);
      return findAdapterType(accessor.getAccessorType(), accessor, accessor.getDeclaringType().getPackage());
    }
    else if (declaration instanceof MethodDeclaration) {
      //assume the return type of the method is adaptable (e.g. web results, fault bean getters).
      MethodDeclaration method = ((MethodDeclaration) declaration);
      return findAdapterType(method.getReturnType(), method, method.getDeclaringType().getPackage());
    }
    else if (declaration instanceof WebParam) {
      WebParam parameter = ((WebParam) declaration);
      return findAdapterType(parameter.getType(), parameter, parameter.getWebMethod().getDeclaringEndpointInterface().getPackage());
    }
View Full Code Here

    return domainObjectDescriptor;
  }

  @NotNull
  public FieldWithInitializationInfo getFieldWithInitializationInfo( @NotNull FieldDeclaration fieldDeclaration ) {
    MethodDeclaration getterDeclaration = TypeUtils.findGetterForField( classDeclaration, fieldDeclaration );

    //At first look for fields that are initialized within the constructor
    try {
      ConstructorCallInfo constructorCallInfo = findConstructorCallInfoForField( fieldDeclaration );
      return new FieldInitializedInConstructorInfo( fieldDeclaration, getterDeclaration, constructorCallInfo );
    } catch ( IllegalArgumentException ignore ) {
    }

    //Now look for fields that have a setter
    try {
      MethodDeclaration setter = TypeUtils.findSetter( classDeclaration, fieldDeclaration );
      return new FieldInitializedInSetterInfo( fieldDeclaration, getterDeclaration, setter );
    } catch ( IllegalArgumentException ignore ) {
    }

    //Ok, return a read only field descriptor
View Full Code Here

  }

  @NotNull
  public FieldInitializedInConstructorInfo getFieldInitializeInConstructorInfo( @NotNull FieldDeclaration fieldDeclaration ) {
    ConstructorCallInfo constructorCallInfo = findConstructorCallInfoForField( fieldDeclaration );
    MethodDeclaration getterDeclaration = TypeUtils.findGetterForField( classDeclaration, fieldDeclaration );
    return new FieldInitializedInConstructorInfo( fieldDeclaration, getterDeclaration, constructorCallInfo );
  }
View Full Code Here

    return domainObjectDescriptor;
  }

  @NotNull
  public FieldWithInitializationInfo getFieldWithInitializationInfo( @NotNull FieldDeclaration fieldDeclaration ) {
    MethodDeclaration getterDeclaration = DomainObjectDescriptor.findGetterForField( classDeclaration, fieldDeclaration );
    try {
      ConstructorCallInfo constructorCallInfo = findConstructorCallInfoForField( fieldDeclaration );
      return new FieldInitializedInConstructorInfo( fieldDeclaration, getterDeclaration, constructorCallInfo );
    } catch ( IllegalArgumentException ignore ) {
      MethodDeclaration setter = DomainObjectDescriptor.findSetter( classDeclaration, fieldDeclaration );
      return new FieldInitializedInSetterInfo( fieldDeclaration, getterDeclaration, setter );
    }
  }
View Full Code Here

TOP

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

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.