java.lang.Object
com.github.jh3nd3rs0n.jargyle.client.PropertySpec<V>
Type Parameters:
V - the specified value type

public abstract class PropertySpec<V> extends Object
The specification of a Property of the specified value type.
  • Constructor Details

    • PropertySpec

      public PropertySpec(String n, Class<V> valType, V defaultVal)
      Constructs a PropertySpec with the provided name, the provided value type, and the provided default value.
      Parameters:
      n - the provided name
      valType - the provided value type
      defaultVal - the provided default value (can be null)
  • Method Details

    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • getDefaultProperty

      public final Property<V> getDefaultProperty()
      Returns the default Property.
      Returns:
      the default Property
    • getName

      public final String getName()
      Returns the name of the Property.
      Returns:
      the name of the Property
    • getValueType

      public final Class<V> getValueType()
      Returns the value type of the Property.
      Returns:
      the value type of the Property
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • newProperty

      public final Property<V> newProperty(V value)
      Returns a new Property with the provided value. An IllegalArgumentException is thrown if the provided value is invalid.
      Parameters:
      value - the provided value
      Returns:
      a new Property with the provided value
    • newPropertyWithParsedValue

      public final Property<V> newPropertyWithParsedValue(String value)
      Returns a new Property with the parsed value from the provided String value. An IllegalArgumentException is thrown if the provided String value to be parsed is invalid or if the parsed value is invalid.
      Parameters:
      value - the provided String value to be parsed
      Returns:
      a new Property with the parsed value from the provided String value
    • parse

      protected abstract V parse(String value)
      Returns the parsed value from the provided String value. An IllegalArgumentException is thrown if the provided String value to be parsed is invalid.
      Parameters:
      value - the String value to be parsed
      Returns:
      the parsed value from the provided String value
    • toString

      public final String toString()
      Returns the String representation of this PropertySpec.
      Overrides:
      toString in class Object
      Returns:
      the String representation of this PropertySpec
    • validate

      protected V validate(V value)
      Returns the valid provided value. Implementations can override this method to throw an IllegalArgumentException if the provided value is invalid.
      Parameters:
      value - the provided value
      Returns:
      the valid provided value