Class CustomPropertyProvider
java.lang.Object
de.gurkenlabs.litiengine.environment.tilemap.xml.CustomPropertyProvider
- All Implemented Interfaces:
ICustomPropertyProvider
- Direct Known Subclasses:
GameInfo,Layer,MapImage,MapObject,Material,Terrain,Tile,Tileset,TilesetEntry,TmxMap
public class CustomPropertyProvider
extends java.lang.Object
implements ICustomPropertyProviderConstructor Summary
Constructors Constructor Description CustomPropertyProvider()CustomPropertyProvider(ICustomPropertyProvider propertyProviderToBeCopied)Copy Constructor for copying instances of CustomPropertyProviders.Method Summary
Modifier and Type Method Description booleangetBoolValue(java.lang.String propertyName)Gets the boolean value of the custom property with the provided name.booleangetBoolValue(java.lang.String propertyName, boolean defaultValue)Gets the boolean value of the custom property with the provided name.bytegetByteValue(java.lang.String propertyName)Gets the byte value of the custom property with the provided name.bytegetByteValue(java.lang.String propertyName, byte defaultValue)Gets the byte value of the custom property with the provided name.java.awt.ColorgetColorValue(java.lang.String propertyName)Gets the color value of the custom property with the provided name.java.awt.ColorgetColorValue(java.lang.String propertyName, java.awt.Color defaultValue)Gets the color value of the custom property with the provided name.java.util.List<java.lang.String>getCommaSeparatedStringValues(java.lang.String propertyName, java.lang.String defaultValue)Gets a list of strings stored in a single comma-separated property.doublegetDoubleValue(java.lang.String propertyName)Gets the double value of the custom property with the provided name.doublegetDoubleValue(java.lang.String propertyName, double defaultValue)Gets the double value of the custom property with the provided name.<T extends java.lang.Enum<T>>
TgetEnumValue(java.lang.String propertyName, java.lang.Class<T> enumType)Gets the enum value of the custom property with the provided name.<T extends java.lang.Enum<T>>
TgetEnumValue(java.lang.String propertyName, java.lang.Class<T> enumType, T defaultValue)Gets the enum value of the custom property with the provided name.java.net.URLgetFileValue(java.lang.String propertyName)Gets the file value of the custom property with the provided name.java.net.URLgetFileValue(java.lang.String propertyName, java.net.URL defaultValue)Gets the file value of the custom property with the provided name.floatgetFloatValue(java.lang.String propertyName)Gets the float value of the custom property with the provided name.floatgetFloatValue(java.lang.String propertyName, float defaultValue)Gets the float value of the custom property with the provided name.intgetIntValue(java.lang.String propertyName)Gets the int value of the custom property with the provided name.intgetIntValue(java.lang.String propertyName, int defaultValue)Gets the int value of the custom property with the provided name.longgetLongValue(java.lang.String propertyName, long defaultValue)Gets the long value of the custom property with the provided name.java.util.Map<java.lang.String,ICustomProperty>getProperties()Returns aMapview of the custom properties for thisICustomPropertyProvider.ICustomPropertygetProperty(java.lang.String propertyName)shortgetShortValue(java.lang.String propertyName)Gets the short value of the custom property with the provided name.shortgetShortValue(java.lang.String propertyName, short defaultValue)Gets the short value of the custom property with the provided name.java.lang.StringgetStringValue(java.lang.String propertyName)Gets the string value of the custom property with the provided name.java.lang.StringgetStringValue(java.lang.String propertyName, java.lang.String defaultValue)Gets the string value of the custom property with the provided name.java.lang.StringgetTypeOfProperty(java.lang.String propertyName)booleanhasCustomProperty(java.lang.String propertyName)Checks if a custom property with the given name is present.voidremoveProperty(java.lang.String propertyName)voidsetProperties(java.util.Map<java.lang.String,ICustomProperty> props)Sets all of the custom properties on this object to the provided values.voidsetTypeOfProperty(java.lang.String propertyName, java.lang.String type)voidsetValue(java.lang.String propertyName, boolean value)Sets the value for the custom property with the given name to the given boolean.voidsetValue(java.lang.String propertyName, byte value)Sets the value for the custom property with the given name to the given byte.voidsetValue(java.lang.String propertyName, double value)Sets the value for the custom property with the given name to the given double.voidsetValue(java.lang.String propertyName, float value)Sets the value for the custom property with the given name to the given float.voidsetValue(java.lang.String propertyName, int value)Sets the value for the custom property with the given name to the given int.voidsetValue(java.lang.String propertyName, long value)Sets the value for the custom property with the given name to the given long.voidsetValue(java.lang.String propertyName, short value)Sets the value for the custom property with the given name to the given short.voidsetValue(java.lang.String propertyName, ICustomProperty value)voidsetValue(java.lang.String propertyName, java.awt.Color value)Sets the value for the custom property with the given name to the given color.voidsetValue(java.lang.String propertyName, java.lang.Enum<?> value)Sets the value for the custom property with the given name to the given enum.voidsetValue(java.lang.String propertyName, java.lang.String value)Sets the value for the custom property with the given name to the given string.voidsetValue(java.lang.String propertyName, java.net.URL value)Sets the value for the custom property with the given name to the given file.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface de.gurkenlabs.litiengine.environment.tilemap.ICustomPropertyProvider
getLongValue
Constructor Details
CustomPropertyProvider
public CustomPropertyProvider()CustomPropertyProvider
Copy Constructor for copying instances of CustomPropertyProviders.- Parameters:
propertyProviderToBeCopied- the PropertyProvider we want to copy
Method Details
getProperties
Description copied from interface:ICustomPropertyProviderReturns aMapview of the custom properties for thisICustomPropertyProvider.- Specified by:
getPropertiesin interfaceICustomPropertyProvider- Returns:
- a
Mapview of the custom properties for thisICustomPropertyProvider
hasCustomProperty
public boolean hasCustomProperty(java.lang.String propertyName)Description copied from interface:ICustomPropertyProviderChecks if a custom property with the given name is present.- Specified by:
hasCustomPropertyin interfaceICustomPropertyProvider- Parameters:
propertyName- the name of the custom property- Returns:
- true if a custom property with the given name is present. False otherwise.
getTypeOfProperty
public java.lang.String getTypeOfProperty(java.lang.String propertyName)- Specified by:
getTypeOfPropertyin interfaceICustomPropertyProvider
setTypeOfProperty
public void setTypeOfProperty(java.lang.String propertyName, java.lang.String type)- Specified by:
setTypeOfPropertyin interfaceICustomPropertyProvider
getProperty
- Specified by:
getPropertyin interfaceICustomPropertyProvider
setValue
- Specified by:
setValuein interfaceICustomPropertyProvider
getStringValue
public java.lang.String getStringValue(java.lang.String propertyName)Description copied from interface:ICustomPropertyProviderGets the string value of the custom property with the provided name.- Specified by:
getStringValuein interfaceICustomPropertyProvider- Parameters:
propertyName- the name of the custom property- Returns:
- the string value of the custom property
getStringValue
public java.lang.String getStringValue(java.lang.String propertyName, java.lang.String defaultValue)Description copied from interface:ICustomPropertyProviderGets the string value of the custom property with the provided name. If the value is null, the provided default value is used as a fallback.- Specified by:
getStringValuein interfaceICustomPropertyProvider- Parameters:
propertyName- the name of the custom propertydefaultValue- the fallback value in case the property value is null.- Returns:
- the string value of the custom property, if present. Otherwise, the provided default value is returned.
getIntValue
public int getIntValue(java.lang.String propertyName)Description copied from interface:ICustomPropertyProviderGets the int value of the custom property with the provided name.- Specified by:
getIntValuein interfaceICustomPropertyProvider- Parameters:
propertyName- the name of the custom property- Returns:
- the int value of the custom property
getIntValue
public int getIntValue(java.lang.String propertyName, int defaultValue)Description copied from interface:ICustomPropertyProviderGets the int value of the custom property with the provided name. If the value is null, the provided default value is used as a fallback.- Specified by:
getIntValuein interfaceICustomPropertyProvider- Parameters:
propertyName- the name of the custom propertydefaultValue- the fallback value in case the property value is null.- Returns:
- the int value of the custom property, if present. Otherwise, the provided default value is returned.
getLongValue
public long getLongValue(java.lang.String propertyName, long defaultValue)Description copied from interface:ICustomPropertyProviderGets the long value of the custom property with the provided name. If the value is null, the provided default value is used as a fallback.- Specified by:
getLongValuein interfaceICustomPropertyProvider- Parameters:
propertyName- the name of the custom propertydefaultValue- the fallback value in case the property value is null.- Returns:
- the long value of the custom property, if present. Otherwise, the provided default value is returned.
getShortValue
public short getShortValue(java.lang.String propertyName)Description copied from interface:ICustomPropertyProviderGets the short value of the custom property with the provided name.- Specified by:
getShortValuein interfaceICustomPropertyProvider- Parameters:
propertyName- the name of the custom property- Returns:
- the short value of the custom property
getShortValue
public short getShortValue(java.lang.String propertyName, short defaultValue)Description copied from interface:ICustomPropertyProviderGets the short value of the custom property with the provided name. If the value is null, the provided default value is used as a fallback.- Specified by:
getShortValuein interfaceICustomPropertyProvider- Parameters:
propertyName- the name of the custom propertydefaultValue- the fallback value in case the property value is null.- Returns:
- the short value of the custom property, if present. Otherwise, the provided default value is returned.
getByteValue
public byte getByteValue(java.lang.String propertyName)Description copied from interface:ICustomPropertyProviderGets the byte value of the custom property with the provided name.- Specified by:
getByteValuein interfaceICustomPropertyProvider- Parameters:
propertyName- the name of the custom property- Returns:
- the byte value of the custom property
getByteValue
public byte getByteValue(java.lang.String propertyName, byte defaultValue)Description copied from interface:ICustomPropertyProviderGets the byte value of the custom property with the provided name. If the value is null, the provided default value is used as a fallback.- Specified by:
getByteValuein interfaceICustomPropertyProvider- Parameters:
propertyName- the name of the custom propertydefaultValue- the fallback value in case the property value is null.- Returns:
- the byte value of the custom property, if present. Otherwise, the provided default value is returned.
getBoolValue
public boolean getBoolValue(java.lang.String propertyName)Description copied from interface:ICustomPropertyProviderGets the boolean value of the custom property with the provided name.- Specified by:
getBoolValuein interfaceICustomPropertyProvider- Parameters:
propertyName- the name of the custom property- Returns:
- the boolean value of the custom property
getBoolValue
public boolean getBoolValue(java.lang.String propertyName, boolean defaultValue)Description copied from interface:ICustomPropertyProviderGets the boolean value of the custom property with the provided name. If the value is null, the provided default value is used as a fallback.- Specified by:
getBoolValuein interfaceICustomPropertyProvider- Parameters:
propertyName- the name of the custom propertydefaultValue- the fallback value in case the property value is null.- Returns:
- the boolean value of the custom property, if present. Otherwise, the provided default value is returned.
getFloatValue
public float getFloatValue(java.lang.String propertyName)Description copied from interface:ICustomPropertyProviderGets the float value of the custom property with the provided name.- Specified by:
getFloatValuein interfaceICustomPropertyProvider- Parameters:
propertyName- the name of the custom property- Returns:
- the float value of the custom property
getFloatValue
public float getFloatValue(java.lang.String propertyName, float defaultValue)Description copied from interface:ICustomPropertyProviderGets the float value of the custom property with the provided name. If the value is null, the provided default value is used as a fallback.- Specified by:
getFloatValuein interfaceICustomPropertyProvider- Parameters:
propertyName- the name of the custom propertydefaultValue- the fallback value in case the property value is null.- Returns:
- the float value of the custom property, if present. Otherwise, the provided default value is returned.
getDoubleValue
public double getDoubleValue(java.lang.String propertyName)Description copied from interface:ICustomPropertyProviderGets the double value of the custom property with the provided name.- Specified by:
getDoubleValuein interfaceICustomPropertyProvider- Parameters:
propertyName- the name of the custom property- Returns:
- the double value of the custom property
getDoubleValue
public double getDoubleValue(java.lang.String propertyName, double defaultValue)Description copied from interface:ICustomPropertyProviderGets the double value of the custom property with the provided name. If the value is null, the provided default value is used as a fallback.- Specified by:
getDoubleValuein interfaceICustomPropertyProvider- Parameters:
propertyName- the name of the custom propertydefaultValue- the fallback value in case the property value is null.- Returns:
- the double value of the custom property, if present. Otherwise, the provided default value is returned.
getColorValue
public java.awt.Color getColorValue(java.lang.String propertyName)Description copied from interface:ICustomPropertyProviderGets the color value of the custom property with the provided name.- Specified by:
getColorValuein interfaceICustomPropertyProvider- Parameters:
propertyName- the name of the custom property- Returns:
- the color value of the custom property
getColorValue
public java.awt.Color getColorValue(java.lang.String propertyName, java.awt.Color defaultValue)Description copied from interface:ICustomPropertyProviderGets the color value of the custom property with the provided name. If the value is null, the provided default value is used as a fallback.- Specified by:
getColorValuein interfaceICustomPropertyProvider- Parameters:
propertyName- the name of the custom propertydefaultValue- the fallback value in case the property value is null.- Returns:
- the color value of the custom property, if present. Otherwise, the provided default value is returned.
getEnumValue
public <T extends java.lang.Enum<T>> T getEnumValue(java.lang.String propertyName, java.lang.Class<T> enumType)Description copied from interface:ICustomPropertyProviderGets the enum value of the custom property with the provided name.- Specified by:
getEnumValuein interfaceICustomPropertyProvider- Type Parameters:
T- the enum type to use- Parameters:
propertyName- the name of the custom propertyenumType- aClassobject for<T>- Returns:
- the enum value of the custom property
getEnumValue
public <T extends java.lang.Enum<T>> T getEnumValue(java.lang.String propertyName, java.lang.Class<T> enumType, T defaultValue)Description copied from interface:ICustomPropertyProviderGets the enum value of the custom property with the provided name. If the value is null, the provided default value is used as a fallback.- Specified by:
getEnumValuein interfaceICustomPropertyProvider- Type Parameters:
T- the enum type to use- Parameters:
propertyName- the name of the custom propertyenumType- aClassobject for<T>defaultValue- the fallback value in case the property value is null.- Returns:
- the enum value of the custom property, if present. Otherwise, the provided default value is returned.
getFileValue
public java.net.URL getFileValue(java.lang.String propertyName)Description copied from interface:ICustomPropertyProviderGets the file value of the custom property with the provided name. If the property is not a file,nullis returned instead.- Specified by:
getFileValuein interfaceICustomPropertyProvider- Parameters:
propertyName- the name of the custom property- Returns:
- the file value of the custom property, if present.
getFileValue
public java.net.URL getFileValue(java.lang.String propertyName, java.net.URL defaultValue)Description copied from interface:ICustomPropertyProviderGets the file value of the custom property with the provided name. If the value is null or the property is not a file, the provided default value is used as a fallback.- Specified by:
getFileValuein interfaceICustomPropertyProvider- Parameters:
propertyName- the name of the custom propertydefaultValue- the fallback value in case the property value is null.- Returns:
- the file value of the custom property, if present. Otherwise, the provided default value is returned.
setValue
public void setValue(java.lang.String propertyName, java.net.URL value)Description copied from interface:ICustomPropertyProviderSets the value for the custom property with the given name to the given file.- Specified by:
setValuein interfaceICustomPropertyProvider- Parameters:
propertyName- the name of the custom propertyvalue- the new value
setValue
public void setValue(java.lang.String propertyName, java.lang.String value)Description copied from interface:ICustomPropertyProviderSets the value for the custom property with the given name to the given string.- Specified by:
setValuein interfaceICustomPropertyProvider- Parameters:
propertyName- the name of the custom propertyvalue- the new value
setValue
public void setValue(java.lang.String propertyName, boolean value)Description copied from interface:ICustomPropertyProviderSets the value for the custom property with the given name to the given boolean.- Specified by:
setValuein interfaceICustomPropertyProvider- Parameters:
propertyName- the name of the custom propertyvalue- the new value
setValue
public void setValue(java.lang.String propertyName, byte value)Description copied from interface:ICustomPropertyProviderSets the value for the custom property with the given name to the given byte.- Specified by:
setValuein interfaceICustomPropertyProvider- Parameters:
propertyName- the name of the custom propertyvalue- the new value
setValue
public void setValue(java.lang.String propertyName, short value)Description copied from interface:ICustomPropertyProviderSets the value for the custom property with the given name to the given short.- Specified by:
setValuein interfaceICustomPropertyProvider- Parameters:
propertyName- the name of the custom propertyvalue- the new value
setValue
public void setValue(java.lang.String propertyName, int value)Description copied from interface:ICustomPropertyProviderSets the value for the custom property with the given name to the given int.- Specified by:
setValuein interfaceICustomPropertyProvider- Parameters:
propertyName- the name of the custom propertyvalue- the new value
setValue
public void setValue(java.lang.String propertyName, long value)Description copied from interface:ICustomPropertyProviderSets the value for the custom property with the given name to the given long.- Specified by:
setValuein interfaceICustomPropertyProvider- Parameters:
propertyName- the name of the custom propertyvalue- the new value
setValue
public void setValue(java.lang.String propertyName, float value)Description copied from interface:ICustomPropertyProviderSets the value for the custom property with the given name to the given float.- Specified by:
setValuein interfaceICustomPropertyProvider- Parameters:
propertyName- the name of the custom propertyvalue- the new value
setValue
public void setValue(java.lang.String propertyName, double value)Description copied from interface:ICustomPropertyProviderSets the value for the custom property with the given name to the given double.- Specified by:
setValuein interfaceICustomPropertyProvider- Parameters:
propertyName- the name of the custom propertyvalue- the new value
setValue
public void setValue(java.lang.String propertyName, java.awt.Color value)Description copied from interface:ICustomPropertyProviderSets the value for the custom property with the given name to the given color.- Specified by:
setValuein interfaceICustomPropertyProvider- Parameters:
propertyName- the name of the custom propertyvalue- the new value
setValue
public void setValue(java.lang.String propertyName, java.lang.Enum<?> value)Description copied from interface:ICustomPropertyProviderSets the value for the custom property with the given name to the given enum.- Specified by:
setValuein interfaceICustomPropertyProvider- Parameters:
propertyName- the name of the custom propertyvalue- the new value
setProperties
Description copied from interface:ICustomPropertyProviderSets all of the custom properties on this object to the provided values. Properties are added when they only exist in the provided properties, and deleted when they only exist in the current properties.- Specified by:
setPropertiesin interfaceICustomPropertyProvider- Parameters:
props- the new list of properties
removeProperty
public void removeProperty(java.lang.String propertyName)- Specified by:
removePropertyin interfaceICustomPropertyProvider
getCommaSeparatedStringValues
public java.util.List<java.lang.String> getCommaSeparatedStringValues(java.lang.String propertyName, java.lang.String defaultValue)Description copied from interface:ICustomPropertyProviderGets a list of strings stored in a single comma-separated property.- Specified by:
getCommaSeparatedStringValuesin interfaceICustomPropertyProvider- Parameters:
propertyName- the name of the custom propertydefaultValue- the fallback value in case the property value is null.- Returns:
- the list of comma-separated strings in the custom property, if present. Otherwise, the provided default value is returned.
