Examples of DecoratedTypeMirror


Examples of net.sf.jelly.apt.decorations.type.DecoratedTypeMirror

    else if (Object.class.getName().equals(fqn)) {
      return false;
    }
    else {
      if (declaration instanceof ClassDeclaration) {
        DecoratedTypeMirror decorated = (DecoratedTypeMirror) TypeMirrorDecorator.decorate(((ClassDeclaration)declaration).getSuperclass());
        if (decorated.isCollection()) {
          return true;
        }
      }

      for (InterfaceType interfaceType : declaration.getSuperinterfaces()) {
        DecoratedTypeMirror decorated = (DecoratedTypeMirror) TypeMirrorDecorator.decorate(interfaceType);
        if (decorated.isCollection()) {
          return true;
        }
      }
    }
   
View Full Code Here

Examples of net.sf.jelly.apt.decorations.type.DecoratedTypeMirror

    if (Map.class.getName().equals(fqn)) {
      return true;
    }
    else {
      if (declaration instanceof ClassDeclaration) {
        DecoratedTypeMirror decorated = (DecoratedTypeMirror) TypeMirrorDecorator.decorate(((ClassDeclaration)declaration).getSuperclass());
        if (decorated.isInstanceOf(Map.class.getName())) {
          return true;
        }
      }

      for (InterfaceType interfaceType : declaration.getSuperinterfaces()) {
        DecoratedTypeMirror decorated = (DecoratedTypeMirror) TypeMirrorDecorator.decorate(interfaceType);
        if (decorated.isInstanceOf(Map.class.getName())) {
          return true;
        }
      }
    }
View Full Code Here

Examples of net.sf.jelly.apt.decorations.type.DecoratedTypeMirror

    return false;
  }

  @Override
  public String convert(TypeMirror typeMirror) throws TemplateModelException {
    DecoratedTypeMirror decorated = (DecoratedTypeMirror) TypeMirrorDecorator.decorate(typeMirror);
    if (decorated.isPrimitive()) {
      PrimitiveType.Kind kind = ((PrimitiveType) decorated).getKind();
      switch (kind) {
        case BOOLEAN:
          return "Boolean";
        case BYTE:
        case INT:
        case SHORT:
        case CHAR:
        case FLOAT:
        case DOUBLE:
        case LONG:
          return "Integer";
        default:
          return "String";
      }
    }
    else if (decorated.isEnum()) {
      return "String";
    }
    else if (decorated.isCollection()) {
      return "Array";
    }
    else if (decorated.isArray()) {
      TypeMirror componentType = ((ArrayType) decorated).getComponentType();
      if ((componentType instanceof PrimitiveType) && (((PrimitiveType) componentType).getKind() == PrimitiveType.Kind.BYTE)) {
        return "String";
      }
    }
View Full Code Here

Examples of net.sf.jelly.apt.decorations.type.DecoratedTypeMirror

          if (conflict != null) {
            result.addError(webParam, "C# requires that all header parameters defined in the same endpoint interface have unique names. " +
              "This parameter conflicts with the one at " + (conflict.getPosition() == null ? "(unknown source position)" : conflict.getPosition()));
          }

          DecoratedTypeMirror paramType = (DecoratedTypeMirror) webParam.getType();
          if (paramType.isCollection()) {
            result.addError(webParam, "C# can't handle header parameters that are collections.");
          }

        }
        else if (webParam.getMode() != javax.jws.WebParam.Mode.IN) {
View Full Code Here

Examples of net.sf.jelly.apt.decorations.type.DecoratedTypeMirror

          for (WebParam webParam : webMethod.getWebParameters()) {
            imports.add(classnameFor.convert(webParam));
            addComponentTypes(webParam.getType(), imports);
          }

          DecoratedTypeMirror returnType = (DecoratedTypeMirror) webMethod.getReturnType();
          if (!returnType.isVoid()) {
            imports.add(classnameFor.convert((ImplicitChildElement) webMethod.getWebResult()));
            addComponentTypes(returnType, imports);
          }
        }
      }
      else if (declaration instanceof TypeDefinition) {
        TypeDefinition typeDef = (TypeDefinition) declaration;
        if (!typeDef.isBaseObject()) {
          imports.add(classnameFor.convert(typeDef.getSuperclass()));
        }
        for (Attribute attribute : typeDef.getAttributes()) {
          imports.add(classnameFor.convert(attribute));
          TypeMirror accessorType;
          if (attribute.isAdapted()) {
              // If the attribute is adaptable, we need to use the adapting type
              // else it will try to import the "real type" defined by the attribute.
              accessorType = attribute.getAdapterType().getAdaptingType();
          }
          else {
              accessorType = attribute.getAccessorType();
          }
          addComponentTypes(accessorType, imports);
        }
        for (Element element : typeDef.getElements()) {
          imports.add(classnameFor.convert(element));
          TypeMirror accessorType;
          if (element.isAdapted()) {
              // If the element is adaptable, we need to use the adapting type
              // else it will try to import the "real type" defined by the attribute.
              accessorType = element.getAdapterType().getAdaptingType();
          }
          else {
              accessorType = element.getAccessorType();
          }
          addComponentTypes(accessorType, imports);
        }
        Value value = typeDef.getValue();
        if (value != null) {
          imports.add(classnameFor.convert(value));
          addComponentTypes(value.getAccessorType(), imports);
        }
      }
      else if (declaration instanceof WebMethod) {
        WebMethod webMethod = (WebMethod) declaration;
        DecoratedTypeMirror returnType = (DecoratedTypeMirror) webMethod.getReturnType();
        if (!returnType.isVoid()) {
          imports.add(classnameFor.convert((ImplicitChildElement) webMethod.getWebResult()));
          addComponentTypes(returnType, imports);
        }
      }
      else {
View Full Code Here

Examples of net.sf.jelly.apt.decorations.type.DecoratedTypeMirror

    else if (Object.class.getName().equals(fqn)) {
      return false;
    }
    else {
      if (declaration instanceof ClassDeclaration) {
        DecoratedTypeMirror decorated = (DecoratedTypeMirror) TypeMirrorDecorator.decorate(((ClassDeclaration)declaration).getSuperclass());
        if (decorated.isCollection()) {
          return true;
        }
      }

      for (InterfaceType interfaceType : declaration.getSuperinterfaces()) {
        DecoratedTypeMirror decorated = (DecoratedTypeMirror) TypeMirrorDecorator.decorate(interfaceType);
        if (decorated.isCollection()) {
          return true;
        }
      }
    }
   
View Full Code Here

Examples of net.sf.jelly.apt.decorations.type.DecoratedTypeMirror

    if (Map.class.getName().equals(fqn)) {
      return true;
    }
    else {
      if (declaration instanceof ClassDeclaration) {
        DecoratedTypeMirror decorated = (DecoratedTypeMirror) TypeMirrorDecorator.decorate(((ClassDeclaration)declaration).getSuperclass());
        if (decorated.isInstanceOf(Map.class.getName())) {
          return true;
        }
      }

      for (InterfaceType interfaceType : declaration.getSuperinterfaces()) {
        DecoratedTypeMirror decorated = (DecoratedTypeMirror) TypeMirrorDecorator.decorate(interfaceType);
        if (decorated.isInstanceOf(Map.class.getName())) {
          return true;
        }
      }
    }
View Full Code Here

Examples of net.sf.jelly.apt.decorations.type.DecoratedTypeMirror

    return false;
  }

  @Override
  public String convert(TypeMirror typeMirror) throws TemplateModelException {
    DecoratedTypeMirror decorated = (DecoratedTypeMirror) TypeMirrorDecorator.decorate(typeMirror);
    if (decorated.isPrimitive()) {
      PrimitiveType.Kind kind = ((PrimitiveType) decorated).getKind();
      switch (kind) {
        case BOOLEAN:
          return "Boolean";
        case BYTE:
        case INT:
        case SHORT:
        case CHAR:
          return "Fixnum";
        case FLOAT:
        case DOUBLE:
          return "Float";
        case LONG:
          return "Bignum";
        default:
          return "String";
      }
    }
    else if (decorated.isEnum()) {
      return "String";
    }
    else if (decorated.isCollection()) {
      return "Array";
    }
    else if (decorated.isArray()) {
      TypeMirror componentType = ((ArrayType) decorated).getComponentType();
      if ((componentType instanceof PrimitiveType) && (((PrimitiveType) componentType).getKind() == PrimitiveType.Kind.BYTE)) {
        return "String";
      }
    }
View Full Code Here

Examples of net.sf.jelly.apt.decorations.type.DecoratedTypeMirror

    classConversions.put(javax.xml.bind.JAXBElement.class.getName(), "Object");
  }

  @Override
  public String convert(TypeMirror typeMirror) throws TemplateModelException {
    DecoratedTypeMirror decorated = (DecoratedTypeMirror) TypeMirrorDecorator.decorate(typeMirror);
    if (decorated.isPrimitive()) {
      switch (((PrimitiveType)decorated).getKind()) {
        case BOOLEAN:
          return "Boolean";
        case BYTE:
          return "int";
        case CHAR:
          return "Number";
        case DOUBLE:
          return "Number";
        case FLOAT:
          return "Number";
        case INT:
          return "int";
        case LONG:
          return "Number";
        case SHORT:
          return "int";
      }
    }
    else if (decorated.isArray()) {
      ArrayType arrayType = (ArrayType) decorated;
      DecoratedTypeMirror decoratedComponentType = (DecoratedTypeMirror) TypeMirrorDecorator.decorate(arrayType.getComponentType());
      if (((decoratedComponentType.isPrimitive()) && (((PrimitiveType) decoratedComponentType).getKind() == PrimitiveType.Kind.CHAR))
        || (decoratedComponentType.isInstanceOf(Character.class.getName()))) {
        return "String";
      }
      else if (((decoratedComponentType.isPrimitive()) && (((PrimitiveType) decoratedComponentType).getKind() == PrimitiveType.Kind.BYTE))
        || (decoratedComponentType.isInstanceOf(Byte.class.getName()))) {
        return "flash.utils.ByteArray";
      }
      return "Array";
    }
    else if (decorated.isCollection()) {
View Full Code Here

Examples of net.sf.jelly.apt.decorations.type.DecoratedTypeMirror

    this.classConversions.put(DataHandler.class.getName(), "byte[]");
  }

  @Override
  public String convert(TypeMirror typeMirror) throws TemplateModelException {
    DecoratedTypeMirror decorated = (DecoratedTypeMirror) TypeMirrorDecorator.decorate(typeMirror);
    if ((typeMirror instanceof ArrayType) && (((ArrayType) typeMirror).getComponentType() instanceof PrimitiveType)) {
      //special case for primitive arrays.
      return super.convert(((ArrayType) typeMirror).getComponentType()) + "[]";
    }
    else if (decorated.isEnum()) {
      return String.class.getName();
    }
    else if (decorated.isDeclared()) {
      DeclaredType declaredType = ((DeclaredType) decorated);
      String fqn = declaredType.getDeclaration().getQualifiedName();
      if (classConversions.containsKey(fqn)) {
        return classConversions.get(fqn);
      }
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.