public AdapterType getAdapterType() { return (this.rpcPart instanceof Adaptable) ? ((Adaptable) this.rpcPart).getAdapterType(): null; } }
public boolean isAdapted() { return this.rpcPart instanceof Adaptable && ((Adaptable) this.rpcPart).isAdapted(); }
/** * Find the specified type of the given adaptable element, if it exists. * * @param adaptable The adaptable element for which to find the specified type. * @return The specified XML type, or null if it doesn't exist. */ public static XmlType findSpecifiedType(Adaptable adaptable) throws XmlTypeException { XmlType xmlType = null; if (adaptable.isAdapted()) { xmlType = getXmlType(adaptable.getAdapterType().getAdaptingType()); } else if (adaptable instanceof Accessor) { //The XML type of accessors can be explicitly defined... xmlType = findExplicitSchemaType((Accessor) adaptable); } return xmlType; }
@Override public String convert(ImplicitChildElement childElement) throws TemplateModelException { if ((childElement instanceof Adaptable) && (((Adaptable) childElement).isAdapted())) { //the adapting type is already unwrapped... return convert(((Adaptable) childElement).getAdapterType().getAdaptingType()); } else { return convert(childElement.getType()); } }
@Override public String convert(ImplicitChildElement childElement) throws TemplateModelException { TypeMirror elementType = childElement.getType(); if ((childElement instanceof Adaptable) && (((Adaptable) childElement).isAdapted())) { elementType = (((Adaptable) childElement).getAdapterType().getAdaptingType(childElement.getType())); } return convert(elementType); }
public AdapterType getAdapterType() { return (this.rpcPart instanceof Adaptable) ? ((Adaptable) this.rpcPart).getAdapterType(): null; } }
public boolean isAdapted() { return this.rpcPart instanceof Adaptable && ((Adaptable) this.rpcPart).isAdapted(); }
@Override public String convert(ImplicitChildElement childElement) throws TemplateModelException { if ((childElement instanceof Adaptable) && (((Adaptable) childElement).isAdapted())) { //the adapting type might be already unwrapped... return convert(((Adaptable) childElement).getAdapterType().getAdaptingType(childElement.getType())); } else { return convert(childElement.getType()); } }
/** * Find the specified type of the given adaptable element, if it exists. * * @param adaptable The adaptable element for which to find the specified type. * @return The specified XML type, or null if it doesn't exist. */ public static XmlType findSpecifiedType(Adaptable adaptable) throws XmlTypeException { XmlType xmlType = null; if (adaptable instanceof Accessor) { XmlSchemaType specified = ((Accessor) adaptable).getAnnotation(XmlSchemaType.class); if (specified != null) { return new SpecifiedXmlType(specified); } } if (adaptable.isAdapted()) { xmlType = getXmlType(adaptable.getAdapterType().getAdaptingType()); } else if (adaptable instanceof Accessor) { //The XML type of accessors can be explicitly defined... xmlType = findExplicitSchemaType((Accessor) adaptable); } return xmlType; }
/** * Converts the specified implicit child element. * * @param childElement The implicit child element. * @return The conversion. */ public String convert(ImplicitChildElement childElement) throws TemplateModelException { TypeMirror elementType = childElement.getType(); if ((childElement instanceof Adaptable) && (((Adaptable) childElement).isAdapted())) { boolean isArray = elementType instanceof ArrayType; elementType = (((Adaptable) childElement).getAdapterType().getAdaptingType()); if (isArray) { //the adapting type adapts the component, so we need to convert it back to an array type. AnnotationProcessorEnvironment ape = Context.getCurrentEnvironment(); elementType = ape.getTypeUtils().getArrayType(elementType); } } return convert(elementType); }
/** * Whether the given type is supported. * * @param type The type to test for supportability. * @return Whether the given type is supported. */ protected boolean isSupported(TypeMirror type) { if ((type instanceof Adaptable) && ((Adaptable) type).isAdapted()) { return isSupported(((Adaptable) type).getAdapterType().getAdaptingType()); } else if (type instanceof DeclaredType) { DecoratedDeclaredType declaredType = (DecoratedDeclaredType) TypeMirrorDecorator.decorate(type); if ((declaredType.getDeclaration() != null) && (isGWTTransient(declaredType.getDeclaration()))) { return false; } else if ((declaredType.isInstanceOf(Collection.class.getName())) || (declaredType.isInstanceOf(java.util.Map.class.getName()))) { boolean supported = true; for (TypeMirror typeArgument : declaredType.getActualTypeArguments()) { supported &= isSupported(typeArgument); } return supported; } else { return !unsupportedTypes.contains(declaredType.getDeclaration().getQualifiedName()); } } //by default, we're going to assume that the type is complex and is supported. return true; }
/** * Whether the given type is supported. * * @param type The type to test for supportability. * @return Whether the given type is supported. */ protected boolean isSupported(TypeMirror type) { if ((type instanceof Adaptable) && ((Adaptable) type).isAdapted()) { return isSupported(((Adaptable) type).getAdapterType().getAdaptingType()); } else if (type instanceof DeclaredType) { DecoratedDeclaredType declaredType = (DecoratedDeclaredType) TypeMirrorDecorator.decorate(type); if ((declaredType.getDeclaration() != null) && (isGWTTransient(declaredType.getDeclaration()))) { return false; } else if ((declaredType.isInstanceOf(Collection.class.getName())) || (declaredType.isInstanceOf(java.util.Map.class.getName()))) { boolean supported = true; for (TypeMirror typeArgument : declaredType.getActualTypeArguments()) { supported &= isSupported(typeArgument); } return supported; } else { return !unsupportedTypes.contains(declaredType.getDeclaration().getQualifiedName()); } } //by default, we're going to assume that the type is complex and is supported. return true; }
/** * Whether the given type is supported. * * @param type The type to test for supportability. * @return Whether the given type is supported. */ protected boolean isSupported(TypeMirror type) { if ((type instanceof Adaptable) && ((Adaptable) type).isAdapted()) { return isSupported(((Adaptable) type).getAdapterType().getAdaptingType()); } else if (type instanceof DeclaredType) { DecoratedDeclaredType declaredType = (DecoratedDeclaredType) TypeMirrorDecorator.decorate(type); if ((declaredType.getDeclaration() != null) && (isAMFTransient(declaredType.getDeclaration()))) { return false; } else if ((declaredType.isInstanceOf(Collection.class.getName())) || (declaredType.isInstanceOf(java.util.Map.class.getName()))) { boolean supported = true; for (TypeMirror typeArgument : declaredType.getActualTypeArguments()) { supported &= isSupported(typeArgument); } return supported; } else { return declaredType.getDeclaration() != null && !unsupportedTypes.contains(declaredType.getDeclaration().getQualifiedName()); } } //by default, we're going to assume that the type is complex and is supported. return true; }
/** * Whether the given type is supported. * * @param type The type to test for supportability. * @return Whether the given type is supported. */ protected boolean isSupported(TypeMirror type) { if ((type instanceof Adaptable) && ((Adaptable) type).isAdapted()) { return isSupported(((Adaptable) type).getAdapterType().getAdaptingType()); } else if (type instanceof DeclaredType) { DecoratedDeclaredType declaredType = (DecoratedDeclaredType) TypeMirrorDecorator.decorate(type); if ((declaredType.getDeclaration() != null) && (isAMFTransient(declaredType.getDeclaration()))) { return false; } else if ((declaredType.isInstanceOf(Collection.class.getName())) || (declaredType.isInstanceOf(java.util.Map.class.getName()))) { boolean supported = true; for (TypeMirror typeArgument : declaredType.getActualTypeArguments()) { supported &= isSupported(typeArgument); } return supported; } else { return !unsupportedTypes.contains(declaredType.getDeclaration().getQualifiedName()); } } //by default, we're going to assume that the type is complex and is supported. return true; }