Package javax.lang.model.type

Examples of javax.lang.model.type.ExecutableType


    DeclaredType type = null;
    if ( elem.asType() instanceof DeclaredType ) {
      type = ( (DeclaredType) elem.asType() );
    }
    else if ( elem.asType() instanceof ExecutableType ) {
      ExecutableType executableType = (ExecutableType) elem.asType();
      if ( executableType.getReturnType() instanceof DeclaredType ) {
        type = (DeclaredType) executableType.getReturnType();
      }
    }
    return type;
  }
View Full Code Here


    DeclaredType type = null;
    if ( elem.asType() instanceof DeclaredType ) {
      type = ( (DeclaredType) elem.asType() );
    }
    else if ( elem.asType() instanceof ExecutableType ) {
      ExecutableType executableType = (ExecutableType) elem.asType();
      if ( executableType.getReturnType() instanceof DeclaredType ) {
        type = (DeclaredType) executableType.getReturnType();
      }
    }
    return type;
  }
View Full Code Here

    for (ExecutableElement methodEl : methodEls) {
      if (!javaModelAnalyzerUtil.isStatic(methodEl) && javaModelAnalyzerUtil.isSetterMethod(methodEl)
          && !javaModelAnalyzerUtil.isDeclaredInObject(methodEl)
          && javaModelAnalyzerUtil.isAccessibleForBuilder(methodEl, output.getBuilderModel())) {
        String propertyName = javaModelAnalyzerUtil.getPropertyName(methodEl);
        ExecutableType execType = (ExecutableType) javaModelAnalyzerUtil.getType(pojoClassType, methodEl);
        TypeMirror propertyTypeMirror = execType.getParameterTypes().get(0);
        TypeM propertyType = typeMFactory.getTypeM(propertyTypeMirror);
        output
            .getBuilderModel()
            .getProperties()
            .getOrCreate(propertyName, propertyType)
View Full Code Here

    for (ExecutableElement methodEl : methodsEls) {
      if (!javaModelAnalyzerUtil.isStatic(methodEl) && javaModelAnalyzerUtil.isGetterMethod(methodEl)
          && !javaModelAnalyzerUtil.isDeclaredInObject(methodEl)
          && javaModelAnalyzerUtil.isAccessibleForBuilder(methodEl, output.getBuilderModel())) {
        String propertyName = javaModelAnalyzerUtil.getPropertyName(methodEl);
        ExecutableType execType = (ExecutableType) javaModelAnalyzerUtil.getType(pojoClassType, methodEl);
        TypeMirror propertyTypeMirror = execType.getReturnType();
        TypeM propertyType = typeMFactory.getTypeM(propertyTypeMirror);

        PropertyM prop = output.getBuilderModel().getProperties().get(propertyName, propertyType);
        if (prop != null) {
          prop.readableVia(new MethodM(methodEl.getSimpleName().toString(), methodEl.getModifiers())
View Full Code Here

    DeclaredType type = null;
    if ( elem.asType() instanceof DeclaredType ) {
      type = ( (DeclaredType) elem.asType() );
    }
    else if ( elem.asType() instanceof ExecutableType ) {
      ExecutableType executableType = (ExecutableType) elem.asType();
      if ( executableType.getReturnType() instanceof DeclaredType ) {
        type = (DeclaredType) executableType.getReturnType();
      }
    }
    return type;
  }
View Full Code Here

    public ExecutableElement visitExecutable(ExecutableElement domainMethodElement, State state) {
      // Quick check for name, paramer count, and return type assignability
      if (domainMethodElement.getSimpleName().contentEquals(name)
          && domainMethodElement.getParameters().size() == params.size()) {
        // Pick up parameterizations in domain type
        ExecutableType domainMethod = viewIn(domainType, domainMethodElement, state);

        boolean returnTypeMatches;
        if (returnType == null) {
          /*
           * This condition is for methods that we don't really care about the
           * domain return types (for getId(), getVersion()).
           */
          returnTypeMatches = true;
        } else {
          TypeMirror domainReturn =
              TypeSimplifier.simplify(domainMethod.getReturnType(), boxReturnType, state);
          // The isSameType handles the NONE case.
          returnTypeMatches = state.types.isSubtype(domainReturn, returnType);
        }
        if (returnTypeMatches) {
          boolean paramsMatch = true;
          Iterator<TypeMirror> lookFor = params.iterator();
          Iterator<? extends TypeMirror> domainParam = domainMethod.getParameterTypes().iterator();
          while (lookFor.hasNext()) {
            assert domainParam.hasNext();
            TypeMirror requestedType = lookFor.next();
            TypeMirror paramType = TypeSimplifier.simplify(domainParam.next(), false, state);
            if (!state.types.isSubtype(requestedType, paramType)) {
View Full Code Here

    if (currentTypeIsProxy && name.contentEquals("stableId")
        && clientMethodElement.getParameters().isEmpty()) {
      return null;
    }

    ExecutableType clientMethod = viewIn(checkedElement, clientMethodElement, state);
    List<TypeMirror> lookFor = new ArrayList<TypeMirror>();
    // Convert client method signature to domain types
    TypeMirror returnType;
    try {
      returnType = convertToDomainTypes(clientMethod, lookFor, clientMethodElement, state);
    } catch (UnmappedTypeException e) {
      /*
       * Unusual: this would happen if a RequestContext for which we have a
       * resolved domain service method uses unresolved proxy types. For
       * example, the RequestContext uses a @Service annotation, while one or
       * more proxy types use @ProxyForName("") and specify a domain type not
       * available to the compiler.
       */
      return null;
    }

    ExecutableElement domainMethod;
    if (currentTypeIsProxy && isSetter(clientMethodElement, state)) {
      // Look for void setFoo(...)
      domainMethod =
          new MethodFinder(name, state.types.getNoType(TypeKind.VOID), lookFor, false, state).scan(
              domainElement, state);
      if (domainMethod == null) {
        // Try a builder style
        domainMethod =
            new MethodFinder(name, domainElement.asType(), lookFor, false, state).scan(
                domainElement, state);
      }
    } else {
      /*
       * The usual case for getters and all service methods. Only box return
       * types when matching context methods since there's a significant
       * semantic difference between a null Integer and 0.
       */
      domainMethod =
          new MethodFinder(name, returnType, lookFor, !currentTypeIsProxy, state).scan(
              domainElement, state);
    }

    if (domainMethod == null) {
      // Did not find a service method
      StringBuilder sb = new StringBuilder();
      sb.append(returnType).append(" ").append(name).append("(");
      for (TypeMirror param : lookFor) {
        sb.append(param);
      }
      sb.append(")");

      state.poison(clientMethodElement, Messages.domainMissingMethod(sb));
      return null;
    }
   
     /*
     * Check the domain method for any requirements for it to be static.
     * InstanceRequests assume instance methods on the domain type.
     */
    boolean isInstanceRequest =
        state.types.isSubtype(clientMethod.getReturnType(), state.instanceRequestType);

    if ((isInstanceRequest || requireInstanceDomainMethods)
        && domainMethod.getModifiers().contains(Modifier.STATIC)) {
      state.poison(checkedElement, Messages.domainMethodWrongModifier(false, domainMethod
          .getSimpleName()));
View Full Code Here

TOP

Related Classes of javax.lang.model.type.ExecutableType

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.