/** * Whether the type is a string. * * @param type The type. * @return Whether the type is a string. */ protected boolean isString(TypeMirror type) { return type != null && type instanceof DeclaredType && ((DeclaredType) type).getDeclaration() != null && String.class.getName().equals(((DeclaredType) type).getDeclaration().getQualifiedName()); }
private boolean isDataHandler(DecoratedTypeMirror type) { return type.isDeclared() && ((DeclaredType) type).getDeclaration() != null && "javax.activation.DataHandler".equals(((DeclaredType) type).getDeclaration().getQualifiedName()); }
private boolean isDataHandler(DecoratedTypeMirror type) { return type.isDeclared() && ((DeclaredType) type).getDeclaration() != null && "javax.activation.DataHandler".equals(((DeclaredType) type).getDeclaration().getQualifiedName()); }
private boolean isDataHandler(DecoratedTypeMirror type) { return type.isDeclared() && ((DeclaredType) type).getDeclaration() != null && "javax.activation.DataHandler".equals(((DeclaredType) type).getDeclaration().getQualifiedName()); }
@Override public void visitDeclaredType(DeclaredType declaredType) { TypeDeclaration declaration = declaredType.getDeclaration(); if (declaration != null) { fqn[0] = getLoadableFQN(declaration); } }
public TypeDeclaration getDeclaration() { return DeclarationDecorator.decorate(((DeclaredType) delegate).getDeclaration()); }
private TypeMirror onDeclaredType(DeclaredType t, TypeDeclaration sup) { // t = sup<...> if(t.getDeclaration().equals(sup)) return t; for(InterfaceType i : t.getSuperinterfaces()) { TypeMirror r = onInterfaceType(i,sup); if(r!=null) return r; } return null; }
private TypeMirror onDeclaredType(DeclaredType t, TypeDeclaration sup) { // t = sup<...> if(t.getDeclaration().equals(sup)) return t; for(InterfaceType i : t.getSuperinterfaces()) { TypeMirror r = onInterfaceType(i,sup); if(r!=null) return r; } return null; }
public TypeDeclaration asDecl(TypeMirror m) { m = env.getTypeUtils().getErasure(m); if (m instanceof DeclaredType) { DeclaredType d = (DeclaredType) m; return d.getDeclaration(); } else return null; }
public TypeDeclaration asDecl(TypeMirror m) { m = env.getTypeUtils().getErasure(m); if (m instanceof DeclaredType) { DeclaredType d = (DeclaredType) m; return d.getDeclaration(); } else return null; }
public void visitDeclaredType(DeclaredType declaredType) { TypeDeclaration declaration = declaredType.getDeclaration(); if (declaration != null) { String qualifiedName = declaration.getQualifiedName(); if (!qualifiedName.startsWith("java.lang")) { importedTypes.put(qualifiedName, declaration); } } for (TypeMirror type : declaredType.getActualTypeArguments()) { type.accept(this); } }
/** * Whether this accessor is a swa ref. * * @return Whether this accessor is a swa ref. */ public boolean isSwaRef() { return (getAnnotation(XmlAttachmentRef.class) != null) && (getAccessorType() instanceof DeclaredType) && (((DeclaredType) getAccessorType()).getDeclaration() != null) && ("javax.activation.DataHandler".equals(((DeclaredType) getAccessorType()).getDeclaration().getQualifiedName())); }
public <T> TypeMirror erasure(TypeMirror t) { Types tu = env.getTypeUtils(); t = tu.getErasure(t); if(t instanceof DeclaredType) { DeclaredType dt = (DeclaredType)t; if(!dt.getActualTypeArguments().isEmpty()) return tu.getDeclaredType(dt.getDeclaration()); } return t; }
public <T> TypeMirror erasure(TypeMirror t) { Types tu = env.getTypeUtils(); t = tu.getErasure(t); if(t instanceof DeclaredType) { DeclaredType dt = (DeclaredType)t; if(!dt.getActualTypeArguments().isEmpty()) return tu.getDeclaredType(dt.getDeclaration()); } return t; }
public ValidationResult validateXmlID(Accessor accessor) { ValidationResult result = new ValidationResult(); TypeMirror accessorType = accessor.getAccessorType(); if (!(accessorType instanceof DeclaredType) || !((DeclaredType) accessorType).getDeclaration().getQualifiedName().startsWith(String.class.getName())) { result.addError(accessor.getPosition(), "An xml id must be a string."); } return result; } }
/** * Whether this accessor is a swa ref. * * @return Whether this accessor is a swa ref. */ public boolean isSwaRef() { return (getAnnotation(XmlAttachmentRef.class) != null) && (getAccessorType() instanceof DeclaredType) && ("javax.activation.DataHandler".equals(((DeclaredType) getAccessorType()).getDeclaration().getQualifiedName())); }
/** * This web result defines an implicit schema element if it is of DOCUMENT binding style and it is * NOT of a class type that is an xml root element. * * @return Whether this web result is an implicit schema element. */ public boolean isImplicitSchemaElement() { if (method.getSoapBindingStyle() != SOAPBinding.Style.RPC) { TypeMirror returnType = getType(); return !((returnType instanceof DeclaredType) && (((DeclaredType) returnType).getDeclaration().getAnnotation(XmlRootElement.class) != null)); } return false; }
/** * This web parameter defines an implicit schema element if it is DOCUMENT binding style and it * is NOT of a class type that is an xml root element. * * @return Whether this web parameter is an implicit schema element. */ public boolean isImplicitSchemaElement() { if (method.getSoapBindingStyle() != SOAPBinding.Style.RPC) { TypeMirror parameterType = getType(); return !((parameterType instanceof DeclaredType) && (((DeclaredType) parameterType).getDeclaration().getAnnotation(XmlRootElement.class) != null)); } return false; }
@Override public String convert(TypeMirror typeMirror) throws TemplateModelException { DecoratedTypeMirror decoratedMirror = (DecoratedTypeMirror) TypeMirrorDecorator.decorate(typeMirror); if (decoratedMirror.isCollection()) { return convert(((DeclaredType) decoratedMirror).getDeclaration().getQualifiedName()); } else { throw new TemplateModelException(typeMirror + " isn't a collection!"); } }
@Override public String convert(TypeMirror typeMirror) throws TemplateModelException { DecoratedTypeMirror decoratedMirror = (DecoratedTypeMirror) TypeMirrorDecorator.decorate(typeMirror); if (decoratedMirror.isCollection()) { return convert(((DeclaredType) decoratedMirror).getDeclaration().getQualifiedName()); } else { throw new TemplateModelException(typeMirror + " isn't a collection!"); } }