Class IonSystemBuilder


  • public class IonSystemBuilder
    extends java.lang.Object
    The builder for creating IonSystems. Most applications will only have one or two system instances; see IonSystem for important constraints.

    Builders may be configured once and reused to construct multiple objects. They can be copied to create a mutable copy of a prototype (presumably for altering some property).

    Instances of this class are not safe for use by multiple threads unless they are immutable.

    The easiest way to get going is to use the standard() builder:

        IonSystem ion = IonSystemBuilder.standard().build();
    

    However, most long-lived applications will want to provide a custom IonCatalog implementation rather than using the default SimpleCatalog. For example:

        IonCatalog catalog = newCustomCatalog();
        IonSystemBuilder b = IonSystemBuilder.standard().copy();
        b.setCatalog(catalog);
        IonSystem ion = b.build();
    

    Configuration properties follow the standard JavaBeans idiom in order to be friendly to dependency injection systems. They also provide alternative mutation methods that enable a more fluid style:

        IonCatalog catalog = newCustomCatalog();
        IonSystem ion = IonSystemBuilder.standard()
                                        .withCatalog(catalog)
                                        .build();
    

    Configuration Properties

    This builder provides the following configurable properties:

    • catalog: The IonCatalog used as a default when reading Ion data. If null, each system will be built with a new SimpleCatalog.
    • streamCopyOptimized: When true, this enables optimizations when copying data between two Ion streams. For example, in some cases raw binary-encoded Ion can be copied directly from the input to the output. This can have significant performance benefits when the appropriate conditions are met. This feature is experimental! Please test thoroughly and report any issues.