Class KeyValue<T>

java.lang.Object
org.pentaho.di.core.util.KeyValue<T>
Type Parameters:
T - type of value
All Implemented Interfaces:
Serializable
Direct Known Subclasses:
BooleanPluginProperty, IntegerPluginProperty, StringListPluginProperty, StringPluginProperty

public class KeyValue<T> extends Object implements Serializable
Author:
Thomas Hoedl(asc042)
See Also:
  • Field Details

    • DEFAULT_TRUE_VALUES

      public static final List<String> DEFAULT_TRUE_VALUES
      The default true values.
    • VALID_KEY_CHARS

      public static final String VALID_KEY_CHARS
      Valid key characters.
      See Also:
  • Constructor Details

  • Method Details

    • assertKey

      public static final void assertKey(String lowerKey) throws IllegalArgumentException
      Parameters:
      lowerKey - key to test.
      Throws:
      IllegalArgumentException - if key is invalid.
    • getKey

      public String getKey()
      Returns:
      the key, never null.
    • getValue

      public T getValue()
      Returns:
      the value
    • setValue

      public void setValue(T value)
      Parameters:
      value - the value to set
    • value

      public KeyValue<T> value(T newValue)
      Parameters:
      newValue - value to set.
      Returns:
      this.
    • value

      public T value()
      Returns:
      value.
    • booleanValue

      public Boolean booleanValue(String... trueValues)
      Parameters:
      trueValues - string true values, case is ignored.
      Returns:
      boolean value, null if value is null.
    • booleanValue

      public Boolean booleanValue(List<String> trueValues)
      Parameters:
      trueValues - string true values, case is ignored.
      Returns:
      boolean value, null if value is null.
    • booleanValue

      public Boolean booleanValue(List<String> trueValues, boolean ignoreCase)
      Parameters:
      trueValues - string true values.
      ignoreCase - ignore case?
      Returns:
      boolean value, null if value is null.
    • booleanValue

      public Boolean booleanValue()
      Uses DEFAULT_TRUE_VALUES, ignore case.
      Returns:
      boolean value or null if value is null.
    • booleanValue

      public Boolean booleanValue(Boolean defaultValue)
      Parameters:
      defaultValue - the default value
      Returns:
      boolean value or default value if value is null.
    • stringValue

      public String stringValue()
      Returns:
      string value or null if value is null.
    • stringValue

      public String stringValue(String defaultValue)
      Parameters:
      defaultValue - the default value.
      Returns:
      string value or default value if value is null.
    • stringValueDefaultIfBlank

      public String stringValueDefaultIfBlank(String defaultValue)
      Parameters:
      defaultValue - the default value.
      Returns:
      string value or default value if value is blank.
    • integerValue

      public Integer integerValue() throws NumberFormatException
      Returns:
      integer value or null if value is null.
      Throws:
      NumberFormatException - if string value of value cannot be converted to Integer
    • integerValue

      public Integer integerValue(Integer defaultValue)
      Parameters:
      defaultValue - the default value.
      Returns:
      integer value or default value if value is null or cannot be converted to integer.
    • longValue

      public Long longValue() throws NumberFormatException
      Returns:
      long value or null if value is null.
      Throws:
      NumberFormatException - if string value of value cannot be converted to Long
    • longValue

      public Long longValue(Long defaultValue)
      Parameters:
      defaultValue - the default value.
      Returns:
      long value or default value if value is null or cannot be converted to long.
    • doubleValue

      public Double doubleValue() throws NumberFormatException
      Returns:
      double value or null if value is null.
      Throws:
      NumberFormatException - if string value of value cannot be converted to Double
    • doubleValue

      public Double doubleValue(Double defaultValue)
      Parameters:
      defaultValue - the default value.
      Returns:
      double value or default value if value is null or cannot be converted to double.
    • floatValue

      public Float floatValue() throws NumberFormatException
      Returns:
      float value or null if value is null.
      Throws:
      NumberFormatException - if string value of value cannot be converted to Float
    • floatValue

      public Float floatValue(Float defaultValue)
      Parameters:
      defaultValue - the default value.
      Returns:
      float value or default value if value is null or cannot be converted to float.
    • toString

      public String toString()
      Overrides:
      toString in class Object
      See Also: