Class CustomProperty

All Implemented Interfaces:
ICustomProperty

public class CustomProperty extends Object implements ICustomProperty

The CustomProperty class is an implementation of the ICustomProperty interface.

This class provides functionality for managing custom properties with various data types, including methods for setting and retrieving property values, handling property types, and supporting XML serialization and deserialization.

  • Constructor Details

    • CustomProperty

      public CustomProperty()

      Instantiates a new CustomProperty instance.

      The default type for a custom property is string if not explicitly specified.

    • CustomProperty

      public CustomProperty(String value)
      Instantiates a new CustomProperty instance.
      Parameters:
      value - The value of this custom property.
    • CustomProperty

      public CustomProperty(String type, String value)
      Instantiates a new CustomProperty instance.
      Parameters:
      type - The type of this custom property.
      value - The value of this custom property.
    • CustomProperty

      public CustomProperty(URL location)
      Instantiates a new CustomProperty instance.
      Parameters:
      location - The location of the file represented by this custom property.
    • CustomProperty

      public CustomProperty(ICustomProperty propertyToBeCopied)
      Instantiates a new CustomProperty instance by copying from the specified instance.
      Parameters:
      propertyToBeCopied - The property to be copied.
  • Method Details

    • setValue

      public void setValue(URL location)
      Description copied from interface: ICustomProperty
      Sets the value of the property as a URL.
      Specified by:
      setValue in interface ICustomProperty
      Parameters:
      location - the URL value to set
    • setValue

      public void setValue(String value)
      Description copied from interface: ICustomProperty
      Sets the value of the property as a String.
      Specified by:
      setValue in interface ICustomProperty
      Parameters:
      value - the String value to set
    • setValue

      public void setValue(char value)
      Description copied from interface: ICustomProperty
      Sets the value of the property as a char.
      Specified by:
      setValue in interface ICustomProperty
      Parameters:
      value - the char value to set
    • setValue

      public void setValue(Enum<?> value)
      Description copied from interface: ICustomProperty
      Sets the value of the property as an Enum.
      Specified by:
      setValue in interface ICustomProperty
      Parameters:
      value - the Enum value to set
    • setValue

      public void setValue(long value)
      Description copied from interface: ICustomProperty
      Sets the value of the property as a long.
      Specified by:
      setValue in interface ICustomProperty
      Parameters:
      value - the long value to set
    • setValue

      public void setValue(double value)
      Description copied from interface: ICustomProperty
      Sets the value of the property as a double.
      Specified by:
      setValue in interface ICustomProperty
      Parameters:
      value - the double value to set
    • setValue

      public void setValue(boolean value)
      Description copied from interface: ICustomProperty
      Sets the value of the property as a boolean.
      Specified by:
      setValue in interface ICustomProperty
      Parameters:
      value - the boolean value to set
    • setValue

      public void setValue(Color value)
      Description copied from interface: ICustomProperty
      Sets the value of the property as a Color.
      Specified by:
      setValue in interface ICustomProperty
      Parameters:
      value - the Color value to set
    • getAsString

      public String getAsString()
      Description copied from interface: ICustomProperty
      Retrieves the value of the property as a String.
      Specified by:
      getAsString in interface ICustomProperty
      Returns:
      the property value as a String
    • getAsChar

      public char getAsChar()
      Description copied from interface: ICustomProperty
      Retrieves the value of the property as a char.
      Specified by:
      getAsChar in interface ICustomProperty
      Returns:
      the property value as a char
    • getAsBool

      public boolean getAsBool()
      Description copied from interface: ICustomProperty
      Retrieves the value of the property as a boolean.
      Specified by:
      getAsBool in interface ICustomProperty
      Returns:
      the property value as a boolean
    • getAsColor

      public Color getAsColor()
      Description copied from interface: ICustomProperty
      Retrieves the value of the property as a Color.
      Specified by:
      getAsColor in interface ICustomProperty
      Returns:
      the property value as a Color
    • getAsFloat

      public float getAsFloat()
      Description copied from interface: ICustomProperty
      Retrieves the value of the property as a float.
      Specified by:
      getAsFloat in interface ICustomProperty
      Returns:
      the property value as a float
    • getAsDouble

      public double getAsDouble()
      Description copied from interface: ICustomProperty
      Retrieves the value of the property as a double.
      Specified by:
      getAsDouble in interface ICustomProperty
      Returns:
      the property value as a double
    • getAsByte

      public byte getAsByte()
      Description copied from interface: ICustomProperty
      Retrieves the value of the property as a byte.
      Specified by:
      getAsByte in interface ICustomProperty
      Returns:
      the property value as a byte
    • getAsShort

      public short getAsShort()
      Description copied from interface: ICustomProperty
      Retrieves the value of the property as a short.
      Specified by:
      getAsShort in interface ICustomProperty
      Returns:
      the property value as a short
    • getAsInt

      public int getAsInt()
      Description copied from interface: ICustomProperty
      Retrieves the value of the property as an int.
      Specified by:
      getAsInt in interface ICustomProperty
      Returns:
      the property value as an int
    • getAsLong

      public long getAsLong()
      Description copied from interface: ICustomProperty
      Retrieves the value of the property as a long.
      Specified by:
      getAsLong in interface ICustomProperty
      Returns:
      the property value as a long
    • getAsEnum

      public <T extends Enum<T>> T getAsEnum(Class<T> enumType)
      Description copied from interface: ICustomProperty
      Retrieves the value of the property as an Enum.
      Specified by:
      getAsEnum in interface ICustomProperty
      Type Parameters:
      T - the type of the Enum
      Parameters:
      enumType - the Class of the Enum type
      Returns:
      the property value as an Enum
    • getAsFile

      public URL getAsFile()
      Description copied from interface: ICustomProperty
      Retrieves the value of the property as a URL.
      Specified by:
      getAsFile in interface ICustomProperty
      Returns:
      the property value as a URL
    • getMapObjectId

      public int getMapObjectId()
      Description copied from interface: ICustomProperty
      Retrieves the map object ID associated with this property.
      Specified by:
      getMapObjectId in interface ICustomProperty
      Returns:
      the map object ID
    • getType

      public String getType()
      Description copied from interface: ICustomProperty
      Retrieves the type of the property.
      Specified by:
      getType in interface ICustomProperty
      Returns:
      the property type as a String
    • setType

      public void setType(String type)
      Description copied from interface: ICustomProperty
      Sets the type of the property.
      Specified by:
      setType in interface ICustomProperty
      Parameters:
      type - the property type as a String
    • equals

      public boolean equals(Object anObject)
      Description copied from interface: ICustomProperty
      Tests for equality between two custom properties. Two custom properties are equal if they both have the same type and string value.
      Specified by:
      equals in interface ICustomProperty
      Overrides:
      equals in class Object
      Parameters:
      anObject - the custom property to test equality for
      Returns:
      true if the two custom properties are equal, or false otherwise
    • hashCode

      public int hashCode()
      Description copied from interface: ICustomProperty
      Returns the hash code for this custom property. The hash code for a custom property is equal to its type's hash code times 31 plus its value's hash code.
      Specified by:
      hashCode in interface ICustomProperty
      Overrides:
      hashCode in class Object
      Returns:
      the hash code for this custom property
    • toString

      public String toString()
      Overrides:
      toString in class Object