use of jakarta.xml.bind.annotation.XmlAccessorType in project eclipselink by eclipse-ee4j.
the class AnnotationsProcessor method preProcessXmlAccessorType.
/**
* Process @XmlAccessorType annotation on a given JavaClass and update the
* TypeInfo for pre-processing.
*/
private void preProcessXmlAccessorType(JavaClass javaClass, TypeInfo info, NamespaceInfo packageNamespace) {
org.eclipse.persistence.jaxb.xmlmodel.XmlAccessType xmlAccessType;
if (javaClass.getDeclaredAnnotation(helper.getJavaClass(XmlAccessorType.class)) != null) {
XmlAccessorType accessorType = (XmlAccessorType) helper.getAnnotation(javaClass, XmlAccessorType.class);
xmlAccessType = org.eclipse.persistence.jaxb.xmlmodel.XmlAccessType.fromValue(accessorType.value().name());
info.setXmlAccessType(xmlAccessType);
}
}
use of jakarta.xml.bind.annotation.XmlAccessorType in project eclipselink by eclipse-ee4j.
the class AnnotationsProcessor method getPackageInfoForPackage.
public PackageInfo getPackageInfoForPackage(JavaPackage pack, String packageName) {
PackageInfo packageInfo = packageToPackageInfoMappings.get(packageName);
if (packageInfo == null) {
XmlSchema xmlSchema = (XmlSchema) helper.getAnnotation(pack, XmlSchema.class);
packageInfo = new PackageInfo();
NamespaceInfo namespaceInfo = processNamespaceInformation(xmlSchema);
packageInfo.setNamespaceInfo(namespaceInfo);
// if it's still null, generate based on package name
if (namespaceInfo.getNamespace() == null) {
namespaceInfo.setNamespace(EMPTY_STRING);
}
if (helper.isAnnotationPresent(pack, XmlAccessorType.class)) {
XmlAccessorType xmlAccessorType = (XmlAccessorType) helper.getAnnotation(pack, XmlAccessorType.class);
packageInfo.setAccessType(XmlAccessType.fromValue(xmlAccessorType.value().name()));
}
if (helper.isAnnotationPresent(pack, XmlAccessorOrder.class)) {
XmlAccessorOrder xmlAccessorOrder = (XmlAccessorOrder) helper.getAnnotation(pack, XmlAccessorOrder.class);
packageInfo.setAccessOrder(XmlAccessOrder.fromValue(xmlAccessorOrder.value().name()));
}
if (CompilerHelper.ACCESSOR_FACTORY_ANNOTATION_CLASS != null && helper.isAnnotationPresent(pack, CompilerHelper.ACCESSOR_FACTORY_ANNOTATION_CLASS)) {
Annotation xmlAccessorFactory = helper.getAnnotation(pack, CompilerHelper.ACCESSOR_FACTORY_ANNOTATION_CLASS);
Class<?> xmlAccessorFactoryClass = null;
try {
xmlAccessorFactoryClass = PrivilegedAccessHelper.invokeMethod(CompilerHelper.ACCESSOR_FACTORY_VALUE_METHOD, xmlAccessorFactory, new Object[] {});
packageInfo.setAccessorFactory(new AccessorFactoryWrapper(PrivilegedAccessHelper.newInstanceFromClass(xmlAccessorFactoryClass)));
} catch (Exception ex) {
throw JAXBException.errorInstantiatingAccessorFactory(xmlAccessorFactoryClass, ex);
}
} else if (CompilerHelper.OLD_ACCESSOR_FACTORY_ANNOTATION_CLASS != null && helper.isAnnotationPresent(pack, CompilerHelper.OLD_ACCESSOR_FACTORY_ANNOTATION_CLASS)) {
Annotation xmlAccessorFactory = helper.getAnnotation(pack, CompilerHelper.OLD_ACCESSOR_FACTORY_ANNOTATION_CLASS);
Class<?> xmlAccessorFactoryClass = null;
try {
xmlAccessorFactoryClass = PrivilegedAccessHelper.invokeMethod(CompilerHelper.OLD_ACCESSOR_FACTORY_VALUE_METHOD, xmlAccessorFactory, new Object[] {});
packageInfo.setAccessorFactory(new AccessorFactoryWrapper(PrivilegedAccessHelper.newInstanceFromClass(xmlAccessorFactoryClass)));
} catch (Exception ex) {
throw JAXBException.errorInstantiatingAccessorFactory(xmlAccessorFactoryClass, ex);
}
} else if (CompilerHelper.INTERNAL_ACCESSOR_FACTORY_ANNOTATION_CLASS != null && helper.isAnnotationPresent(pack, CompilerHelper.INTERNAL_ACCESSOR_FACTORY_ANNOTATION_CLASS)) {
Annotation xmlAccessorFactory = helper.getAnnotation(pack, CompilerHelper.INTERNAL_ACCESSOR_FACTORY_ANNOTATION_CLASS);
Class<?> xmlAccessorFactoryClass = null;
try {
xmlAccessorFactoryClass = PrivilegedAccessHelper.invokeMethod(CompilerHelper.INTERNAL_ACCESSOR_FACTORY_VALUE_METHOD, xmlAccessorFactory, new Object[] {});
packageInfo.setAccessorFactory(new AccessorFactoryWrapper(PrivilegedAccessHelper.newInstanceFromClass(xmlAccessorFactoryClass)));
} catch (Exception ex) {
throw JAXBException.errorInstantiatingAccessorFactory(xmlAccessorFactoryClass, ex);
}
}
packageToPackageInfoMappings.put(packageName, packageInfo);
}
return packageInfo;
}
Aggregations