Class CustomProperty
java.lang.Object
de.gurkenlabs.litiengine.environment.tilemap.xml.CustomProperty
- All Implemented Interfaces:
ICustomProperty
public class CustomProperty
extends java.lang.Object
implements ICustomPropertyConstructor Summary
Constructors Constructor Description CustomProperty()Instantiates a newCustomPropertyinstance.CustomProperty(ICustomProperty propertyToBeCopied)Instantiates a newCustomPropertyinstance by copying from the specified instance.CustomProperty(java.lang.String value)Instantiates a newCustomPropertyinstance.CustomProperty(java.lang.String type, java.lang.String value)Instantiates a newCustomPropertyinstance.CustomProperty(java.net.URL location)Instantiates a newCustomPropertyinstance.Method Summary
Modifier and Type Method Description booleanequals(java.lang.Object anObject)Tests for equality between two custom properties.booleangetAsBool()bytegetAsByte()chargetAsChar()java.awt.ColorgetAsColor()doublegetAsDouble()<T extends java.lang.Enum<T>>
TgetAsEnum(java.lang.Class<T> enumType)java.net.URLgetAsFile()floatgetAsFloat()intgetAsInt()longgetAsLong()shortgetAsShort()java.lang.StringgetAsString()java.lang.StringgetType()inthashCode()Returns the hash code for this custom property.voidsetType(java.lang.String type)voidsetValue(boolean value)voidsetValue(char value)voidsetValue(double value)voidsetValue(long value)voidsetValue(java.awt.Color value)voidsetValue(java.lang.Enum<?> value)voidsetValue(java.lang.String value)voidsetValue(java.net.URL location)java.lang.StringtoString()
Constructor Details
CustomProperty
public CustomProperty()Instantiates a newCustomPropertyinstance.The default type for a custom property is
stringif not explicitly specified.CustomProperty
public CustomProperty(java.lang.String value)Instantiates a newCustomPropertyinstance.- Parameters:
value- The value of this custom property.
CustomProperty
public CustomProperty(java.lang.String type, java.lang.String value)Instantiates a newCustomPropertyinstance.- Parameters:
type- The type of this custom property.value- The value of this custom property.
CustomProperty
public CustomProperty(java.net.URL location)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
public void setValue(java.net.URL location)- Specified by:
setValuein interfaceICustomProperty
setValue
public void setValue(java.lang.String value)- Specified by:
setValuein interfaceICustomProperty
setValue
public void setValue(char value)- Specified by:
setValuein interfaceICustomProperty
setValue
public void setValue(java.lang.Enum<?> value)- Specified by:
setValuein interfaceICustomProperty
setValue
public void setValue(long value)- Specified by:
setValuein interfaceICustomProperty
setValue
public void setValue(double value)- Specified by:
setValuein interfaceICustomProperty
setValue
public void setValue(boolean value)- Specified by:
setValuein interfaceICustomProperty
setValue
public void setValue(java.awt.Color value)- Specified by:
setValuein interfaceICustomProperty
getAsString
public java.lang.String getAsString()- Specified by:
getAsStringin interfaceICustomProperty
getAsChar
public char getAsChar()- Specified by:
getAsCharin interfaceICustomProperty
getAsBool
public boolean getAsBool()- Specified by:
getAsBoolin interfaceICustomProperty
getAsColor
public java.awt.Color getAsColor()- Specified by:
getAsColorin interfaceICustomProperty
getAsFloat
public float getAsFloat()- Specified by:
getAsFloatin interfaceICustomProperty
getAsDouble
public double getAsDouble()- Specified by:
getAsDoublein interfaceICustomProperty
getAsByte
public byte getAsByte()- Specified by:
getAsBytein interfaceICustomProperty
getAsShort
public short getAsShort()- Specified by:
getAsShortin interfaceICustomProperty
getAsInt
public int getAsInt()- Specified by:
getAsIntin interfaceICustomProperty
getAsLong
public long getAsLong()- Specified by:
getAsLongin interfaceICustomProperty
getAsEnum
public <T extends java.lang.Enum<T>> T getAsEnum(java.lang.Class<T> enumType)- Specified by:
getAsEnumin interfaceICustomProperty
getAsFile
public java.net.URL getAsFile()- Specified by:
getAsFilein interfaceICustomProperty
getType
public java.lang.String getType()- Specified by:
getTypein interfaceICustomProperty
setType
public void setType(java.lang.String type)- Specified by:
setTypein interfaceICustomProperty
equals
public boolean equals(java.lang.Object anObject)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 classjava.lang.Object- Parameters:
anObject- The custom property to test equality for- Returns:
- Whether the two custom properties are equal, or false
if
anObjectis not a custom property
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 classjava.lang.Object- Returns:
- The hash code for this custom property
toString
public java.lang.String toString()- Overrides:
toStringin classjava.lang.Object
