Package javax.lang.model.element

Examples of javax.lang.model.element.TypeElement.asType()


    // loop over all fields
    List<VariableElement> fieldEls = ElementFilter.fieldsIn(memberEls);
    for (VariableElement fieldEl : fieldEls) {
      if (!javaModelAnalyzerUtil.isStatic(fieldEl) && !javaModelAnalyzerUtil.isDeclaredInObject(fieldEl)
          && javaModelAnalyzerUtil.isAccessibleForBuilder(fieldEl, output.getBuilderModel())) {
        DeclaredType declType = (DeclaredType) pojoTypeEl.asType();
        TypeM propertyType = typeMFactory.getTypeM(javaModelAnalyzerUtil.getType(declType, fieldEl));
        output
            .getBuilderModel()
            .getProperties()
            .getOrCreate(fieldEl.getSimpleName().toString(), propertyType)
View Full Code Here


    }
  }

  private void scanGetterMethods(Input input, Output output) {
    TypeElement pojoTypeEl = input.getPojoElement();
    DeclaredType pojoClassType = (DeclaredType) pojoTypeEl.asType();
    List<? extends Element> memberEls = elements.getAllMembers(pojoTypeEl);
    // loop over all setter methods
    List<ExecutableElement> methodsEls = ElementFilter.methodsIn(memberEls);
    for (ExecutableElement methodEl : methodsEls) {
      if (!javaModelAnalyzerUtil.isStatic(methodEl) && javaModelAnalyzerUtil.isGetterMethod(methodEl)
View Full Code Here

        final Argument input;

        if (isStatic) {
            input = findInput(parameters);
        } else {
            input = new Argument(box(typeElement.asType()), "input");
        }

        final ClosureBuilder builder;

        TypeMirror returnType = method.getReturnType();
View Full Code Here

  public static TypeMirror getCollectionElementType(DeclaredType t, String fqNameOfReturnedType, String explicitTargetEntityName, Context context) {
    TypeMirror collectionElementType;
    if ( explicitTargetEntityName != null ) {
      Elements elements = context.getElementUtils();
      TypeElement element = elements.getTypeElement( explicitTargetEntityName );
      collectionElementType = element.asType();
    }
    else {
      List<? extends TypeMirror> typeArguments = t.getTypeArguments();
      if ( typeArguments.size() == 0 ) {
        throw new MetaModelGenerationException( "Unable to determine collection type" );
View Full Code Here

  public static TypeMirror getCollectionElementType(DeclaredType t, String fqNameOfReturnedType, String explicitTargetEntityName, Context context) {
    TypeMirror collectionElementType;
    if ( explicitTargetEntityName != null ) {
      Elements elements = context.getElementUtils();
      TypeElement element = elements.getTypeElement( explicitTargetEntityName );
      collectionElementType = element.asType();
    }
    else {
      List<? extends TypeMirror> typeArguments = t.getTypeArguments();
      if ( typeArguments.size() == 0 ) {
        throw new MetaModelGenerationException( "Unable to determine collection type" );
View Full Code Here

  public static TypeMirror getCollectionElementType(DeclaredType t, String fqNameOfReturnedType, String explicitTargetEntityName, Context context) {
    TypeMirror collectionElementType;
    if ( explicitTargetEntityName != null ) {
      Elements elements = context.getElementUtils();
      TypeElement element = elements.getTypeElement( explicitTargetEntityName );
      collectionElementType = element.asType();
    }
    else {
      List<? extends TypeMirror> typeArguments = t.getTypeArguments();
      if ( typeArguments.size() == 0 ) {
        throw new MetaModelGenerationException( "Unable to determine collection type" );
View Full Code Here

            String line = reader.readLine();
            if (line != null) {
              String providerName = line.trim();
              TypeElement provider = applications.getProcessingContext().getTypeElement(providerName);
              if (provider.getKind() == ElementKind.CLASS) {
                List<? extends TypeMirror> superTypes = applications.getProcessingContext().directSupertypes((TypeMirror)provider.asType());
                if (superTypes.size() > 0) {
                  TypeMirror superType = superTypes.get(0);
                  if (superType.getKind() == TypeKind.DECLARED) {
                    DeclaredType declaredTypeSuper = (DeclaredType)superType;
                    TypeElement declaredSuperElement = (TypeElement)declaredTypeSuper.asElement();
View Full Code Here

    ProcessingContext env = metaModel.model.processingContext;

    //
    TypeMirror providerFactoryTM = env.getTypeElement(ProviderFactory.class.getName()).asType();
    TypeElement providerElt = env.getTypeElement("javax.inject.Provider");
    DeclaredType providerTM = (DeclaredType)providerElt.asType();
    TypeMirror rawProviderTM = env.erasure(providerTM);

    //
    List<Map<String, Object>> bindings = (List<Map<String, Object>>)added.get("value");
    ArrayList<JSON> list = new ArrayList<JSON>();
View Full Code Here

        //
        JSON bindingJSON = new JSON().set("value", bindingValue.getName().toString());

        //
        TypeElement valueElt = env.get(bindingValue);
        TypeMirror valueTM = valueElt.asType();

        //
        if (bindingImplementation != null) {
          TypeElement implementationElt = env.get(bindingImplementation);
          DeclaredType implementationTM = (DeclaredType)implementationElt.asType();
View Full Code Here

        TypeMirror valueTM = valueElt.asType();

        //
        if (bindingImplementation != null) {
          TypeElement implementationElt = env.get(bindingImplementation);
          DeclaredType implementationTM = (DeclaredType)implementationElt.asType();

          // Check class
          if (implementationElt.getKind() != ElementKind.CLASS) {
            throw IMPLEMENTATION_INVALID_TYPE.failure(env.get(key.getElement()), providerElt.getQualifiedName());
          }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.