/** * Set the header that will be written to a file if * @param header The new header to use for the configuration * @return The map's header */ public ConfigurationOptions setHeader(String header) { return new ConfigurationOptions(mapSupplier, header, serializers, acceptedTypes, objectMapperFactory, shouldCopyDefaults); }
/** * Set whether defaults should be set when used. * * @see #shouldCopyDefaults() for information on what this method does * @param shouldCopyDefaults whether to copy defaults * @return updated options object */ public ConfigurationOptions setShouldCopyDefaults(boolean shouldCopyDefaults) { return new ConfigurationOptions(mapSupplier, header, serializers, acceptedTypes, objectMapperFactory, shouldCopyDefaults); }
/** * Set the collection of TypeSerializers to be used for lookups * * @param serializers The serializers to use * @return updated options object */ public ConfigurationOptions setSerializers(TypeSerializerCollection serializers) { return new ConfigurationOptions(mapSupplier, header, serializers, acceptedTypes, objectMapperFactory, shouldCopyDefaults); }
/** * Set types that will be accepted as native values for this configuration * @param acceptedTypes The types that will be accepted to a call to {@link ConfigurationNode#setValue(Object)} * @return updated options object */ public ConfigurationOptions setAcceptedTypes(Set<Class<?>> acceptedTypes) { return new ConfigurationOptions(mapSupplier, header, serializers, acceptedTypes, objectMapperFactory, shouldCopyDefaults); }
/** * Set the factory to use to produce object mapper instances for this configuration * * @param factory The factory to use to produce object mapper instances. Must not be null * @return updated options object */ public ConfigurationOptions setObjectMapperFactory(ObjectMapperFactory factory) { Preconditions.checkNotNull(factory, "factory"); return new ConfigurationOptions(mapSupplier, header, serializers, acceptedTypes, factory, shouldCopyDefaults); }
/** * Return a new options object with the provided option set. * * @param factory The new factory to use to create a map * @return The new options object */ public ConfigurationOptions setMapFactory(MapFactory factory) { Preconditions.checkNotNull(factory, "factory"); return new ConfigurationOptions(factory, header, serializers, acceptedTypes, objectMapperFactory, shouldCopyDefaults); }
/** * Creates a new {@link ConfigurationOptions} instance, with the specified 'copy defaults' setting * set, and all other settings copied from this instance. * * @see #shouldCopyDefaults() for information on what this method does * @param shouldCopyDefaults whether to copy defaults * @return updated options object */ @NonNull public ConfigurationOptions setShouldCopyDefaults(boolean shouldCopyDefaults) { if (this.shouldCopyDefaults == shouldCopyDefaults) { return this; } return new ConfigurationOptions(mapFactory, header, serializers, acceptedTypes, objectMapperFactory, shouldCopyDefaults); }
/** * Creates a new {@link ConfigurationOptions} instance, with the specified 'copy defaults' setting * set, and all other settings copied from this instance. * * @see #shouldCopyDefaults() for information on what this method does * @param shouldCopyDefaults whether to copy defaults * @return updated options object */ @NonNull public ConfigurationOptions setShouldCopyDefaults(boolean shouldCopyDefaults) { if (this.shouldCopyDefaults == shouldCopyDefaults) { return this; } return new ConfigurationOptions(mapFactory, header, serializers, acceptedTypes, objectMapperFactory, shouldCopyDefaults); }
/** * Creates a new {@link ConfigurationOptions} instance, with the specified header * set, and all other settings copied from this instance. * * @param header The new header to use * @return The new options object */ @NonNull public ConfigurationOptions setHeader(@Nullable String header) { if (Objects.equal(this.header, header)) { return this; } return new ConfigurationOptions(mapFactory, header, serializers, acceptedTypes, objectMapperFactory, shouldCopyDefaults); }
/** * Creates a new {@link ConfigurationOptions} instance, with the specified {@link TypeSerializerCollection} * set, and all other settings copied from this instance. * * @param serializers The serializers to use * @return The new options object */ @NonNull public ConfigurationOptions setSerializers(@NonNull TypeSerializerCollection serializers) { Preconditions.checkNotNull(serializers, "serializers"); if (this.serializers == serializers) { return this; } return new ConfigurationOptions(mapFactory, header, serializers, acceptedTypes, objectMapperFactory, shouldCopyDefaults); }
/** * Creates a new {@link ConfigurationOptions} instance, with the specified {@link ObjectMapperFactory} * set, and all other settings copied from this instance. * * @param objectMapperFactory The factory to use to produce object mapper instances. Must not be null * @return updated options object */ @NonNull public ConfigurationOptions setObjectMapperFactory(@NonNull ObjectMapperFactory objectMapperFactory) { Preconditions.checkNotNull(objectMapperFactory, "factory"); if (this.objectMapperFactory == objectMapperFactory) { return this; } return new ConfigurationOptions(mapFactory, header, serializers, acceptedTypes, objectMapperFactory, shouldCopyDefaults); }
/** * Creates a new {@link ConfigurationOptions} instance, with the specified {@link MapFactory} * set, and all other settings copied from this instance. * * @param mapFactory The new factory to use to create a map * @return The new options object */ @NonNull public ConfigurationOptions setMapFactory(@NonNull MapFactory mapFactory) { Preconditions.checkNotNull(mapFactory, "mapFactory"); if (this.mapFactory == mapFactory) { return this; } return new ConfigurationOptions(mapFactory, header, serializers, acceptedTypes, objectMapperFactory, shouldCopyDefaults); }
/** * Creates a new {@link ConfigurationOptions} instance, with the specified {@link ObjectMapperFactory} * set, and all other settings copied from this instance. * * @param objectMapperFactory The factory to use to produce object mapper instances. Must not be null * @return updated options object */ @NonNull public ConfigurationOptions setObjectMapperFactory(@NonNull ObjectMapperFactory objectMapperFactory) { Preconditions.checkNotNull(objectMapperFactory, "factory"); if (this.objectMapperFactory == objectMapperFactory) { return this; } return new ConfigurationOptions(mapFactory, header, serializers, acceptedTypes, objectMapperFactory, shouldCopyDefaults); }
/** * Creates a new {@link ConfigurationOptions} instance, with the specified header * set, and all other settings copied from this instance. * * @param header The new header to use * @return The new options object */ @NonNull public ConfigurationOptions setHeader(@Nullable String header) { if (Objects.equal(this.header, header)) { return this; } return new ConfigurationOptions(mapFactory, header, serializers, acceptedTypes, objectMapperFactory, shouldCopyDefaults); }
/** * Creates a new {@link ConfigurationOptions} instance, with the specified {@link TypeSerializerCollection} * set, and all other settings copied from this instance. * * @param serializers The serializers to use * @return The new options object */ @NonNull public ConfigurationOptions setSerializers(@NonNull TypeSerializerCollection serializers) { Preconditions.checkNotNull(serializers, "serializers"); if (this.serializers == serializers) { return this; } return new ConfigurationOptions(mapFactory, header, serializers, acceptedTypes, objectMapperFactory, shouldCopyDefaults); }
/** * Creates a new {@link ConfigurationOptions} instance, with the specified {@link MapFactory} * set, and all other settings copied from this instance. * * @param mapFactory The new factory to use to create a map * @return The new options object */ @NonNull public ConfigurationOptions setMapFactory(@NonNull MapFactory mapFactory) { Preconditions.checkNotNull(mapFactory, "mapFactory"); if (this.mapFactory == mapFactory) { return this; } return new ConfigurationOptions(mapFactory, header, serializers, acceptedTypes, objectMapperFactory, shouldCopyDefaults); }
/** * Creates a new {@link ConfigurationOptions} instance, with the specified accepted types * set, and all other settings copied from this instance. * * <p>'Accepted types' are types which are accepted as native values for the configuration.</p> * * <p>Null indicates that all types are accepted.</p> * * @param acceptedTypes The types that will be accepted to a call to {@link ConfigurationNode#setValue(Object)} * @return updated options object */ @NonNull public ConfigurationOptions setAcceptedTypes(@Nullable Set<Class<?>> acceptedTypes) { if (Objects.equal(this.acceptedTypes, acceptedTypes)) { return this; } return new ConfigurationOptions(mapFactory, header, serializers, acceptedTypes, objectMapperFactory, shouldCopyDefaults); }
/** * Create a new options object with defaults set * * @return A new default options object */ public static ConfigurationOptions defaults() { return new ConfigurationOptions(MapFactories.<SimpleConfigurationNode>insertionOrdered(), null, TypeSerializers .getDefaultSerializers(), null, DefaultObjectMapperFactory.getInstance(), false); }
/** * Create a new options object with defaults set * * @return A new default options object */ @NonNull public static ConfigurationOptions defaults() { return new ConfigurationOptions(MapFactories.<SimpleConfigurationNode>insertionOrdered(), null, TypeSerializers.getDefaultSerializers(), null, DefaultObjectMapperFactory.getInstance(), false); }
/** * Create a new options object with defaults set * * @return A new default options object */ @NonNull public static ConfigurationOptions defaults() { return new ConfigurationOptions(MapFactories.<SimpleConfigurationNode>insertionOrdered(), null, TypeSerializers.getDefaultSerializers(), null, DefaultObjectMapperFactory.getInstance(), false); }