Refine search
/** * Prints the responsible field of the given bean to the writer. * * <p> * Use {@link XMLSerializer#getInstance()} to access to the namespace bindings * * @return * if the accessor didn't yield a value, return null. */ public abstract @Nullable CharSequence print(@NotNull BeanT o) throws AccessorException, SAXException;
/** * Creates a new {@link BridgeContext} instance. * * @return * always a valid non-null instance. * * @since 2.0 EA1 */ public abstract @NotNull BridgeContext createBridgeContext();
/** * Gets the build information of the JAXB runtime. * * @return * may be null, if the runtime is loaded by a class loader that doesn't support * the access to the manifest informatino. */ public abstract @NotNull String getBuildId();
/** * If the given object is bound to an element in XML by JAXB, * returns the element name. * * @return null * if the object is not bound to an element. * @throws JAXBException * if the object is not known to this context. * * @since 2.0 EA1 */ public abstract @Nullable QName getElementName(@NotNull Object o) throws JAXBException;
/** * Sends the result of the {@link #print(Object)} operation * to one of the {@link XMLSerializer#leafElement(Name, String, String)} method. * but with the best representation of the value, not necessarily String. */ void writeLeafElement(XMLSerializer w, Name tagName, @NotNull ValueT o, String fieldName) throws IOException, SAXException, XMLStreamException, AccessorException;
/** * Gets the {@link JAXBRIContext} to which this object belongs. * * @since 2.1 */ public @NotNull JAXBRIContext getContext() { return context; }
/** * JAXB calls this method when it sees an unknown element. * * <p> * See the class javadoc for details. * * @param nsUri * Namespace URI of the unknown element. Can be empty but never null. * @param localName * Local name of the unknown element. Never be empty nor null. * * @return * If a non-null class is returned, it will be used to unmarshal this element. * If null is returned, the resolution is assumed to be failed, and * the unmarshaller will behave as if there was no {@link ClassResolver} * to begin with (that is, to report it to {@link ValidationEventHandler}, * then move on.) * * @throws Exception * Throwing any {@link RuntimeException} causes the unmarshaller to stop * immediately. The exception will be propagated up the call stack. * Throwing any other checked {@link Exception} results in the error * reproted to {@link ValidationEventHandler} (just like any other error * during the unmarshalling.) */ public abstract @Nullable Class<?> resolveElementName(@NotNull String nsUri, @NotNull String localName) throws Exception; }
/** * Creates a mini-marshaller/unmarshaller that can process a {@link TypeReference}. * * @return * null if the specified reference is not given to {@link JAXBRIContext#newInstance}. * * @since 2.0 EA1 */ public abstract Bridge createBridge(@NotNull TypeReference ref);
/** * @deprecated * Compatibility with older versions. */ public static JAXBRIContext newInstance(@NotNull Class[] classes, @Nullable Collection<TypeReference> typeRefs, @Nullable String defaultNamespaceRemap, boolean c14nSupport ) throws JAXBException { return newInstance(classes,typeRefs, Collections.<Class,Class>emptyMap(), defaultNamespaceRemap,c14nSupport,null); }
/** * Gets the parameterization of the given base type. * * <p> * For example, given the following * <pre>{@code * interface Foo<T> extends List<List<T>> {} * interface Bar extends Foo<String> {} * }</pre> * This method works like this: * <pre>{@code * getBaseClass( Bar, List ) = List<List<String> * getBaseClass( Bar, Foo ) = Foo<String> * getBaseClass( Foo<? extends Number>, Collection ) = Collection<List<? extends Number>> * getBaseClass( ArrayList<? extends BigInteger>, List ) = List<? extends BigInteger> * }</pre> * * @param type * The type that derives from {@code baseType} * @param baseType * The class whose parameterization we are interested in. * @return * The use of {@code baseType} in {@code type}. * or null if the type is not assignable to the base type. * @since 2.0 FCS */ public static @Nullable Type getBaseType(@NotNull Type type, @NotNull Class baseType) { return Utils.REFLECTION_NAVIGATOR.getBaseClass(type, baseType); }
/** * @since 2.0.3 */ public final @NotNull T unmarshal(@NotNull XMLStreamReader in, @Nullable AttachmentUnmarshaller au) throws JAXBException { Unmarshaller u = context.unmarshallerPool.take(); u.setAttachmentUnmarshaller(au); return exit(unmarshal(u,in),u); } public final @NotNull T unmarshal(@NotNull BridgeContext context, @NotNull XMLStreamReader in) throws JAXBException {
/** * Transducers implicitly work against a single XML type, * but sometimes (most notably {@link XMLGregorianCalendar}, * an instance may choose different XML types. * * @return * return non-null from this method allows transducers * to specify the type it wants to marshal to. * Most of the time this method returns null, in which case * the implicitly associated type will be used. */ QName getTypeName(@NotNull ValueT instance); }
/** * @since 2.0.3 */ public final @NotNull T unmarshal(@NotNull Source in, @Nullable AttachmentUnmarshaller au) throws JAXBException { Unmarshaller u = context.unmarshallerPool.take(); u.setAttachmentUnmarshaller(au); return exit(unmarshal(u,in),u); } public final @NotNull T unmarshal(@NotNull BridgeContext context, @NotNull Source in) throws JAXBException {
/** * Returns the XML type name to be used to marshal the specified instance. * * <P> * Most of the times the type can be determined regardless of the actual * instance, but there's a few exceptions (most notably {@link XMLGregorianCalendar}), * so as a general rule we need an instance to determine it. */ public QName getTypeName(@NotNull BeanT instance) { if(typeName==null) return null; if(typeName instanceof QName) return (QName)typeName; return ((QName[])typeName)[0]; }
/** * @since 2.0.3 */ public final @NotNull T unmarshal(@NotNull Node n, @Nullable AttachmentUnmarshaller au) throws JAXBException { Unmarshaller u = context.unmarshallerPool.take(); u.setAttachmentUnmarshaller(au); return exit(unmarshal(u,n),u); } public final @NotNull T unmarshal(@NotNull BridgeContext context, @NotNull Node n) throws JAXBException {
/** * Returns the name of the XML Type bound to the * specified Java type. * * @param tr * must not be null. This must be one of the {@link TypeReference}s specified * in the {@link JAXBRIContext#newInstance} method. * * @throws IllegalArgumentException * if the parameter is null or not a part of the {@link TypeReference}s specified * in the {@link JAXBRIContext#newInstance} method. * * @return null * if the referenced type is an anonymous and therefore doesn't have a name. */ public abstract QName getTypeName(@NotNull TypeReference tr);
public static JAXBRIContext newInstance(@NotNull Class[] classes, @Nullable Collection<TypeReference> typeRefs, @Nullable Map<Class,Class> subclassReplacements, @Nullable String defaultNamespaceRemap, boolean c14nSupport, @Nullable RuntimeAnnotationReader ar) throws JAXBException { return newInstance(classes, typeRefs, subclassReplacements,