Class CustomProperty
- All Implemented Interfaces:
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 Summary
ConstructorsConstructorDescriptionInstantiates a newCustomPropertyinstance.CustomProperty(ICustomProperty propertyToBeCopied) Instantiates a newCustomPropertyinstance by copying from the specified instance.CustomProperty(String value) Instantiates a newCustomPropertyinstance.CustomProperty(String type, String value) Instantiates a newCustomPropertyinstance.CustomProperty(URL location) Instantiates a newCustomPropertyinstance. -
Method Summary
Modifier and TypeMethodDescriptionbooleanTests for equality between two custom properties.booleanRetrieves the value of the property as aboolean.byteRetrieves the value of the property as abyte.charRetrieves the value of the property as achar.Retrieves the value of the property as aColor.doubleRetrieves the value of the property as adouble.<T extends Enum<T>>
TRetrieves the value of the property as anEnum.Retrieves the value of the property as aURL.floatRetrieves the value of the property as afloat.intgetAsInt()Retrieves the value of the property as anint.longRetrieves the value of the property as along.shortRetrieves the value of the property as ashort.Retrieves the value of the property as aString.intRetrieves the map object ID associated with this property.getType()Retrieves the type of the property.inthashCode()Returns the hash code for this custom property.voidSets the type of the property.voidsetValue(boolean value) Sets the value of the property as aboolean.voidsetValue(char value) Sets the value of the property as achar.voidsetValue(double value) Sets the value of the property as adouble.voidsetValue(long value) Sets the value of the property as along.voidSets the value of the property as aColor.voidSets the value of the property as anEnum.voidSets the value of the property as aString.voidSets the value of the property as aURL.toString()
-
Constructor Details
-
CustomProperty
public CustomProperty()Instantiates a new
CustomPropertyinstance.The default type for a custom property is
stringif not explicitly specified. -
CustomProperty
Instantiates a newCustomPropertyinstance.- Parameters:
value- The value of this custom property.
-
CustomProperty
-
CustomProperty
Instantiates a newCustomPropertyinstance.- Parameters:
location- The location of the file represented by this custom property.
-
CustomProperty
Instantiates a newCustomPropertyinstance by copying from the specified instance.- Parameters:
propertyToBeCopied- The property to be copied.
-
-
Method Details
-
setValue
Description copied from interface:ICustomPropertySets the value of the property as aURL.- Specified by:
setValuein interfaceICustomProperty- Parameters:
location- theURLvalue to set
-
setValue
Description copied from interface:ICustomPropertySets the value of the property as aString.- Specified by:
setValuein interfaceICustomProperty- Parameters:
value- theStringvalue to set
-
setValue
public void setValue(char value) Description copied from interface:ICustomPropertySets the value of the property as achar.- Specified by:
setValuein interfaceICustomProperty- Parameters:
value- thecharvalue to set
-
setValue
Description copied from interface:ICustomPropertySets the value of the property as anEnum.- Specified by:
setValuein interfaceICustomProperty- Parameters:
value- theEnumvalue to set
-
setValue
public void setValue(long value) Description copied from interface:ICustomPropertySets the value of the property as along.- Specified by:
setValuein interfaceICustomProperty- Parameters:
value- thelongvalue to set
-
setValue
public void setValue(double value) Description copied from interface:ICustomPropertySets the value of the property as adouble.- Specified by:
setValuein interfaceICustomProperty- Parameters:
value- thedoublevalue to set
-
setValue
public void setValue(boolean value) Description copied from interface:ICustomPropertySets the value of the property as aboolean.- Specified by:
setValuein interfaceICustomProperty- Parameters:
value- thebooleanvalue to set
-
setValue
Description copied from interface:ICustomPropertySets the value of the property as aColor.- Specified by:
setValuein interfaceICustomProperty- Parameters:
value- theColorvalue to set
-
getAsString
Description copied from interface:ICustomPropertyRetrieves the value of the property as aString.- Specified by:
getAsStringin interfaceICustomProperty- Returns:
- the property value as a
String
-
getAsChar
public char getAsChar()Description copied from interface:ICustomPropertyRetrieves the value of the property as achar.- Specified by:
getAsCharin interfaceICustomProperty- Returns:
- the property value as a
char
-
getAsBool
public boolean getAsBool()Description copied from interface:ICustomPropertyRetrieves the value of the property as aboolean.- Specified by:
getAsBoolin interfaceICustomProperty- Returns:
- the property value as a
boolean
-
getAsColor
Description copied from interface:ICustomPropertyRetrieves the value of the property as aColor.- Specified by:
getAsColorin interfaceICustomProperty- Returns:
- the property value as a
Color
-
getAsFloat
public float getAsFloat()Description copied from interface:ICustomPropertyRetrieves the value of the property as afloat.- Specified by:
getAsFloatin interfaceICustomProperty- Returns:
- the property value as a
float
-
getAsDouble
public double getAsDouble()Description copied from interface:ICustomPropertyRetrieves the value of the property as adouble.- Specified by:
getAsDoublein interfaceICustomProperty- Returns:
- the property value as a
double
-
getAsByte
public byte getAsByte()Description copied from interface:ICustomPropertyRetrieves the value of the property as abyte.- Specified by:
getAsBytein interfaceICustomProperty- Returns:
- the property value as a
byte
-
getAsShort
public short getAsShort()Description copied from interface:ICustomPropertyRetrieves the value of the property as ashort.- Specified by:
getAsShortin interfaceICustomProperty- Returns:
- the property value as a
short
-
getAsInt
public int getAsInt()Description copied from interface:ICustomPropertyRetrieves the value of the property as anint.- Specified by:
getAsIntin interfaceICustomProperty- Returns:
- the property value as an
int
-
getAsLong
public long getAsLong()Description copied from interface:ICustomPropertyRetrieves the value of the property as along.- Specified by:
getAsLongin interfaceICustomProperty- Returns:
- the property value as a
long
-
getAsEnum
Description copied from interface:ICustomPropertyRetrieves the value of the property as anEnum. -
getAsFile
Description copied from interface:ICustomPropertyRetrieves the value of the property as aURL.- Specified by:
getAsFilein interfaceICustomProperty- Returns:
- the property value as a
URL
-
getMapObjectId
public int getMapObjectId()Description copied from interface:ICustomPropertyRetrieves the map object ID associated with this property.- Specified by:
getMapObjectIdin interfaceICustomProperty- Returns:
- the map object ID
-
getType
Description copied from interface:ICustomPropertyRetrieves the type of the property.- Specified by:
getTypein interfaceICustomProperty- Returns:
- the property type as a
String
-
setType
Description copied from interface:ICustomPropertySets the type of the property.- Specified by:
setTypein interfaceICustomProperty- Parameters:
type- the property type as aString
-
equals
Description copied from interface:ICustomPropertyTests for equality between two custom properties. Two custom properties are equal if they both have the same type and string value.- Specified by:
equalsin interfaceICustomProperty- Overrides:
equalsin classObject- Parameters:
anObject- the custom property to test equality for- Returns:
trueif the two custom properties are equal, orfalseotherwise
-
hashCode
public int hashCode()Description copied from interface:ICustomPropertyReturns 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:
hashCodein interfaceICustomProperty- Overrides:
hashCodein classObject- Returns:
- the hash code for this custom property
-
toString
-