43 * <p>
44 * {@link JAXBContext#newInstance(Class...)} requires that application informs JAXB
45 * about all the classes that it may see in the instance document. While this allows
46 * JAXB to take time to optimize the unmarshalling, it is sometimes inconvenient
47 * for applications.
48 *
49 * <p>
50 * This is where {@link ClassResolver} comes to resucue.
51 *
52 * <p>
53 * A {@link ClassResolver} instance can be specified on {@link Unmarshaller} via
54 * {@link Unmarshaller#setProperty(String, Object)} as follows:
55 *
56 * <pre>
57 * unmarshaller.setProperty( ClassResolver.class.getName(), new MyClassResolverImpl() );
58 * </pre>
59 *
60 * <p>
61 * When an {@link Unmarshaller} encounters (i) an unknown root element or (ii) unknown
62 * elements where unmarshaller is trying to unmarshal into {@link XmlAnyElement} with
63 * <tt>lax=true</tt>, unmarshaller calls {@link #resolveElementName(String, String)}
64 * method to see if the application may be able to supply a class that corresponds
65 * to that class.
66 *
67 * <p>
68 * When a {@link Class} is returned, a new {@link JAXBContext} is created with
69 * all the classes known to it so far, plus a new class returned. This operation
70 * may fail (for example because of some conflicting annotations.) This failure
71 * is handled just like {@link Exception}s thrown from
72 * {@link ClassResolver#resolveElementName(String, String)}.
73 *
74 * @author Kohsuke Kawaguchi
75 * @since 2.1
76 */
77 public abstract class ClassResolver {
78 /**
79 * JAXB calls this method when it sees an unknown element.
80 *
81 * <p>
82 * See the class javadoc for details.
83 *
|
43 * <p>
44 * {@link JAXBContext#newInstance(Class...)} requires that application informs JAXB
45 * about all the classes that it may see in the instance document. While this allows
46 * JAXB to take time to optimize the unmarshalling, it is sometimes inconvenient
47 * for applications.
48 *
49 * <p>
50 * This is where {@link ClassResolver} comes to resucue.
51 *
52 * <p>
53 * A {@link ClassResolver} instance can be specified on {@link Unmarshaller} via
54 * {@link Unmarshaller#setProperty(String, Object)} as follows:
55 *
56 * <pre>
57 * unmarshaller.setProperty( ClassResolver.class.getName(), new MyClassResolverImpl() );
58 * </pre>
59 *
60 * <p>
61 * When an {@link Unmarshaller} encounters (i) an unknown root element or (ii) unknown
62 * elements where unmarshaller is trying to unmarshal into {@link XmlAnyElement} with
63 * {@code lax=true}, unmarshaller calls {@link #resolveElementName(String, String)}
64 * method to see if the application may be able to supply a class that corresponds
65 * to that class.
66 *
67 * <p>
68 * When a {@link Class} is returned, a new {@link JAXBContext} is created with
69 * all the classes known to it so far, plus a new class returned. This operation
70 * may fail (for example because of some conflicting annotations.) This failure
71 * is handled just like {@link Exception}s thrown from
72 * {@link ClassResolver#resolveElementName(String, String)}.
73 *
74 * @author Kohsuke Kawaguchi
75 * @since 2.1
76 */
77 public abstract class ClassResolver {
78 /**
79 * JAXB calls this method when it sees an unknown element.
80 *
81 * <p>
82 * See the class javadoc for details.
83 *
|