@Override public <A extends XmlAdapter> void setAdapter(Class<A> type, A adapter) { this.jaxbUnmarshaller.setAdapter(type, adapter); }
@Override public void setAdapter(XmlAdapter xmlAdapter) { this.jaxbUnmarshaller.setAdapter(xmlAdapter); }
@Override protected void customizeUnmarshaller(Unmarshaller unmarshaller) { unmarshaller.setAdapter(new MyCustomElementAdapter()); } }
/** * Template method that can be overridden by concrete JAXB marshallers for custom initialization behavior. * Gets called after creation of JAXB {@code Marshaller}, and after the respective properties have been set. * <p>The default implementation sets the {@link #setUnmarshallerProperties(Map) defined properties}, the {@link * #setValidationEventHandler(ValidationEventHandler) validation event handler}, the {@link #setSchemas(Resource[]) * schemas}, {@link #setUnmarshallerListener(javax.xml.bind.Unmarshaller.Listener) listener}, and * {@link #setAdapters(XmlAdapter[]) adapters}. */ protected void initJaxbUnmarshaller(Unmarshaller unmarshaller) throws JAXBException { if (this.unmarshallerProperties != null) { for (String name : this.unmarshallerProperties.keySet()) { unmarshaller.setProperty(name, this.unmarshallerProperties.get(name)); } } if (this.unmarshallerListener != null) { unmarshaller.setListener(this.unmarshallerListener); } if (this.validationEventHandler != null) { unmarshaller.setEventHandler(this.validationEventHandler); } if (this.adapters != null) { for (XmlAdapter<?, ?> adapter : this.adapters) { unmarshaller.setAdapter(adapter); } } if (this.schema != null) { unmarshaller.setSchema(this.schema); } }
public <A extends XmlAdapter> void setAdapter(Class<A> aClass, A a) { unmarshaller.setAdapter(aClass, a); }
@SuppressWarnings("unchecked") public void setAdapter(XmlAdapter adapter) { delegate.setAdapter(adapter); }
@SuppressWarnings("unchecked") public <A extends XmlAdapter> void setAdapter(Class<A> type, A adapter) { delegate.setAdapter(adapter); }
public void setAdapter(XmlAdapter xmlAdapter) { unmarshaller.setAdapter(xmlAdapter); }
public void setAdapter(XmlAdapter xmlAdapter) { this.jaxbUnmarshaller.setAdapter(xmlAdapter); }
public <A extends XmlAdapter> void setAdapter(Class<A> type, A adapter) { this.jaxbUnmarshaller.setAdapter(type, adapter); }
public class Test { public static void main(String... args) { JAXBContext context = JAXBContext.getInstance(Event.class); Unmarshaller unmarshaller = context.createUnmarshaller(); UserContext userContext = null; // fetch it from some where unmarshaller.setAdapter(UserAdapter.class, new UserAdapter(userContext)); Event event = (Event) unmarshaller.unmarshal(..); } }
um.setAdapter(BrandAdapter.class, ba);
/** * Replaces the {@code sis-metadata} adapter by this adapter. */ @Override public void register(final Unmarshaller unmarshaller) { unmarshaller.setAdapter(org.apache.sis.internal.jaxb.gml.SC_VerticalCRS.class, this); }
@Override public <A extends XmlAdapter> void setAdapter( final Class<A> type, final A adapter ) { unmarshaller.setAdapter( type, adapter ); }
@SuppressWarnings("rawtypes") public <A extends XmlAdapter> void setAdapter(Class<A> type, A adapter) { unmarshaller.setAdapter(type, adapter); }
public class Test { public static void main(String... args) { JAXBContext context = JAXBContext.getInstance(Event.class); Unmarshaller unmarshaller = context.createUnmarshaller(); UserContext userContext = null; // fetch it from some where unmarshaller.setAdapter(UserAdapter.class, new UserAdapter(userContext)); Event event = (Event) unmarshaller.unmarshal(..); } }
final JAXBContext jaxbContext = JAXBContext.newInstance(Root.class); final Unmarshaller jaxbUnmarshaller = jaxbContext.createUnmarshaller(); jaxbUnmarshaller.setAdapter(MyChildImpAdapter.class, new MyChildImpAdapter(MyChildImpl.class)); final InputStream inputStream = getClass().getResourceAsStream("some.xml"); final Root root = (Root) jaxbUnmarshaller.unmarshal(inputStream);
/** * Delegates to the wrapped unmarshaller. The initial state will be saved * if it was not already done, for future restoration by {@link #reset(Pooled)}. */ @Override @SuppressWarnings("rawtypes") public <A extends XmlAdapter> void setAdapter(final Class<A> type, final A adapter) { super.setAdapter(type, adapter); unmarshaller.setAdapter(type, adapter); }
@Override public Stream<Rule> stream() throws Exception { final Unmarshaller unmarshaller = JAXBContext .newInstance(RulesXml.RulesContext.class) .createUnmarshaller(); unmarshaller.setEventHandler(event -> false); unmarshaller.setAdapter(new RulesXml.XpathAdapter(this.xpath)); unmarshaller.setAdapter(new PatternAdapter(this.safeness)); InputStream inputStream = Files.newInputStream(this.source.path()); Object context = unmarshaller.unmarshal(inputStream); return ((RulesXml.RulesContext) context).rules.stream(); }
@Override protected void configure(final Unmarshaller unmarshaller) { unmarshaller.setAdapter(PersistentEntityAdapter.class, serviceRegistry.injectServicesInto(new PersistentEntityAdapter())); unmarshaller.setAdapter(PersistentEntitiesAdapter.class, serviceRegistry.injectServicesInto(new PersistentEntitiesAdapter())); }