Package javax.lang.model.element

Examples of javax.lang.model.element.ExecutableElement


  protected void addPropertiesForTagOnly(final TypeElement type, final List<PropertyInfo> properties) {

    final List<? extends Element> members = processingEnv.getElementUtils().getAllMembers(type);
    for (final Element member : members) {
      if (member instanceof ExecutableElement) {
        final ExecutableElement executableElement = (ExecutableElement) member;
        addPropertyForTagOnly(executableElement, properties);
      }
    }
  }
View Full Code Here


    addProperties(type.getSuperclass(), properties);

    final List<? extends Element> members = processingEnv.getElementUtils().getAllMembers(type);
    for (final Element member : members) {
      if (member instanceof ExecutableElement) {
        final ExecutableElement executableElement = (ExecutableElement) member;
        addProperty(executableElement, properties);
      }
    }
  }
View Full Code Here

      final Document document)
      throws ClassNotFoundException {

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

                // The following if block, checks if the target accessor should be overruled by an add method.
                if ( cmStrategy == CollectionMappingStrategy.SETTER_PREFERRED
                    || cmStrategy == CollectionMappingStrategy.ADDER_PREFERRED ) {

                    // first check if there's a setter method.
                    ExecutableElement adderMethod = null;
                    if ( Executables.isSetterMethod( candidate ) ) {
                        Type targetType = ctx.getTypeFactory().getSingleParameter( candidate ).getType();
                        // ok, the current accessor is a setter. So now the strategy determines what to use
                        if ( cmStrategy == CollectionMappingStrategy.ADDER_PREFERRED ) {
                            adderMethod = method.getResultType().getAdderForType( targetType, targetPropertyName );
View Full Code Here

                for ( Mapping mapping : entry.getValue() ) {

                    PropertyMapping propertyMapping = null;

                    // fetch the target property
                    ExecutableElement targetProperty = unprocessedTargetProperties.get( mapping.getTargetName() );
                    if ( targetProperty == null ) {
                        ctx.getMessager().printMessage(
                                Diagnostic.Kind.ERROR,
                                String.format( "Unknown property \"%s\" in return type.",
                                        mapping.getTargetName()
View Full Code Here

                                candidates.add( sourceAccessor );
                            }
                        }

                        PropertyMapping newPropertyMapping = null;
                        ExecutableElement sourceAccessor = getSourceAccessor( targetProperty.getKey(), candidates );
                        if ( sourceAccessor != null ) {
                            Mapping mapping = method.getSingleMappingByTargetPropertyName( targetProperty.getKey() );

                            SourceReference sourceRef = new SourceReference.BuilderFromProperty()
                                    .sourceParameter( sourceParameter )
View Full Code Here

     *
     * @return <code>true</code>, iff the given executable was not yet overridden by a method in the given list.
     */
    private boolean wasNotYetOverridden(List<SourceMethod> methods, ExecutableElement executable) {
        for ( SourceMethod alreadyAdded : methods ) {
            ExecutableElement executableInSubtype = alreadyAdded.getExecutable();
            TypeElement declaringType = (TypeElement) executableInSubtype.getEnclosingElement();

            if ( elementUtils.overrides( executableInSubtype, executable, declaringType ) ) {
                return false;
            }
        }
View Full Code Here

      return typeMirrorOf("java.lang.Object");
    }

    private TypeMirror cloneReturnTypeMirror() {
      TypeElement object = typeElementOf("java.lang.Object");
      ExecutableElement clone = null;
      for (Element element : object.getEnclosedElements()) {
        if (element.getSimpleName().contentEquals("clone")) {
          clone = (ExecutableElement) element;
          break;
        }
      }
      return clone.getReturnType();
    }
View Full Code Here

      // don't cause a ClassCastException for TypeParameterElement.
      TypeElement wildcardsElement = typeElementOf("Wildcards");
      List<? extends ExecutableElement> methods =
          ElementFilter.methodsIn(wildcardsElement.getEnclosedElements());
      assertEquals(2, methods.size());
      ExecutableElement one = methods.get(0);
      ExecutableElement two = methods.get(1);
      assertEquals("one", one.getSimpleName().toString());
      assertEquals("two", two.getSimpleName().toString());
      TypeMirrorSet typeMirrorSet = new TypeMirrorSet();
      assertTrue(typeMirrorSet.add(one.getReturnType()));
      assertFalse(typeMirrorSet.add(two.getReturnType()));
      DeclaredType captureOne = (DeclaredType) typeUtil.capture(one.getReturnType());
      assertTrue(typeMirrorSet.add(captureOne));
      DeclaredType captureTwo = (DeclaredType) typeUtil.capture(two.getReturnType());
      assertFalse(typeMirrorSet.add(captureTwo));
      // Reminder: captureOne is Map<?#123 extends T, ?#456 super U>
      TypeVariable extendsT = (TypeVariable) captureOne.getTypeArguments().get(0);
      assertTrue(typeMirrorSet.add(extendsT));
      assertTrue(typeMirrorSet.add(extendsT.getLowerBound()))// NoType
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

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.