Javadoc in this class uses the following sample to explain the semantics:
@XmlEnum(Integer.class) enum Foo { @XmlEnumValue("1") ONE, @XmlEnumValue("2") TWO }
8889909192939495969798
protected AccessorFactory createAccessorFactory(Class clazz) { XmlAccessorFactory factoryAnn; AccessorFactory accFactory = null; // user providing class to be used. JAXBContextImpl context = ((RuntimeModelBuilder) builder).context; if (context!=null && context.xmlAccessorFactorySupport){ factoryAnn = findXmlAccessorFactoryAnnotation(clazz); if (factoryAnn != null) { try {
1030103110321033103410351036103710381039104010411042104310441045
return; } // the registry doesn't know about this element. // try its xsi:type JaxBeanInfo beanInfo = XsiTypeLoader.parseXsiType(state, ea, null); if(beanInfo==null) { // we don't even know its xsi:type reportUnexpectedChildElement(ea,false); return; } state.loader = beanInfo.getLoader(null,false); state.prev.backup = new JAXBElement<Object>(ea.createQName(),Object.class,null); state.receiver = this; }
51525354555657585960616263
super(true); this.defaultBeanInfo = defaultBeanInfo; } public void startElement(UnmarshallingContext.State state, TagName ea) throws SAXException { JaxBeanInfo beanInfo = parseXsiType(state,ea,defaultBeanInfo); if(beanInfo==null) beanInfo = defaultBeanInfo; Loader loader = beanInfo.getLoader(null,false); state.loader = loader; loader.startElement(state,ea); }
6263646566676869707172
loader.startElement(state,ea); } /*pacakge*/ static JaxBeanInfo parseXsiType(UnmarshallingContext.State state, TagName ea, @Nullable JaxBeanInfo defaultBeanInfo) throws SAXException { UnmarshallingContext context = state.getContext(); JaxBeanInfo beanInfo = null; // look for @xsi:type Attributes atts = ea.atts; int idx = atts.getIndex(WellKnownNamespace.XML_SCHEMA_INSTANCE,"type");
423424425426427428429430431432433
assert primitiveType.isPrimitive(); return primitiveType; } public Location getClassLocation(final Class clazz) { return new Location() { public String toString() { return clazz.getName(); } }; }
431432433434435436437438439440441
} }; } public Location getFieldLocation(final Field field) { return new Location() { public String toString() { return field.toString(); } }; }
439440441442443444445446447448449
} }; } public Location getMethodLocation(final Method method) { return new Location() { public String toString() { return method.toString(); } }; }
142143144145146147148149150151152
if(id==ID.ID) t = new IDTransducerImpl(t); MimeType emt = src.getExpectedMimeType(); if(emt!=null) t = new MimeTypedTransducer(t,emt); if(src.inlineBinaryData()) t = new InlineBinaryTransducer(t); if(src.getSchemaType()!=null) {
151152153154155156157158159160
if(src.getSchemaType()!=null) { if (src.getSchemaType().equals(createXSSimpleType())) { return RuntimeBuiltinLeafInfoImpl.STRING; } t = new SchemaTypeTransducer(t,src.getSchemaType()); } return t; }
130131132133134135136137138139140
* Shouldn't be called from anywhere else. * * TODO: this is not the proper place for this class to be in. */ public static Transducer createTransducer(RuntimeNonElementRef ref) { Transducer t = ref.getTarget().getTransducer(); RuntimePropertyInfo src = ref.getSource(); ID id = src.id(); if(id==ID.IDREF) return RuntimeBuiltinLeafInfoImpl.STRING;