Examples of TypeMirror


Examples of javax.lang.model.type.TypeMirror

            Map<String, AnnotationValue> values = getValues(annotation);
            AnnotationMirror from = getValue(AnnotationMirror.class, values, "term");
            if (from == null) {
                return false;
            }
            TypeMirror fromType = getReduceTermType(from);
            if (fromType == null) {
                return false;
            }
            return typeEqual(fromType, target);
        }
View Full Code Here

Examples of javax.lang.model.type.TypeMirror

            Map<String, AnnotationValue> values = getValues(annotation);
            AnnotationMirror reduce = getValue(AnnotationMirror.class, values, "term");
            if (reduce == null) {
                throw new IllegalArgumentException();
            }
            TypeMirror shuffleType = getReduceTermType(reduce);
            DataModelMirror model = environment.loadDataModel(shuffleType);
            AnnotationMirror shuffleKey = getReduceTermKey(reduce);
            if (model != null && shuffleKey != null) {
                return toShuffleKey(-1, model, shuffleKey);
            }
View Full Code Here

Examples of javax.lang.model.type.TypeMirror

    void assertTypeEquals(
            OperatorCompilingEnvironment env,
            TypeMirror type,
            Class<?> expected) {
        TypeElement elem = env.getElementUtils().getTypeElement(expected.getName());
        TypeMirror exType = env.getTypeUtils().getDeclaredType(elem);
        assertTrue(env.getTypeUtils().isSameType(type, exType));
    }
View Full Code Here

Examples of javax.lang.model.type.TypeMirror

    public ArrayType convert(javax.lang.model.type.ArrayType type) {
        if (type == null) {
            throw new IllegalArgumentException("type must not be null"); //$NON-NLS-1$
        }
        int dimensions = 1;
        TypeMirror component = type.getComponentType();
        while (component.getKind() == TypeKind.ARRAY) {
            component = ((javax.lang.model.type.ArrayType) component).getComponentType();
            dimensions++;
        }
        Type result = convert0(component);
        if (result == null) {
View Full Code Here

Examples of javax.lang.model.type.TypeMirror

     */
    public Wildcard convert(WildcardType type) {
        if (type == null) {
            throw new IllegalArgumentException("type must not be null"); //$NON-NLS-1$
        }
        TypeMirror upper = type.getExtendsBound();
        if (upper != null) {
            if (type.getSuperBound() != null) {
                return null;
            }
            Type bound = convert0(upper);
            if (bound == null) {
                return null;
            }
            return factory.newWildcard(WildcardBoundKind.UPPER_BOUNDED, bound);
        }
        TypeMirror lower = type.getSuperBound();
        if (lower != null) {
            Type bound = convert0(lower);
            if (bound == null) {
                return null;
            }
View Full Code Here

Examples of javax.lang.model.type.TypeMirror

                    i,
                    keys.get(i));
        }
        for (int i = startResults; i < startParameters; i++) {
            TypeConstraint outputType = a.getParameterType(i).getTypeArgument();
            TypeMirror outputTypeMirror = outputType.getType();
            String found = builder.findInput(outputTypeMirror);
            if (found == null && outputType.isProjectiveModel()) {
                a.error("出力型{0}に対する入力が見つかりません", outputTypeMirror);
            }
            builder.addOutput(
View Full Code Here

Examples of javax.lang.model.type.TypeMirror

        writer.println("<h1>" + title + "</h1>");

        showDocumentationAndFieldInjections(writer, roundEnv, classElement, "");

        // This code is not my fault, it seems to honestly be the hacky way to find a class name in APT :)
        TypeMirror consumerType = null;
        try {
            uriEndpoint.consumerClass();
        } catch (MirroredTypeException mte) {
            consumerType = mte.getTypeMirror();
        }

        boolean found = false;
        String consumerClassName = null;
        String consumerPrefix = Strings.getOrElse(uriEndpoint.consumerPrefix(), "");
        if (consumerType != null) {
            consumerClassName = consumerType.toString();
            TypeElement consumerElement = findTypeElement(roundEnv, consumerClassName);
            if (consumerElement != null) {
                writer.println("<h2>" + scheme + " consumer" + "</h2>");
                showDocumentationAndFieldInjections(writer, roundEnv, consumerElement, consumerPrefix);
                found = true;
View Full Code Here

Examples of javax.lang.model.type.TypeMirror

                    if (Strings.isNullOrEmpty(name)) {
                        name = fieldName;
                    }
                    name = prefix + name;
                    // if the field type is a nested parameter then iterate through its fields
                    TypeMirror fieldType = fieldElement.asType();
                    String fieldTypeName = fieldType.toString();
                    TypeElement fieldTypeElement = findTypeElement(roundEnv, fieldTypeName);
                    UriParams fieldParams = null;
                    if (fieldTypeElement != null) {
                        fieldParams = fieldTypeElement.getAnnotation(UriParams.class);
                    }
                    if (fieldParams != null) {
                        String nestedPrefix = prefix;
                        String extraPrefix = fieldParams.prefix();
                        if (!Strings.isNullOrEmpty(extraPrefix)) {
                            nestedPrefix += extraPrefix;
                        }
                        findClassProperties(roundEnv, sortedMap, fieldTypeElement, nestedPrefix);
                    } else {
                        String docComment = elementUtils.getDocComment(fieldElement);
                        if (Strings.isNullOrEmpty(docComment)) {
                            String setter = "set" + fieldName.substring(0, 1).toUpperCase();
                            if (fieldName.length() > 1) {
                                setter += fieldName.substring(1);
                            }
                            //  lets find the setter
                            List<ExecutableElement> methods = ElementFilter.methodsIn(classElement.getEnclosedElements());
                            for (ExecutableElement method : methods) {
                                String methodName = method.getSimpleName().toString();
                                if (setter.equals(methodName) && method.getParameters().size() == 1) {
                                    String doc = elementUtils.getDocComment(method);
                                    if (!Strings.isNullOrEmpty(doc)) {
                                        docComment = doc;
                                        break;
                                    }
                                }
                            }
                        }
                        if (docComment == null) {
                            docComment = "";
                        }
                        List<String> values = new ArrayList<String>();
                        values.add("    <td>" + fieldTypeName + "</td>");
                        values.add("    <td>" + docComment.trim() + "</td>");

                        // TODO would be nice here to create a default endpoint/consumer object
                        // and return the default value of the field so we can put it into the docs
                        Object defaultValue = null;
                        if (defaultValue != null) {
                            values.add("    <td>" + defaultValue + "</td>");
                        }
                        if (sortedMap.containsKey(name)) {
                            error("Duplicate parameter annotation named '" + name + "' on class " + classElement.getQualifiedName());
                        } else {
                            sortedMap.put(name, values);
                        }
                    }
                }
            }
            TypeElement baseTypeElement = null;
            TypeMirror superclass = classElement.getSuperclass();
            if (superclass != null) {
                String superClassName = canonicalClassName(superclass.toString());
                baseTypeElement = findTypeElement(roundEnv, superClassName);
            }
            if (baseTypeElement != null) {
                classElement = baseTypeElement;
            } else {
View Full Code Here

Examples of javax.lang.model.type.TypeMirror

  }

  private static void printClassDeclaration(MetaEntity entity, PrintWriter pw, Context context) {
    pw.print( "public abstract class " + entity.getSimpleName() + "_" );

    final TypeMirror superClass = entity.getTypeElement().getSuperclass();
    //superclass of Object is of NoType which returns some other kind
    if ( superClass.getKind() == TypeKind.DECLARED ) {
      //F..king Ch...t Have those people used their horrible APIs even once?
      final Element superClassElement = ( ( DeclaredType ) superClass ).asElement();
      String superClassName = ( ( TypeElement ) superClassElement ).getQualifiedName().toString();
      if ( context.getMetaEntitiesToProcess().containsKey( superClassName )
          || context.getMetaSuperclassAndEmbeddableToProcess().containsKey( superClassName ) ) {
View Full Code Here

Examples of javax.lang.model.type.TypeMirror

    }
    return type.toString();
  }

  static public TypeElement getSuperclassTypeElement(TypeElement element) {
    final TypeMirror superClass = element.getSuperclass();
    //superclass of Object is of NoType which returns some other kind
    if ( superClass.getKind() == TypeKind.DECLARED ) {
      //F..king Ch...t Have those people used their horrible APIs even once?
      final Element superClassElement = ( ( DeclaredType ) superClass ).asElement();
      return ( TypeElement ) superClassElement;
    }
    else {
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.