use of javax.xml.bind.annotation.XmlElementDecl in project camel by apache.
the class JaxbHelper method getJaxbElementFactoryMethod.
public static <T> Method getJaxbElementFactoryMethod(CamelContext camelContext, Class<T> type) {
if (camelContext == null) {
return null;
}
// find the first method that has @XmlElementDecl with one parameter that matches the type
Class factory = getObjectFactory(camelContext, type);
if (factory != null) {
for (Method m : factory.getMethods()) {
final XmlElementDecl a = m.getAnnotation(XmlElementDecl.class);
if (a == null) {
continue;
}
final Class<?>[] parameters = m.getParameterTypes();
if (parameters.length == 1 && parameters[0].isAssignableFrom(type)) {
return m;
}
}
}
return null;
}
use of javax.xml.bind.annotation.XmlElementDecl in project midpoint by Evolveum.
the class PrismBeanInspector method lookupSubstitutionUncached.
private Field lookupSubstitutionUncached(Class beanClass, Method elementMethodInObjectFactory) {
XmlElementDecl xmlElementDecl = elementMethodInObjectFactory.getAnnotation(XmlElementDecl.class);
if (xmlElementDecl == null) {
return null;
}
final String substitutionHeadName = xmlElementDecl.substitutionHeadName();
return findField(beanClass, field -> {
XmlElementRef xmlElementRef = field.getAnnotation(XmlElementRef.class);
return xmlElementRef != null && xmlElementRef.name().equals(substitutionHeadName);
});
}
Aggregations