public ImmutableSetConverter(XStream xs) { this(xs.getMapper(),xs.getReflectionProvider()); }
/** * Adds an alias to use instead of the fully qualified class name. * * @param name The alias to use * @param type The Class to use the alias for * @see XStream#alias(String, Class) */ public void addAlias(String name, Class type) { xStream.alias(name, type); }
/** * Adds an alias to use for a given field in the given class. * * @param alias The alias to use instead of the original field name * @param definedIn The class that defines the field. * @param fieldName The name of the field to use the alias for * @see XStream#aliasField(String, Class, String) */ public void addFieldAlias(String alias, Class definedIn, String fieldName) { xStream.aliasField(alias, definedIn, fieldName); }
/** * @deprecated Uses default encoding yet fails to write an encoding header. Prefer {@link #toXMLUTF8}. */ @Deprecated @Override public void toXML(Object obj, OutputStream out) { super.toXML(obj, out); }
/** * Process the annotations of the given type and configure the XStream. A call of this * method will automatically turn the auto-detection mode for annotations off. * * @param type the type with XStream annotations * @since 1.3 */ public void processAnnotations(final Class type) { processAnnotations(new Class[]{type}); }
/** * Deserialize an object from a hierarchical data structure (such as XML). * * @throws XStreamException if the object cannot be deserialized */ public Object unmarshal(HierarchicalStreamReader reader) { return unmarshal(reader, null, null); }
/** * Marshals the given object with the given XStream into {@link XStreamDOM} and return it. */ public static XStreamDOM from(XStream xs, Object obj) { WriterImpl w = newWriter(); xs.marshal(obj, w); return w.getOutput(); }
/** * Adds a default implicit collection which is used for any unmapped XML tag. * * @param ownerType class owning the implicit collection * @param fieldName name of the field in the ownerType. This field must be a concrete * collection type or matching the default implementation type of the collection * type. */ public void addImplicitCollection(Class ownerType, String fieldName) { addImplicitCollection(ownerType, fieldName, null, null); }
protected void setupDefaultImplementations() { if (defaultImplementationsMapper == null) { return; } addDefaultImplementation(HashMap.class, Map.class); addDefaultImplementation(ArrayList.class, List.class); addDefaultImplementation(HashSet.class, Set.class); addDefaultImplementation(TreeSet.class, SortedSet.class); addDefaultImplementation(GregorianCalendar.class, Calendar.class); }
/** * Ignore all unknown elements. * * @since 1.4.5 */ public void ignoreUnknownElements() { ignoreUnknownElements(IGNORE_ALL); }
/** * Add immutable types. The value of the instances of these types will always be written into the stream even if * they appear multiple times. However, references are still supported at deserialization time. * * @throws InitializationException if no {@link ImmutableTypesMapper} is available * @deprecated As of 1.4.9 use {@link #addImmutableType(Class, boolean)} */ public void addImmutableType(Class type) { addImmutableType(type, true); }
/** * Serialize and object to a hierarchical data structure (such as XML). * * @param dataHolder Extra data you can use to pass to your converters. Use this as you * want. If not present, XStream shall create one lazily as needed. * @throws XStreamException if the object cannot be serialized */ public void marshal(Object obj, HierarchicalStreamWriter writer, DataHolder dataHolder) { marshallingStrategy.marshal(writer, obj, converterLookup, mapper, dataHolder); }
public ImmutableMapConverter(XStream xs) { this(xs.getMapper(),xs.getReflectionProvider()); }
/** * Unmarshals this DOM into an object via the given XStream. */ public <T> T unmarshal(XStream xs) { return (T)xs.unmarshal(newReader()); }
/** * Adds an implicit array. * * @param ownerType class owning the implicit array * @param fieldName name of the array field * @since 1.4 */ public void addImplicitArray(Class ownerType, String fieldName) { addImplicitCollection(ownerType, fieldName); }
public RobustCollectionConverter(XStream xs) { this(xs.getMapper(),xs.getReflectionProvider()); }
public <T> T unmarshal(XStream xs, T root) { return (T)xs.unmarshal(newReader(),root); }
public ImmutableSortedSetConverter(XStream xs) { this(xs.getMapper(),xs.getReflectionProvider()); }
/** * Unmarshals the given graph to the given XStream HierarchicalStreamWriter. * Converts exceptions using {@link #convertXStreamException}. */ private Object doUnmarshal(HierarchicalStreamReader streamReader, @Nullable DataHolder dataHolder) { try { return getXStream().unmarshal(streamReader, null, dataHolder); } catch (Exception ex) { throw convertXStreamException(ex, false); } }
public ImmutableListConverter(XStream xs) { this(xs.getMapper(),xs.getReflectionProvider()); }