Class CustomProperty
java.lang.Object
de.gurkenlabs.litiengine.environment.tilemap.xml.CustomProperty
- All Implemented Interfaces:
ICustomProperty
public class CustomProperty
extends java.lang.Object
implements ICustomProperty
Constructor Summary
Constructors Constructor Description CustomProperty()
Instantiates a newCustomProperty
instance.CustomProperty(ICustomProperty propertyToBeCopied)
Instantiates a newCustomProperty
instance by copying from the specified instance.CustomProperty(java.lang.String value)
Instantiates a newCustomProperty
instance.CustomProperty(java.lang.String type, java.lang.String value)
Instantiates a newCustomProperty
instance.CustomProperty(java.net.URL location)
Instantiates a newCustomProperty
instance.Method Summary
Modifier and Type Method Description boolean
equals(java.lang.Object anObject)
Tests for equality between two custom properties.boolean
getAsBool()
byte
getAsByte()
char
getAsChar()
java.awt.Color
getAsColor()
double
getAsDouble()
<T extends java.lang.Enum<T>>
TgetAsEnum(java.lang.Class<T> enumType)
java.net.URL
getAsFile()
float
getAsFloat()
int
getAsInt()
long
getAsLong()
short
getAsShort()
java.lang.String
getAsString()
java.lang.String
getType()
int
hashCode()
Returns the hash code for this custom property.void
setType(java.lang.String type)
void
setValue(boolean value)
void
setValue(char value)
void
setValue(double value)
void
setValue(long value)
void
setValue(java.awt.Color value)
void
setValue(java.lang.Enum<?> value)
void
setValue(java.lang.String value)
void
setValue(java.net.URL location)
java.lang.String
toString()
Constructor Details
CustomProperty
public CustomProperty()Instantiates a newCustomProperty
instance.The default type for a custom property is
string
if not explicitly specified.CustomProperty
public CustomProperty(java.lang.String value)Instantiates a newCustomProperty
instance.- Parameters:
value
- The value of this custom property.
CustomProperty
public CustomProperty(java.lang.String type, java.lang.String value)Instantiates a newCustomProperty
instance.- Parameters:
type
- The type of this custom property.value
- The value of this custom property.
CustomProperty
public CustomProperty(java.net.URL location)Instantiates a newCustomProperty
instance.- Parameters:
location
- The location of the file represented by this custom property.
CustomProperty
Instantiates a newCustomProperty
instance by copying from the specified instance.- Parameters:
propertyToBeCopied
- The property to be copied.
Method Details
setValue
public void setValue(java.net.URL location)- Specified by:
setValue
in interfaceICustomProperty
setValue
public void setValue(java.lang.String value)- Specified by:
setValue
in interfaceICustomProperty
setValue
public void setValue(char value)- Specified by:
setValue
in interfaceICustomProperty
setValue
public void setValue(java.lang.Enum<?> value)- Specified by:
setValue
in interfaceICustomProperty
setValue
public void setValue(long value)- Specified by:
setValue
in interfaceICustomProperty
setValue
public void setValue(double value)- Specified by:
setValue
in interfaceICustomProperty
setValue
public void setValue(boolean value)- Specified by:
setValue
in interfaceICustomProperty
setValue
public void setValue(java.awt.Color value)- Specified by:
setValue
in interfaceICustomProperty
getAsString
public java.lang.String getAsString()- Specified by:
getAsString
in interfaceICustomProperty
getAsChar
public char getAsChar()- Specified by:
getAsChar
in interfaceICustomProperty
getAsBool
public boolean getAsBool()- Specified by:
getAsBool
in interfaceICustomProperty
getAsColor
public java.awt.Color getAsColor()- Specified by:
getAsColor
in interfaceICustomProperty
getAsFloat
public float getAsFloat()- Specified by:
getAsFloat
in interfaceICustomProperty
getAsDouble
public double getAsDouble()- Specified by:
getAsDouble
in interfaceICustomProperty
getAsByte
public byte getAsByte()- Specified by:
getAsByte
in interfaceICustomProperty
getAsShort
public short getAsShort()- Specified by:
getAsShort
in interfaceICustomProperty
getAsInt
public int getAsInt()- Specified by:
getAsInt
in interfaceICustomProperty
getAsLong
public long getAsLong()- Specified by:
getAsLong
in interfaceICustomProperty
getAsEnum
public <T extends java.lang.Enum<T>> T getAsEnum(java.lang.Class<T> enumType)- Specified by:
getAsEnum
in interfaceICustomProperty
getAsFile
public java.net.URL getAsFile()- Specified by:
getAsFile
in interfaceICustomProperty
getType
public java.lang.String getType()- Specified by:
getType
in interfaceICustomProperty
setType
public void setType(java.lang.String type)- Specified by:
setType
in interfaceICustomProperty
equals
public boolean equals(java.lang.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 interfaceICustomProperty
- Overrides:
equals
in classjava.lang.Object
- Parameters:
anObject
- The custom property to test equality for- Returns:
- Whether the two custom properties are equal, or false
if
anObject
is not a custom property
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 interfaceICustomProperty
- Overrides:
hashCode
in classjava.lang.Object
- Returns:
- The hash code for this custom property
toString
public java.lang.String toString()- Overrides:
toString
in classjava.lang.Object