Package javax.lang.model.element

Examples of javax.lang.model.element.ExecutableElement


        for (Element e : roundEnv.getElementsAnnotatedWith(annotationElement))
        {
            checkAnnotationIsOnMethodInInterface(annotationElement, e);

            ExecutableElement methodElement = (ExecutableElement) e;

            checkInterfaceExtendsConfiguredObject(annotationElement, methodElement);
            checkMethodTakesNoArgs(annotationElement, methodElement);
            checkMethodName(annotationElement, methodElement);
            checkTypeAgreesWithName(annotationElement, methodElement);
View Full Code Here


            for (Element e : roundEnv.getElementsAnnotatedWith(ManagedObjectFactoryConstructor.class))
            {
                if(e.getKind() == ElementKind.CONSTRUCTOR)
                {
                    ExecutableElement constructorElement = (ExecutableElement) e;
                    String factoryName = generateObjectFactory(filer, constructorElement);
                }
            }

        }
View Full Code Here

   *
   * @return A possibly non-empty set of constraint check errors, never null.
   */
  private Set<ConstraintCheckError> checkMessageAttribute(TypeElement element) {

    ExecutableElement messageMethod = getMethod( element, "message" );

    if ( messageMethod == null ) {
      return CollectionHelper.asSet(
          new ConstraintCheckError( element, null, "CONSTRAINT_TYPE_MUST_DECLARE_MESSAGE_MEMBER" )
      );
    }

    if ( !typeUtils.isSameType(
        annotationApiHelper.getMirrorForType( String.class ), messageMethod.getReturnType()
    ) ) {
      return CollectionHelper.asSet(
          new ConstraintCheckError( messageMethod, null, "RETURN_TYPE_MUST_BE_STRING" )
      );
    }
View Full Code Here

   *
   * @return A possibly non-empty set of constraint check errors, never null.
   */
  private Set<ConstraintCheckError> checkGroupsAttribute(TypeElement element) {

    ExecutableElement groupsMethod = getMethod( element, "groups" );

    if ( groupsMethod == null ) {
      return CollectionHelper.asSet(
          new ConstraintCheckError( element, null, "CONSTRAINT_TYPE_MUST_DECLARE_GROUPS_MEMBER" )
      );
    }

    DeclaredType type = getComponentTypeOfArrayReturnType( groupsMethod );

    if ( type == null ) {
      return CollectionHelper.asSet(
          new ConstraintCheckError( groupsMethod, null, "RETURN_TYPE_MUST_BE_CLASS_ARRAY" )
      );
    }

    boolean typeHasNameClass = type.asElement().getSimpleName().contentEquals( "Class" );
    boolean typeHasExactlyOneTypeArgument = type.getTypeArguments().size() == 1;
    boolean typeArgumentIsUnboundWildcard = validateWildcardBounds( type.getTypeArguments().get( 0 ), null, null );

    if ( !( typeHasNameClass && typeHasExactlyOneTypeArgument && typeArgumentIsUnboundWildcard ) ) {
      return CollectionHelper.asSet(
          new ConstraintCheckError( groupsMethod, null, "RETURN_TYPE_MUST_BE_CLASS_ARRAY" )
      );
    }

    if ( !isEmptyArray( groupsMethod.getDefaultValue() ) ) {
      return CollectionHelper.asSet(
          new ConstraintCheckError( groupsMethod, null, "DEFAULT_VALUE_MUST_BE_EMPTY_ARRAY" )
      );
    }

View Full Code Here

   *
   * @return A possibly non-empty set of constraint check errors, never null.
   */
  private Set<ConstraintCheckError> checkPayloadAttribute(TypeElement element) {

    ExecutableElement payloadMethod = getMethod( element, "payload" );

    if ( payloadMethod == null ) {
      return CollectionHelper.asSet(
          new ConstraintCheckError( element, null, "CONSTRAINT_TYPE_MUST_DECLARE_PAYLOAD_MEMBER" )
      );
    }

    DeclaredType type = getComponentTypeOfArrayReturnType( payloadMethod );

    if ( type == null ) {
      return CollectionHelper.asSet(
          new ConstraintCheckError( payloadMethod, null, "PAYLOAD_RETURN_TYPE_MUST_BE_CLASS_ARRAY" )
      );
    }

    boolean typeHasNameClass = type.asElement().getSimpleName().contentEquals( "Class" );
    boolean typeHasExactlyOneTypeArgument = type.getTypeArguments().size() == 1;
    boolean typeArgumentIsWildcardWithPayloadExtendsBound = validateWildcardBounds(
        type.getTypeArguments().get( 0 ), annotationApiHelper.getMirrorForType( Payload.class ), null
    );

    if ( !( typeHasNameClass && typeHasExactlyOneTypeArgument && typeArgumentIsWildcardWithPayloadExtendsBound ) ) {
      return CollectionHelper.asSet(
          new ConstraintCheckError( payloadMethod, null, "PAYLOAD_RETURN_TYPE_MUST_BE_CLASS_ARRAY" )
      );
    }

    if ( !isEmptyArray( payloadMethod.getDefaultValue() ) ) {
      return CollectionHelper.asSet(
          new ConstraintCheckError( payloadMethod, null, "PAYLOAD_DEFAULT_VALUE_MUST_BE_EMPTY_ARRAY" )
      );
    }

View Full Code Here

      ImmutableMap<String, ExecutableElement> memberMethods,
      TypeSimplifier typeSimplifier,
      AnnotationDefaults annotationDefaults) {
    ImmutableMap.Builder<String, Member> members = ImmutableMap.builder();
    for (Map.Entry<String, ExecutableElement> entry : memberMethods.entrySet()) {
      ExecutableElement memberMethod = entry.getValue();
      String name = memberMethod.getSimpleName().toString();
      members.put(name, new Member(memberMethod, typeSimplifier, annotationDefaults));
    }
    return members.build();
  }
View Full Code Here

    List<ExecutableElement> theseMethods = ElementFilter.methodsIn(type.getEnclosedElements());
    for (ExecutableElement method : theseMethods) {
      if (!method.getModifiers().contains(Modifier.PRIVATE)) {
        boolean alreadySeen = false;
        for (Iterator<ExecutableElement> methodIter = methods.iterator(); methodIter.hasNext();) {
          ExecutableElement otherMethod = methodIter.next();
          if (elementUtils.overrides(method, otherMethod, type)) {
            methodIter.remove();
          } else if (method.getSimpleName().equals(otherMethod.getSimpleName())
              && method.getParameters().equals(otherMethod.getParameters())) {
            // If we inherit this method on more than one path, we don't want to add it twice.
            alreadySeen = true;
          }
        }
        if (!alreadySeen) {
View Full Code Here

    @Override
    public boolean process(Set<? extends TypeElement> annotations, RoundEnvironment roundEnv) {
        if (!ran) {
            ran = true;
            ExecutableElement m = getFirstMethodIn("C");
            System.err.println("method: " + m);

            TypeMirror type = (DeclaredType)m.getParameters().get(0).asType();
            System.err.println("parameters[0]: " + type);
            if (!isParameterized(type))
                throw new AssertionError(type);

            type = ((ExecutableType)m.asType()).getParameterTypes().get(0);
            System.err.println("parameterTypes[0]: " + type);
            if (!isParameterized(type))
                throw new AssertionError(type);
            System.err.println();
        }
View Full Code Here

      final TypeElement typeElement, final Element tagElement, final Document document, final Type type)
      throws ClassNotFoundException {

    for (final javax.lang.model.element.Element element : getAllMembers(typeElement)) {
      if (element instanceof ExecutableElement) {
        final ExecutableElement executableElement = (ExecutableElement) element;
        if (executableElement.getAnnotation(TagAttribute.class) == null
            && executableElement.getAnnotation(UIComponentTagAttribute.class) == null) {
          continue;
        }
        addAttribute(executableElement, tagElement, document, type);
      }
    }
View Full Code Here

  protected void addAttributes(
      final TypeElement typeElement, final List<org.jdom.Element> attributes, final List<org.jdom.Element> properties,
      final Namespace namespace) {

    for (final javax.lang.model.element.Element element : processingEnv.getElementUtils().getAllMembers(typeElement)) {
      final ExecutableElement executableElement = (ExecutableElement) element;
      if (executableElement.getAnnotation(TagAttribute.class) == null
          && executableElement.getAnnotation(UIComponentTagAttribute.class) == null) {
        continue;
      }

      addAttribute(executableElement, attributes, properties, namespace);
    }
View Full Code Here

TOP

Related Classes of javax.lang.model.element.ExecutableElement

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.