public TypeMirror getComponentType(TypeMirror t) { if (t instanceof ArrayType) { ArrayType at = (ArrayType) t; return at.getComponentType(); } throw new IllegalArgumentException(); }
public TypeMirror getComponentType(TypeMirror t) { if (t instanceof ArrayType) { ArrayType at = (ArrayType) t; return at.getComponentType(); } throw new IllegalArgumentException(); }
public void visitArrayType(ArrayType arrayType) { if (isInArray) { this.xmlType = null; this.errorMessage = "No support yet for multidimensional arrays."; return; } arrayType.getComponentType().accept(this); if (this.errorMessage != null) { this.errorMessage = "Problem with the array component type: " + this.errorMessage; } }
public boolean isArrayButNotByteArray(TypeMirror t) { if(!isArray(t)) return false; ArrayType at = (ArrayType) t; TypeMirror ct = at.getComponentType(); return !ct.equals(primitiveByte); }
public void visitArrayType(ArrayType arrayType) { if (isInArray) { this.xmlType = null; this.errorMessage = "No support yet for multidimensional arrays."; return; } arrayType.getComponentType().accept(this); if (this.errorMessage != null) { this.errorMessage = "Problem with the array component type: " + this.errorMessage; } }
@Override public void visitArrayType(ArrayType arrayType) { arrayType.getComponentType().accept(this); fqn[0] += "[]"; } });
public boolean isArrayButNotByteArray(TypeMirror t) { if(!isArray(t)) return false; ArrayType at = (ArrayType) t; TypeMirror ct = at.getComponentType(); return !ct.equals(primitiveByte); }
public void visitArrayType(ArrayType arrayType) { arrayType.getComponentType().accept(this); }
public TypeMirror getComponentType() { return TypeMirrorDecorator.decorate(((ArrayType)delegate).getComponentType()); }
public void visitArrayType(ArrayType arrayType) { arrayType.getComponentType().accept(this); }
private boolean isDataHandlers(DecoratedTypeMirror type) { if (type.isCollection()) { Collection<TypeMirror> typeArgs = ((DeclaredType) type).getActualTypeArguments(); if ((typeArgs != null) && (typeArgs.size() == 1)) { return isDataHandler((DecoratedTypeMirror) typeArgs.iterator().next()); } } else if (type.isArray()) { return isDataHandler((DecoratedTypeMirror) ((ArrayType) type).getComponentType()); } return false; }
private boolean isDataHandlers(DecoratedTypeMirror type) { if (type.isCollection()) { Collection<TypeMirror> typeArgs = ((DeclaredType) type).getActualTypeArguments(); if ((typeArgs != null) && (typeArgs.size() == 1)) { return isDataHandler((DecoratedTypeMirror) typeArgs.iterator().next()); } } else if (type.isArray()) { return isDataHandler((DecoratedTypeMirror) ((ArrayType) type).getComponentType()); } return false; }
private boolean isDataHandlers(DecoratedTypeMirror type) { if (type.isCollection()) { Collection<TypeMirror> typeArgs = ((DeclaredType) type).getActualTypeArguments(); if ((typeArgs != null) && (typeArgs.size() == 1)) { return isDataHandler((DecoratedTypeMirror) typeArgs.iterator().next()); } } else if (type.isArray()) { return isDataHandler((DecoratedTypeMirror) ((ArrayType) type).getComponentType()); } return false; }
@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); } } return super.convert(typeMirror); }
/** * The min occurs of this element. * * @return The min occurs of this element. */ public int getMinOccurs() { if (isRequired()) { return 1; } TypeMirror accessorType = getAccessorType(); boolean primitive = (accessorType instanceof PrimitiveType); if ((!primitive) && (accessorType instanceof ArrayType)) { //we have to check if the component type if its an array type, too. TypeMirror componentType = ((ArrayType) accessorType).getComponentType(); primitive = (componentType instanceof PrimitiveType) && (((PrimitiveType)componentType).getKind() != PrimitiveType.Kind.BYTE); } return primitive ? 1 : 0; }
/** * The min occurs of this element. * * @return The min occurs of this element. */ public int getMinOccurs() { if (isRequired()) { return 1; } TypeMirror accessorType = getAccessorType(); boolean primitive = (accessorType instanceof PrimitiveType); if ((!primitive) && (accessorType instanceof ArrayType)) { //we have to check if the component type if its an array type, too. TypeMirror componentType = ((ArrayType) accessorType).getComponentType(); primitive = (componentType instanceof PrimitiveType) && (((PrimitiveType)componentType).getKind() != PrimitiveType.Kind.BYTE); } return primitive ? 1 : 0; }
/** * The max occurs of the web result. * * @return The max occurs. */ 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; } } return unbounded ? "unbounded" : "1"; }
/** * The max occurs of this parameter as a child element. * * @return The max occurs of this parameter as a child element. */ public String getMaxOccurs() { DecoratedTypeMirror paramType = (DecoratedTypeMirror) getType(); boolean unbounded = paramType.isCollection() || paramType.isArray(); if (paramType.isArray()) { TypeMirror componentType = ((ArrayType) paramType).getComponentType(); //special case for byte[] if ((componentType instanceof PrimitiveType) && (((PrimitiveType) componentType).getKind() == PrimitiveType.Kind.BYTE)) { unbounded = false; } } return unbounded ? "unbounded" : "1"; }
private JsonPropertyDeclaration(final PropertyDeclaration propertyDeclaration) { super(propertyDeclaration.getGetter(), propertyDeclaration.getSetter()); DecoratedTypeMirror decoratedPropertyType = (DecoratedTypeMirror) TypeMirrorDecorator.decorate(getPropertyType()); isList = decoratedPropertyType.isCollection() || decoratedPropertyType.isArray(); if (decoratedPropertyType.isCollection() && getPropertyType() instanceof DeclaredType) { final DeclaredType declaredType = (DeclaredType) getPropertyType(); final Collection<TypeMirror> actualTypeArguments = declaredType.getActualTypeArguments(); if(actualTypeArguments != null && actualTypeArguments.size() == 1) { targetType = TypeMirrorDecorator.decorate(actualTypeArguments.iterator().next()); } else { targetType = getPropertyType(); } } else if (decoratedPropertyType.isArray() && getPropertyType() instanceof ArrayType) { final ArrayType arrayType = (ArrayType) getPropertyType(); targetType = TypeMirrorDecorator.decorate(arrayType.getComponentType()); } else { targetType = getPropertyType(); } }
private FaultBeanChildElement(PropertyDeclaration property, WebFault webFault) { DecoratedTypeMirror propertyType = (DecoratedTypeMirror) property.getPropertyType(); this.adaperType = AdapterUtil.findAdapterType(property.getGetter()); int minOccurs = propertyType.isPrimitive() ? 1 : 0; boolean unbounded = propertyType.isCollection() || propertyType.isArray(); if (propertyType.isArray()) { TypeMirror componentType = ((ArrayType) propertyType).getComponentType(); //special case for byte[] if ((componentType instanceof PrimitiveType) && (((PrimitiveType) componentType).getKind() == PrimitiveType.Kind.BYTE)) { unbounded = false; } } String maxOccurs = unbounded ? "unbounded" : "1"; this.property = property; this.minOccurs = minOccurs; this.maxOccurs = maxOccurs; this.webFault = webFault; }