public static Annotation[] createArray(final String elementName, final String namespace, final String prefix) { Annotation[] ann = {create(elementName, namespace, prefix)}; return ann; }
public JAXBContextWrapper(final JAXBContext wrappedContext, final JAXBConfig config) throws JAXBException { processConfig(config); this.wrappedContext = wrappedContext; }
/** * */ public boolean isWriteable(Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType) { return isReadWritable(type, genericType, annotations, mediaType); }
public JAXBContext findJAXBContext(Class<?> type, Annotation[] annotations, MediaType mediaType, boolean reader) throws JAXBException { ContextResolver<JAXBContextFinder> resolver = providers.getContextResolver(JAXBContextFinder.class, mediaType); JAXBContextFinder finder = resolver.getContext(type); if (finder == null) { if (reader) throw new JAXBUnmarshalException(Messages.MESSAGES.couldNotFindJAXBContextFinder(mediaType)); else throw new JAXBMarshalException(Messages.MESSAGES.couldNotFindJAXBContextFinder(mediaType)); } return finder.findCachedContext(type, mediaType, annotations); }
@Override public JAXBContext findJAXBContext(Class<?> type, Annotation[] annotations, MediaType mediaType, boolean reader) throws JAXBException { ContextResolver<JAXBContextFinder> resolver = providers.getContextResolver(JAXBContextFinder.class, mediaType); JAXBContextFinder finder = resolver.getContext(type); if (finder == null) { if (reader) throw new JAXBUnmarshalException(Messages.MESSAGES.couldNotFindJAXBContextFinder(mediaType)); else throw new JAXBMarshalException(Messages.MESSAGES.couldNotFindJAXBContextFinder(mediaType)); } XmlSeeAlso seeAlso = type.getAnnotation(XmlSeeAlso.class); return finder.findCacheContext(mediaType, annotations, seeAlso.value()); }
@Override public JAXBContext findCacheXmlTypeContext(MediaType mediaType, Annotation[] paraAnnotations, Class... classes) throws JAXBException { CacheKey key = new CacheKey(classes); JAXBContext ctx = xmlTypeCollectionCache.get(key); if (ctx != null) return ctx; ctx = createXmlTypeContext(paraAnnotations, classes); xmlTypeCollectionCache.put(key, ctx); return ctx; } }
public JAXBContext findCacheContext(MediaType mediaType, Annotation[] paraAnnotations, Class... classes) throws JAXBException { CacheKey key = new CacheKey(classes); JAXBContext ctx = collectionCache.get(key); if (ctx != null) return ctx; ctx = createContext(paraAnnotations, classes); collectionCache.put(key, ctx); return ctx; }
protected JAXBContext createContextObject(Annotation[] parameterAnnotations, Class... classes) throws JAXBException { JAXBConfig config = FindAnnotation.findAnnotation(parameterAnnotations, JAXBConfig.class); return new JAXBContextWrapper(config, classes); }
public static void main(String[] args) { Logger LOG = Logger.getLogger(IgnoredMediaTypes.class); LOG.info(getVendorString("foo+json")); LOG.info(getSubtype("foo+json")); }
protected boolean isWrapped(Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType) { if ((Collection.class.isAssignableFrom(type) || type.isArray()) && genericType != null) { Class<?> baseType = Types.getCollectionBaseType(type, genericType); if (baseType == null) return false; baseType = XmlAdapterWrapper.xmlAdapterValueType(baseType, annotations); return (baseType.isAnnotationPresent(XmlRootElement.class) || baseType.isAnnotationPresent(XmlType.class) || baseType.isAnnotationPresent(XmlSeeAlso.class) || JAXBElement.class.equals(baseType)) && (FindAnnotation.findAnnotation(baseType, annotations, DoNotUseJAXBProvider.class) == null) && !IgnoredMediaTypes.ignored(baseType, annotations, mediaType); } return false; }
public boolean isWriteable(Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType) { return isWrapped(type, genericType, annotations, mediaType); }
public boolean isWriteable(Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType) { return isWrapped(type, genericType, annotations, mediaType); }
public Entry(final String keyAttributeName, final String key, final Object value) { this.value = value; this.keyAttributeName = keyAttributeName; setKey(key); }
/** * Turns off expansion of external entities. */ public Object unmarshal(InputStream is) throws JAXBException { return unmarshal(new InputSource(is)); }
public SAXParser getParser(boolean disableExternalEntities, boolean enableSecureProcessingFeature, boolean disableDTDs) throws ParserConfigurationException, SAXException { int index = (disableExternalEntities ? 1 : 0) | (enableSecureProcessingFeature ? 1 << 1 : 0) | (disableDTDs ? 1 << 2 : 0); SAXParserFactory f = factories[index]; if (f == null) { f = SAXParserFactory.newInstance(); configureParserFactory(f, disableExternalEntities, enableSecureProcessingFeature, disableDTDs); factories[index] = f; } SAXParser sp = f.newSAXParser(); configParser(sp, disableExternalEntities); return sp; } }
@Override protected JAXBContext createContextObject(Annotation[] parameterAnnotations, String contextPath) throws JAXBException { JAXBConfig config = FindAnnotation.findAnnotation(parameterAnnotations, JAXBConfig.class); return new JAXBContextWrapper(contextPath, config); }
public static Annotation[] createArray(final String map, final String entry, final String key, final String namespace, final String prefix) { Annotation[] ann = {create(map, entry, key, namespace, prefix)}; return ann; }
public boolean isReadable(Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType) { return isReadWritable(type, genericType, annotations, mediaType); }
public boolean isReadable(Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType) { return isWrapped(type, genericType, annotations, mediaType); }
public boolean isReadable(Class<?> type, Type genericType, Annotation[] annotations, MediaType mediaType) { return isWrapped(type, genericType, annotations, mediaType); }