public static Object convertWithAdapter(Object obj, Class<?> adapterClass, Annotation[] anns) { return useAdapter(obj, getAdapter(adapterClass, anns), false, obj); }
public static Class<?> getValueTypeFromAdapter(Class<?> expectedBoundType, Class<?> defaultClass, Annotation[] anns) { try { XmlJavaTypeAdapter adapter = getAdapter(expectedBoundType, anns); if (adapter != null) { Class<?> boundType = JAXBUtils.getTypeFromAdapter(adapter, null, true); if (boundType != null && boundType.isAssignableFrom(expectedBoundType)) { return JAXBUtils.getTypeFromAdapter(adapter, null, false); } } } catch (Throwable ex) { // ignore } return defaultClass; }
response = ((CollectionWrapper)response).getCollectionOrArray( unmarshaller, theType, type, genericType, org.apache.cxf.jaxrs.utils.JAXBUtils.getAdapter(theGenericType, anns)); } else { response = checkAdapter(response, type, anns, false); JAXBUtils.closeUnmarshaller(unmarshaller);
public static Object useAdapter(Object obj, XmlJavaTypeAdapter typeAdapter, boolean marshal) { return useAdapter(obj, typeAdapter, marshal, obj); }
protected boolean isSupported(Class<?> type, Type genericType, Annotation[] anns) { if (jaxbElementClassMap != null && jaxbElementClassMap.containsKey(type.getName()) || isSkipJaxbChecks()) { return true; } if (UNSUPPORTED_CLASSES.contains(type)) { return false; } return isXmlRoot(type) || JAXBElement.class.isAssignableFrom(type) || objectFactoryOrIndexAvailable(type) || (type != genericType && objectFactoryForType(genericType)) || org.apache.cxf.jaxrs.utils.JAXBUtils.getAdapter(type, anns) != null; }
Class<?> valueType = JAXBUtils.getValueTypeFromAdapter(pClass, pClass, paramAnns); if (valueType != cls) { cls = valueType; result = JAXBUtils.convertWithAdapter(valueToReplace, pClass, paramAnns); } catch (Throwable ex) { result = null;
allTypes = new HashSet<>(ResourceUtils.getAllRequestResponseTypes(cris, true) .getAllTypes().keySet()); context = org.apache.cxf.jaxrs.utils.JAXBUtils.createJaxbContext(allTypes, extraClass, cProperties); } else if (extraClass != null) { allTypes = new HashSet<>(Arrays.asList(extraClass)); context = org.apache.cxf.jaxrs.utils.JAXBUtils.createJaxbContext(allTypes, null, cProperties);
try { if (paramType.isInterface()) { paramType = org.apache.cxf.jaxrs.utils.JAXBUtils.getValueTypeFromAdapter(paramType, paramType, paramAnns);
response = ((CollectionWrapper)response).getCollectionOrArray( unmarshaller, theType, type, genericType, org.apache.cxf.jaxrs.utils.JAXBUtils.getAdapter(theGenericType, anns)); } else { response = checkAdapter(response, type, anns, false); throw ExceptionUtils.toBadRequestException(e, null); JAXBUtils.closeUnmarshaller(unmarshaller);
public static Object useAdapter(Object obj, XmlJavaTypeAdapter typeAdapter, boolean marshal) { return useAdapter(obj, typeAdapter, marshal, obj); }
protected boolean isSupported(Class<?> type, Type genericType, Annotation[] anns) { if (jaxbElementClassMap != null && jaxbElementClassMap.containsKey(type.getName()) || isSkipJaxbChecks()) { return true; } return isXmlRoot(type) || JAXBElement.class.isAssignableFrom(type) || objectFactoryOrIndexAvailable(type) || (type != genericType && objectFactoryForType(genericType)) || org.apache.cxf.jaxrs.utils.JAXBUtils.getAdapter(type, anns) != null; }
Class<?> valueType = JAXBUtils.getValueTypeFromAdapter(pClass, pClass, paramAnns); if (valueType != cls) { cls = valueType; result = JAXBUtils.convertWithAdapter(valueToReplace, pClass, paramAnns); } catch (Throwable ex) { result = null;
if (useJaxbContextForQnames && !allTypes.isEmpty()) { jaxbContext = org.apache.cxf.jaxrs.utils.JAXBUtils .createJaxbContext(new HashSet<>(allTypes), null, jaxbContextProperties); if (jaxbContext == null) { LOG.warning("JAXB Context is null: possibly due to one of input classes being not accepted");
try { if (paramType.isInterface()) { paramType = org.apache.cxf.jaxrs.utils.JAXBUtils.getValueTypeFromAdapter(paramType, paramType, paramAnns);
protected static Object checkAdapter(Object obj, Class<?> cls, Annotation[] anns, boolean marshal) { XmlJavaTypeAdapter adapter = org.apache.cxf.jaxrs.utils.JAXBUtils.getAdapter(cls, anns); return org.apache.cxf.jaxrs.utils.JAXBUtils.useAdapter(obj, adapter, marshal); }
public static Class<?> getValueTypeFromAdapter(Class<?> expectedBoundType, Class<?> defaultClass, Annotation[] anns) { try { XmlJavaTypeAdapter adapter = getAdapter(expectedBoundType, anns); if (adapter != null) { Class<?> boundType = JAXBUtils.getTypeFromAdapter(adapter, null, true); if (boundType != null && boundType.isAssignableFrom(expectedBoundType)) { return JAXBUtils.getTypeFromAdapter(adapter, null, false); } } } catch (Throwable ex) { // ignore } return defaultClass; }
response = ((CollectionWrapper)response).getCollectionOrArray( unmarshaller, theType, type, genericType, org.apache.cxf.jaxrs.utils.JAXBUtils.getAdapter(theGenericType, anns)); } else { response = checkAdapter(response, type, anns, false); throw ExceptionUtils.toBadRequestException(e, null); JAXBUtils.closeUnmarshaller(unmarshaller);
List<Object> newList = new ArrayList<Object>(theList.size()); for (Object o : theList) { newList.add(org.apache.cxf.jaxrs.utils.JAXBUtils.useAdapter( ((JAXBElement<?>)o).getValue(), adapter, false)); T[] values = (T[])Array.newInstance(type, theList.size()); for (int i = 0; i < theList.size(); i++) { values[i] = (T)org.apache.cxf.jaxrs.utils.JAXBUtils.useAdapter( theList.get(i), adapter, false); List<Object> newList = new ArrayList<Object>(theList.size()); for (Object o : theList) { newList.add(org.apache.cxf.jaxrs.utils.JAXBUtils.useAdapter(o, adapter, false));
org.apache.cxf.jaxrs.utils.JAXBUtils.getAdapter(theGenericType, anns)); } else { response = checkAdapter(response, type, anns, false);
if (useJaxbContextForQnames && !allTypes.isEmpty()) { jaxbContext = org.apache.cxf.jaxrs.utils.JAXBUtils .createJaxbContext(new HashSet<>(allTypes), null, jaxbContextProperties); if (jaxbContext == null) { LOG.warning("JAXB Context is null: possibly due to one of input classes being not accepted");