Examples of DeclaredType


Examples of javax.lang.model.type.DeclaredType

        assert annotationType != null;
        if (elem == null) {
            return null;
        }
        for (AnnotationMirror annotation : elem.getAnnotationMirrors()) {
            DeclaredType aType = annotation.getAnnotationType();
            if (typeEqual(aType, annotationType)) {
                return annotation;
            }
        }
        return null;
View Full Code Here

Examples of javax.lang.model.type.DeclaredType

                        PortTypeDescription.reference(outputType, input.getName()),
                        output.getParameterPosition(),
                        null);
            }
        }
        DeclaredType classType = environment.getDeclaredType(Class.class);
        for (OperatorPortDeclaration param : parameters) {
            // check is form of M<T>
            TypeMirror paramType = param.getType().getRepresentation();
            if (paramType.getKind() != TypeKind.DECLARED) {
                continue;
            }
            DeclaredType declParamType = (DeclaredType) paramType;
            if (declParamType.getTypeArguments().size() != 1) {
                continue;
            }
            // check is <: Class<?>
            if (types.isSameType(environment.getErasure(paramType), classType) == false) {
                continue;
            }
            if (types.isSameType(declParamType.getTypeArguments().get(0), outputType)) {
                return new OperatorPortDeclaration(
                        output.getKind(),
                        output.getDocumentation(),
                        output.getName(),
                        PortTypeDescription.reference(outputType, param.getName()),
View Full Code Here

Examples of javax.lang.model.type.DeclaredType

    }

    private boolean validateClassModifiers(Element element) {
        assert element != null;
        TypeElement type = (TypeElement) element;
        DeclaredType superType = environment.getDeclaredType(FlowDescription.class);
        if (environment.getTypeUtils().isSubtype(type.asType(), superType) == false) {
            raiseInvalidClass(type, MessageFormat.format(
                    "フロー部品クラス{0}は{1}のサブクラスとして宣言する必要があります",
                    "{0}",
                    FlowDescription.class.getName()));
View Full Code Here

Examples of javax.lang.model.type.DeclaredType

    }

    private boolean isOperatorHelper(ExecutableElement method) {
        assert method != null;
        for (AnnotationMirror mirror : method.getAnnotationMirrors()) {
            DeclaredType annotationType = mirror.getAnnotationType();
            Element element = annotationType.asElement();
            if (element != null && element.getAnnotation(OperatorHelper.class) != null) {
                return true;
            }
        }
        return false;
View Full Code Here

Examples of javax.lang.model.type.DeclaredType

        if (types.isSameType(erasedSelector, environment.getDeclaredType(List.class)) == false) {
            throw new ResolveException(MessageFormat.format(
                    "マスタ選択を行うメソッド{0}の1つめの引数は、List<...>の形式でなければなりません",
                    selectorMethod.getSimpleName()));
        }
        DeclaredType list = (DeclaredType) firstParameter;
        if (list.getTypeArguments().size() != 1) {
            throw new ResolveException(MessageFormat.format(
                    "マスタ選択を行うメソッド{0}の1つめの引数は、List<...>の形式でなければなりません",
                    selectorMethod.getSimpleName()));
        }
        TypeMirror selectorElement = list.getTypeArguments().get(0);
        return environment.loadDataModel(selectorElement);
    }
View Full Code Here

Examples of javax.lang.model.type.DeclaredType

         */
        public TypeConstraint getTypeArgument() {
            if (type.getKind() != TypeKind.DECLARED) {
                return new TypeConstraint(environment.getTypeUtils().getNoType(TypeKind.NONE));
            }
            DeclaredType declared = (DeclaredType) type;
            List<? extends TypeMirror> arguments = declared.getTypeArguments();
            if (arguments.isEmpty()) {
                return new TypeConstraint(environment.getTypeUtils().getNoType(TypeKind.NONE));
            }
            return new TypeConstraint(arguments.get(0));
        }
View Full Code Here

Examples of javax.lang.model.type.DeclaredType

  private String[] getCollectionType(String propertyName, String explicitTargetEntity) {
    String types[] = new String[2];
    for ( Element elem : element.getEnclosedElements() ) {
      if ( elem.getSimpleName().toString().equals( propertyName ) ) {
        DeclaredType type = ( ( DeclaredType ) elem.asType() );
        if ( explicitTargetEntity == null ) {
          types[0] = TypeUtils.extractClosestRealTypeAsString( type.getTypeArguments().get( 0 ), context );
        }
        else {
          types[0] = explicitTargetEntity;
        }
        types[1] = COLLECTIONS.get( type.asElement().toString() );
      }
    }
    return types;
  }
View Full Code Here

Examples of javax.lang.model.type.DeclaredType

    methods = scanMethods(declaration);
    validate();
  }
 
  private void validate() {
    DeclaredType factory = ProcessorUtil.findFactory(declaration);
    if (factory == null) {
      success = false;
      messager.printMessage(ERROR, "Interface must extend com.artemis.EntityFactory", declaration);
      return;
    }
   
    // if empty, we're probably extending an existing factory
    if (factory.getTypeArguments().size() > 0) {
      DeclaredType argument = ((DeclaredType) factory.getTypeArguments().get(0));
      TypeElement factoryType = (TypeElement) argument.asElement();
      if (!factoryType.getQualifiedName().equals(declaration.getQualifiedName())) {
        success = false;
        messager.printMessage(ERROR,
            format("Expected EntityFactory<%s>, but found EntityFactory<%s>",
                declaration.getSimpleName(),
View Full Code Here

Examples of javax.lang.model.type.DeclaredType

 
  public static boolean isString(TypeMirror mirror) {
    if (!(mirror instanceof DeclaredType))
      return false;
   
    DeclaredType type = (DeclaredType) mirror;
    Element e = type.asElement();
    if (!(e instanceof TypeElement))
      return false;
   
    TypeElement typeElement = (TypeElement) e;
   
View Full Code Here

Examples of javax.lang.model.type.DeclaredType

      if ( !elem.getSimpleName().toString().equals( propertyName ) ) {
        continue;
      }

      DeclaredType type = ( ( DeclaredType ) elem.asType() );
      determineTargetType( type, propertyName, explicitTargetEntity, types );
      determineCollectionType( type, types );
      if ( types[1].equals( "javax.persistence.metamodel.MapAttribute" ) ) {
        determineMapType( type, explicitMapKeyClass, types );
      }
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.