Package com.sun.mirror.type

Examples of com.sun.mirror.type.TypeMirror


  private final TypeMirror type;

  public ResourceEntityParameter(ResourceMethod method, ParameterDeclaration delegate) {
    super(delegate);
    TypeMirror typeMirror;
    TypeHint hintInfo = getAnnotation(TypeHint.class);
    if (hintInfo != null) {
      try {
        Class hint = hintInfo.value();
        AnnotationProcessorEnvironment env = net.sf.jelly.apt.Context.getCurrentEnvironment();
View Full Code Here


      if ((webParam.isOutput()) && (!webParam.isHeader())) {
        parts.add(webParam);
      }
    }

    TypeMirror returnType = this.webMethod.getReturnType();
    if (!(returnType instanceof VoidType)) {
      parts.add(this.webMethod.getWebResult());
    }

    return parts;
View Full Code Here

      else {
        throw new IllegalStateException();
      }
    }
    else if (enumClass.isArray()) {
      TypeMirror componentType = getEnumBaseClass(enumClass.getComponentType());
      return getEnv().getTypeUtils().getArrayType(componentType);
    }
    else {
      TypeDeclaration decl = getEnv().getTypeDeclaration(enumClass.getName());
      return getEnv().getTypeUtils().getDeclaredType(decl);
View Full Code Here

    TypeDeclaration declaration = declaredType.getDeclaration();
    if (declaration == null) {
      return null;
    }
    else if ("java.util.Map".equals(declaration.getQualifiedName())) {
      TypeMirror keyType = null;
      TypeMirror valueType = null;

      Collection<TypeMirror> typeArgs = declaredType.getActualTypeArguments();
      if ((typeArgs != null) && (typeArgs.size() == 2)) {
        Iterator<TypeMirror> argIt = typeArgs.iterator();
        keyType = argIt.next();
        valueType = argIt.next();
      }

      if ((keyType == null) || (valueType == null)) {
        AnnotationProcessorEnvironment env = Context.getCurrentEnvironment();
        TypeMirror objectType = env.getTypeUtils().getDeclaredType(env.getTypeDeclaration(Object.class.getName()));
        keyType = objectType;
        valueType = objectType;
      }

      return new MapType((InterfaceType) declaredType, keyType, valueType);
View Full Code Here

  private DeclaredType originalType;

  public MapType(InterfaceType interfaceType, TypeMirror keyType, TypeMirror valueType) {
    super(interfaceType);

    TypeMirror mapKeyType = MapTypeUtil.findMapType(keyType);
    if (mapKeyType != null) {
      this.keyType = mapKeyType;
    }
    else {
      this.keyType = keyType;
    }

    TypeMirror mapValueType = MapTypeUtil.findMapType(valueType);
    if (mapValueType != null) {
      this.valueType = mapValueType;
    }
    else {
      this.valueType = valueType;
View Full Code Here

        declaration = getEnv().getTypeDeclaration(typeClass.getName());
      }
    }
    catch (MirroredTypeException e) {
      //This exception implies the ref is within the source base.
      TypeMirror typeMirror = e.getTypeMirror();
      if (typeMirror instanceof DeclaredType) {
        declaration = ((DeclaredType) typeMirror).getDeclaration();
      }
    }
View Full Code Here

   */
  public String getMaxOccurs() {
    DecoratedTypeMirror typeMirror = (DecoratedTypeMirror) TypeMirrorDecorator.decorate(this.delegate);
    boolean unbounded = typeMirror.isCollection() || typeMirror.isArray();
    if (typeMirror.isArray()) {
      TypeMirror componentType = ((ArrayType) typeMirror).getComponentType();
      //special case for byte[]
      if ((componentType instanceof PrimitiveType) && (((PrimitiveType) componentType).getKind() == PrimitiveType.Kind.BYTE)) {
        unbounded = false;
      }
    }
View Full Code Here

    if (this.path == null) {
      throw new IllegalArgumentException("A subresource locator must specify a path with the @javax.ws.rs.Path annotation.");
    }

    SubResource resource;
    TypeMirror returnType = delegate.getReturnType();
    if ((returnType instanceof DeclaredType) && ((DeclaredType) returnType).getDeclaration() != null) {
      TypeDeclaration declaration = ((DeclaredType) returnType).getDeclaration();
      resource = findRecursiveSubResource(declaration, getPath());
      resource = resource == null ? new SubResource(declaration, getPath(), this) : resource;
    }
View Full Code Here

    return getXmlType().getQname();
  }

  @Override
  public TypeMirror getType() {
    TypeMirror type = super.getType();
    MapType mapType = MapTypeUtil.findMapType(type);
    if (mapType != null) {
      type = mapType;
    }
    return type;
View Full Code Here

  public XmlType getXmlType() {
    try {
      XmlType xmlType = XmlTypeFactory.findSpecifiedType(this);

      if (xmlType == null) {
        TypeMirror type = getType();
        if (isHolder()) {
          Collection<TypeMirror> typeArgs = ((DeclaredType) type).getActualTypeArguments();
          if ((typeArgs == null) || (typeArgs.size() == 0)) {
            throw new ValidationException(getPosition(), "Parameter " + getSimpleName() + ": unable to get the type of the holder.");
          }
View Full Code Here

TOP

Related Classes of com.sun.mirror.type.TypeMirror

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.