Class XStreamBuilder

java.lang.Object
ch.tocco.nice2.util.xstream.XStreamBuilder

public class XStreamBuilder extends Object
use this builder to get an instance of XStream the available methods are designed to be used with a annotation-based configuration of XStream, but you can configure the built instance further if you'd like this builder makes sure that the security framework is initialized so no warnings get logged. If nothing is configured by the caller, XStream.setupDefaultSecurity(XStream) will be used the built instance always ignores unknown elements
  • Method Details

    • create

      public static XStreamBuilder create()
    • withDriver

      public XStreamBuilder withDriver(com.thoughtworks.xstream.io.HierarchicalStreamDriver driver)
    • withMapper

      public XStreamBuilder withMapper(@Nullable @Nullable com.thoughtworks.xstream.mapper.Mapper mapper)
    • withClassLoader

      public XStreamBuilder withClassLoader(@Nullable @Nullable ClassLoader classLoader)
    • withConverter

      public XStreamBuilder withConverter(com.thoughtworks.xstream.converters.Converter converter)
    • withConverter

      public XStreamBuilder withConverter(com.thoughtworks.xstream.converters.SingleValueConverter converter)
    • withoutDefaultSecurity

      public XStreamBuilder withoutDefaultSecurity()
      do not use our default security, i.e. XStream.setupDefaultSecurity(XStream) and access to org.joda.time classes
      Returns:
      the builder
    • withAnnotatedClass

      public XStreamBuilder withAnnotatedClass(Class classToProcess)
      proccess annotations of the given class and allow access to it
      Parameters:
      classToProcess - the class to use
      Returns:
      the builder
    • withAllowedTypes

      public XStreamBuilder withAllowedTypes(String pattern)
      allow access to exacts types or packages matching a given pattern
      Parameters:
      pattern - the pattern, see XStream.allowTypesByWildcard(String[]) for expected pattern format
      Returns:
      the builder
    • withAllowedType

      public XStreamBuilder withAllowedType(Class<?> clazz)
    • build

      public com.thoughtworks.xstream.XStream build()