org.eclipse.rdf4j.rio

## Class RioConfig

- java.lang.Object
- - org.eclipse.rdf4j.rio.RioConfig

- All Implemented Interfaces:
    Serializable
  Direct Known Subclasses:
    ParserConfig, WriterConfig

      public class RioConfig
      extends Object
      implements Serializable

  Superclass for `ParserConfig` and `WriterConfig`.

  A RioConfig is a container for several `RioSetting` objects, each of which has a default value. You can override the default value for a `RioSetting` in one of two ways:

  1. You can programmatically set its value using `set(RioSetting, Object)`
  2. You can set a Java system property (e.g. by means of a `-D` jvm command line switch). The property name should corresponds to the `key` of the setting. Note that this method is not supported by every type of `RioSetting`: boolean values, strings, and numeric (long) values are supported, but more complex types are not
  Author:
    Peter Ansell
  See Also:
    `RioSetting`, Serialized Form

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected org.slf4j.Logger` | `log`
    `protected ConcurrentMap<RioSetting<Object>,Object>` | `settings` A map containing mappings from settings to their values.
    `protected ConcurrentMap<RioSetting<Object>,Object>` | `systemPropertyCache` A map containing mappings from settings to system properties that have been discovered since the last call to `useDefaults()`.

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `RioConfig()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `<T> T` | `get(RioSetting<T> setting)` Return the value for a given `RioSetting` or the default value if it has not been set.
    `<T> boolean` | `isSet(RioSetting<T> setting)` Checks for whether a `RioSetting` has been explicitly set by a user.
    `<T> RioConfig` | `set(RioSetting<T> setting, T value)` Sets a `RioSetting` to have a new value.
    `RioConfig` | `useDefaults()` Resets all settings back to their default values.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### settings

          protected final ConcurrentMap<RioSetting<Object>,Object> settings

      A map containing mappings from settings to their values.

    - #### systemPropertyCache

          protected final ConcurrentMap<RioSetting<Object>,Object> systemPropertyCache

      A map containing mappings from settings to system properties that have been discovered since the last call to `useDefaults()`.

    - #### log

          protected final org.slf4j.Logger log

  - ### Constructor Detail

    - #### RioConfig

          public RioConfig()

  - ### Method Detail

    - #### get

          public <T> T get(RioSetting<T> setting)

      Return the value for a given `RioSetting` or the default value if it has not been set.
      Parameters:
        `setting` - The `RioSetting` to fetch a value for.
      Returns:
        The value for the parser setting, or the default value if it is not set.

    - #### set

          public <T> RioConfig set(RioSetting<T> setting,
                                   T value)

      Sets a `RioSetting` to have a new value. If the value is null, the parser setting is removed and the default will be used instead.
      Parameters:
        `setting` - The setting to set a new value for.
        `value` - The value for the parser setting, or null to reset the parser setting to use the default value.
      Returns:
        Either a copy of this config, if it is immutable, or this object, to allow chaining of method calls.

    - #### isSet

          public <T> boolean isSet(RioSetting<T> setting)

      Checks for whether a `RioSetting` has been explicitly set by a user.

      A setting can be set via `set(RioSetting, Object)`, or via use of a system property.

      Parameters:
        `setting` - The setting to check for.
      Returns:
        True if the setting has been explicitly set, or false otherwise.

    - #### useDefaults

          public RioConfig useDefaults()

      Resets all settings back to their default values.
      Returns:
        Either a copy of this config, if it is immutable, or this object, to allow chaining of method calls.

Copyright © 2015-2020 Eclipse Foundation. All Rights Reserved.