Class StringValue


  • public final class StringValue
    extends SettableRegistryValue
    A representation of string registry values. Instances of this class are immutable.
    Author:
    Rob Spoor
    • Method Detail

      • of

        public static StringValue of​(String name,
                                     String value)
        Creates a new string registry value.
        Parameters:
        name - The name of the registry value.
        value - The registry value's string value.
        Returns:
        The created string registry value.
        Throws:
        NullPointerException - If the given name or value is null.
      • expandableOf

        public static StringValue expandableOf​(String name,
                                               String value)
        Creates a new string registry value.
        Parameters:
        name - The name of the registry value.
        value - The registry value's string value.
        Returns:
        The created string registry value.
        Throws:
        NullPointerException - If the given name or value is null.
      • value

        public String value()
        Returns the registry value's string value. For expandable string registry values, this is the unexpanded value. Use expandedValue() for the expanded value.
        Returns:
        The registry value's string value.
      • isExpandable

        public boolean isExpandable()
        Returns whether or not this registry value is an expandable string registry value. If so, its value can be expanded.
        Returns:
        true if this registry value is an expandable string registry value, or false otherwise.
        See Also:
        expandedValue()
      • expandedValue

        public String expandedValue()
        Returns the registry value's expanded string value.
        Returns:
        The registry value's expanded string value.
        Throws:
        IllegalStateException - If this registry value is not expandable.
      • withName

        public StringValue withName​(String name)
        Description copied from class: SettableRegistryValue
        Returns a registry value with the same value as this registry value but a different name.
        Specified by:
        withName in class SettableRegistryValue
        Parameters:
        name - The name of the registry value to return.
        Returns:
        A registry value with the same value as this registry value and the given name.
      • withValue

        public StringValue withValue​(String value)
        Returns a registry value with the same name as this registry value but a different value. This registry value will not be expandable.
        Parameters:
        value - The value of the registry value to return.
        Returns:
        A registry value with the same name as this registry value and the given value.
        Throws:
        NullPointerException - If the given value is null.
      • withExpandableValue

        public StringValue withExpandableValue​(String value)
        Returns a registry value with the same name as this registry value but a different value. This registry value will be expandable.
        Parameters:
        value - The value of the registry value to return.
        Returns:
        A registry value with the same name as this registry value and the given value.
        Throws:
        NullPointerException - If the given value is null.