public static DecoratedTypeMirror mirrorOf(Callable<Class<?>> annotationValueFunction, DecoratedProcessingEnvironment env) { return mirrorOf(annotationValueFunction, env, null); }
public static DecoratedTypeMirror mirrorOf(Callable<Class<?>> annotationValueFunction, DecoratedProcessingEnvironment env, Class<?> emptyClass) { try { Class<?> clazz = annotationValueFunction.call(); if (emptyClass != null && emptyClass.equals(clazz)) { return null; } return TypeMirrorUtils.mirrorOf(clazz, env); } catch (MirroredTypeException e) { DecoratedTypeMirror typeMirror = (DecoratedTypeMirror) TypeMirrorDecorator.decorate(e.getTypeMirror(), env); if (emptyClass != null && same(typeMirror, emptyClass)) { return null; } return typeMirror; } catch (RuntimeException e) { throw e; } catch (Exception e) { throw new RuntimeException(e); } }
public static DecoratedTypeMirror mirrorOf(Callable<Class<?>> annotationValueFunction, DecoratedProcessingEnvironment env) { return mirrorOf(annotationValueFunction, env, null); }
public static DecoratedTypeMirror mirrorOf(Callable<Class<?>> annotationValueFunction, DecoratedProcessingEnvironment env, Class<?> emptyClass) { try { Class<?> clazz = annotationValueFunction.call(); if (emptyClass != null && emptyClass.equals(clazz)) { return null; } return TypeMirrorUtils.mirrorOf(clazz, env); } catch (MirroredTypeException e) { DecoratedTypeMirror typeMirror = (DecoratedTypeMirror) TypeMirrorDecorator.decorate(e.getTypeMirror(), env); if (emptyClass != null && same(typeMirror, emptyClass)) { return null; } return typeMirror; } catch (RuntimeException e) { throw e; } catch (Exception e) { throw new RuntimeException(e); } }
/** * The scope of the local element. * * @return The scope of the local element. */ public DecoratedTypeElement getElementScope() { DecoratedTypeElement declaration = null; DecoratedTypeMirror typeMirror = Annotations.mirrorOf(new Callable<Class<?>>() { @Override public Class<?> call() throws Exception { return elementDecl.scope(); } }, this.env, XmlElementDecl.GLOBAL.class); if (typeMirror != null) { declaration = (DecoratedTypeElement) ((DeclaredType) typeMirror).asElement(); } return declaration; }
/** * The scope of the local element. * * @return The scope of the local element. */ public DecoratedTypeElement getElementScope() { DecoratedTypeElement declaration = null; DecoratedTypeMirror typeMirror = Annotations.mirrorOf(new Callable<Class<?>>() { @Override public Class<?> call() throws Exception { return elementDecl.scope(); } }, this.env, XmlElementDecl.GLOBAL.class); if (typeMirror != null) { declaration = (DecoratedTypeElement) ((DeclaredType) typeMirror).asElement(); } return declaration; }
@Override public XmlType getBaseType() { XmlType xmlType = KnownXmlType.STRING; if (xmlEnum != null) { DecoratedTypeMirror typeMirror = Annotations.mirrorOf(new Callable<Class<?>>() { @Override public Class<?> call() throws Exception { return xmlEnum.value(); } }, this.env); xmlType = XmlTypeFactory.getXmlType(typeMirror, this.context); } return xmlType; }
@Override public XmlType getBaseType() { XmlType xmlType = KnownXmlType.STRING; if (xmlEnum != null) { DecoratedTypeMirror typeMirror = Annotations.mirrorOf(new Callable<Class<?>>() { @Override public Class<?> call() throws Exception { return xmlEnum.value(); } }, this.env); xmlType = XmlTypeFactory.getXmlType(typeMirror, this.context); } return xmlType; }
/** * The enum type containing the known qnames for this qname enum accessor, or null is this accessor doesn't reference a known qname type. * * @return The enum type containing the known qnames for this qname enum accessor. */ public DecoratedTypeMirror getQNameEnumRef() { final XmlQNameEnumRef enumRef = getAnnotation(XmlQNameEnumRef.class); DecoratedTypeMirror qnameEnumType = null; if (enumRef != null) { qnameEnumType = Annotations.mirrorOf(new Callable<Class<?>>() { @Override public Class<?> call() throws Exception { return enumRef.value(); } }, this.env); } return qnameEnumType; }
/** * The enum type containing the known qnames for this qname enum accessor, or null is this accessor doesn't reference a known qname type. * * @return The enum type containing the known qnames for this qname enum accessor. */ public DecoratedTypeMirror getQNameEnumRef() { final XmlQNameEnumRef enumRef = getAnnotation(XmlQNameEnumRef.class); DecoratedTypeMirror qnameEnumType = null; if (enumRef != null) { qnameEnumType = Annotations.mirrorOf(new Callable<Class<?>>() { @Override public Class<?> call() throws Exception { return enumRef.value(); } }, this.env); } return qnameEnumType; }
/** * The base type of an element accessor can be specified by an annotation. * * @return The base type. */ @Override public com.webcohesion.enunciate.modules.jaxb.model.types.XmlType getBaseType() { if (xmlElement != null) { TypeMirror typeMirror = Annotations.mirrorOf(new Callable<Class<?>>() { @Override public Class<?> call() throws Exception { return xmlElement.type(); } }, this.env, XmlElement.DEFAULT.class); if (typeMirror != null) { return XmlTypeFactory.getXmlType(typeMirror, this.context); } } return super.getBaseType(); }
/** * The base type of an element accessor can be specified by an annotation. * * @return The base type. */ @Override public com.webcohesion.enunciate.modules.jaxb.model.types.XmlType getBaseType() { if (xmlElement != null) { TypeMirror typeMirror = Annotations.mirrorOf(new Callable<Class<?>>() { @Override public Class<?> call() throws Exception { return xmlElement.type(); } }, this.env, XmlElement.DEFAULT.class); if (typeMirror != null) { return XmlTypeFactory.getXmlType(typeMirror, this.context); } } return super.getBaseType(); }
protected static AdapterType findAdapterType(DecoratedTypeMirror maybeContainedAdaptedType, Element referer, PackageElement pckg, EnunciateJaxbContext context) { DecoratedProcessingEnvironment env = context.getContext().getProcessingEnvironment(); TypeMirror adaptedType = TypeMirrorUtils.getComponentType(maybeContainedAdaptedType, env); adaptedType = adaptedType == null ? maybeContainedAdaptedType : adaptedType; XmlJavaTypeAdapter typeAdapterInfo = referer != null ? referer.getAnnotation(XmlJavaTypeAdapter.class) : null; if (adaptedType instanceof DeclaredType) { if (typeAdapterInfo == null) { typeAdapterInfo = ((DeclaredType) adaptedType).asElement().getAnnotation(XmlJavaTypeAdapter.class); } if ((typeAdapterInfo == null) && (pckg != null)) { TypeElement typeDeclaration = (TypeElement) ((DeclaredType) adaptedType).asElement(); typeAdapterInfo = getAdaptersOfPackage(pckg, context).get(typeDeclaration.getQualifiedName().toString()); } } if (typeAdapterInfo != null) { final XmlJavaTypeAdapter finalInfo = typeAdapterInfo; DecoratedTypeMirror adapterTypeMirror = Annotations.mirrorOf(new Callable<Class<?>>() { @Override public Class<?> call() throws Exception { return finalInfo.value(); } }, env); if (adapterTypeMirror instanceof DecoratedDeclaredType) { return new AdapterType((DecoratedDeclaredType) adapterTypeMirror, context.getContext()); } } return null; }
DecoratedTypeMirror typeMirror = Annotations.mirrorOf(new Callable<Class<?>>() { @Override public Class<?> call() throws Exception {
DecoratedTypeMirror adapterTypeMirror = Annotations.mirrorOf(new Callable<Class<?>>() { @Override public Class<?> call() throws Exception { return isContained ? finalInfo.contentConverter() : finalInfo.converter(); } DecoratedTypeMirror adapterTypeMirror = Annotations.mirrorOf(new Callable<Class<?>>() { @Override public Class<?> call() throws Exception {
protected static AdapterType findAdapterType(DecoratedTypeMirror maybeContainedAdaptedType, Element referer, PackageElement pckg, EnunciateJaxbContext context) { DecoratedProcessingEnvironment env = context.getContext().getProcessingEnvironment(); TypeMirror adaptedType = TypeMirrorUtils.getComponentType(maybeContainedAdaptedType, env); adaptedType = adaptedType == null ? maybeContainedAdaptedType : adaptedType; XmlJavaTypeAdapter typeAdapterInfo = referer != null ? referer.getAnnotation(XmlJavaTypeAdapter.class) : null; if (adaptedType instanceof DeclaredType) { if (typeAdapterInfo == null) { typeAdapterInfo = ((DeclaredType) adaptedType).asElement().getAnnotation(XmlJavaTypeAdapter.class); } if ((typeAdapterInfo == null) && (pckg != null)) { TypeElement typeDeclaration = (TypeElement) ((DeclaredType) adaptedType).asElement(); typeAdapterInfo = getAdaptersOfPackage(pckg, context).get(typeDeclaration.getQualifiedName().toString()); } } if (typeAdapterInfo != null) { final XmlJavaTypeAdapter finalInfo = typeAdapterInfo; DecoratedTypeMirror adapterTypeMirror = Annotations.mirrorOf(new Callable<Class<?>>() { @Override public Class<?> call() throws Exception { return finalInfo.value(); } }, env); if (adapterTypeMirror instanceof DecoratedDeclaredType) { return new AdapterType((DecoratedDeclaredType) adapterTypeMirror, context.getContext()); } } return null; }
DecoratedTypeMirror typeMirror = Annotations.mirrorOf(new Callable<Class<?>>() { @Override public Class<?> call() throws Exception {
DecoratedTypeMirror adapterTypeMirror = Annotations.mirrorOf(new Callable<Class<?>>() { @Override public Class<?> call() throws Exception { return isContained ? finalInfo.contentConverter() : finalInfo.converter(); } DecoratedTypeMirror adapterTypeMirror = Annotations.mirrorOf(new Callable<Class<?>>() { @Override public Class<?> call() throws Exception {
DecoratedTypeMirror adapterTypeMirror = Annotations.mirrorOf(new Callable<Class<?>>() { @Override public Class<?> call() throws Exception {
DecoratedTypeMirror adapterTypeMirror = Annotations.mirrorOf(new Callable<Class<?>>() { @Override public Class<?> call() throws Exception {