Class Property<T>

java.lang.Object
com.github.ngoanh2n.Property<T>

@ParametersAreNonnullByDefault public class Property<T> extends Object
Represent a JVM system property.
  • Constructor Details

    • Property

      public Property(String name, Class<T> type)
      Construct Property.
      Parameters:
      name - The name of the JVM system property.
      type - The class type of the JVM system property.
    • Property

      public Property(String name, Class<T> type, @Nullable T defaultValue)
      Construct Property.
      Parameters:
      name - The name of the JVM system property.
      type - The class type of the JVM system property.
      defaultValue - The default value of the JVM system property.
  • Method Details

    • ofString

      public static Property<String> ofString(String name)
      Construct a new Property of String.
      Parameters:
      name - The name of the JVM system property.
      Returns:
      The Property.
    • ofString

      public static Property<String> ofString(String name, String defaultValue)
      Construct a new Property of String.
      Parameters:
      name - The name of the JVM system property.
      defaultValue - The default value of the JVM system property.
      Returns:
      The Property.
    • ofBoolean

      public static Property<Boolean> ofBoolean(String name)
      Construct a new Property of Boolean.
      Parameters:
      name - The name of the JVM system property.
      Returns:
      The Property.
    • ofBoolean

      public static Property<Boolean> ofBoolean(String name, Boolean defaultValue)
      Construct a new Property of Boolean.
      Parameters:
      name - The name of the JVM system property.
      defaultValue - The default value of the JVM system property.
      Returns:
      The Property.
    • ofInteger

      public static Property<Integer> ofInteger(String name)
      Construct a new Property of Integer.
      Parameters:
      name - The name of the JVM system property.
      Returns:
      The Property.
    • ofInteger

      public static Property<Integer> ofInteger(String name, int defaultValue)
      Construct a new Property of Integer.
      Parameters:
      name - The name of the JVM system property.
      defaultValue - The default value of the JVM system property.
      Returns:
      The Property.
    • ofLong

      public static Property<Long> ofLong(String name)
      Construct a new Property of Long.
      Parameters:
      name - The name of the JVM system property.
      Returns:
      The Property.
    • ofLong

      public static Property<Long> ofLong(String name, long defaultValue)
      Construct a new Property of Long.
      Parameters:
      name - The name of the JVM system property.
      defaultValue - The default value of the JVM system property.
      Returns:
      The Property.
    • ofFloat

      public static Property<Float> ofFloat(String name)
      Construct a new Property of Float.
      Parameters:
      name - The name of the JVM system property.
      Returns:
      The Property.
    • ofFloat

      public static Property<Float> ofFloat(String name, float defaultValue)
      Construct a new Property of Float.
      Parameters:
      name - The name of the JVM system property.
      defaultValue - The default value of the JVM system property.
      Returns:
      The Property.
    • ofDouble

      public static Property<Double> ofDouble(String name)
      Construct a new Property of Double.
      Parameters:
      name - The name of the JVM system property.
      Returns:
      The Property.
    • ofDouble

      public static Property<Double> ofDouble(String name, double defaultValue)
      Construct a new Property of Double.
      Parameters:
      name - The name of the JVM system property.
      defaultValue - The default value of the JVM system property.
      Returns:
      The Property.
    • getName

      public String getName()
      Get the name of the JVM system property.
      Returns:
      the JVM system property name.
    • getType

      public Class<T> getType()
      Get the class type of the JVM system property.
      Returns:
      the class type of JVM system property name.
    • getValue

      public T getValue()
      Get the value of the JVM system property.
      Returns:
      the JVM system property value.
    • setValue

      public void setValue(T newValue)
      Set the JVM system property indicated by the specified key.
      Parameters:
      newValue - The value of the JVM system property.
    • clearValue

      public void clearValue()
      Remove the JVM system property indicated by the specified key.
    • getDefaultValue

      public T getDefaultValue()
      Get the default value of the JVM system property.
      Returns:
      the JVM system property object.