Interface ICustomPropertyProvider
- All Known Subinterfaces:
IGroupLayer,IImageLayer,ILayer,ILayerList,IMap,IMapImage,IMapObject,IMapObjectLayer,ITerrain,ITile,ITileLayer,ITileset,ITilesetEntry
- All Known Implementing Classes:
Blueprint,CustomPropertyProvider,GameInfo,GroupLayer,ImageLayer,Layer,MapImage,MapObject,MapObjectLayer,Material,Terrain,Tile,TileLayer,Tileset,TilesetEntry,TmxMap
public interface ICustomPropertyProviderThe Interface ICustomPropertyProvider is providing methods to get and set custom properties.
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.default longgetLongValue(java.lang.String propertyName)Gets the long 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.
Method Details
hasCustomProperty
boolean hasCustomProperty(java.lang.String propertyName)Checks if a custom property with the given name is present.- Parameters:
propertyName- the name of the custom property- Returns:
- true if a custom property with the given name is present. False otherwise.
getTypeOfProperty
java.lang.String getTypeOfProperty(java.lang.String propertyName)setTypeOfProperty
void setTypeOfProperty(java.lang.String propertyName, java.lang.String type)getProperty
setValue
removeProperty
void removeProperty(java.lang.String propertyName)getStringValue
java.lang.String getStringValue(java.lang.String propertyName)Gets the string value of the custom property with the provided name.- Parameters:
propertyName- the name of the custom property- Returns:
- the string value of the custom property
- Throws:
java.util.NoSuchElementException- if the custom property does not exist
getStringValue
java.lang.String getStringValue(java.lang.String propertyName, java.lang.String defaultValue)Gets 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.- 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.
getCommaSeparatedStringValues
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.- 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.
getIntValue
int getIntValue(java.lang.String propertyName)Gets the int value of the custom property with the provided name.- Parameters:
propertyName- the name of the custom property- Returns:
- the int value of the custom property
- Throws:
java.util.NoSuchElementException- if the custom property does not existjava.lang.NumberFormatException- if the custom property is not an integer or is not in range for anint
getIntValue
int getIntValue(java.lang.String propertyName, int defaultValue)Gets 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.- 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
default long getLongValue(java.lang.String propertyName)Gets the long value of the custom property with the provided name.- Parameters:
propertyName- the name of the custom property- Returns:
- the long value of the custom property
- Throws:
java.util.NoSuchElementException- if the custom property does not existjava.lang.NumberFormatException- if the custom property is not an integer or is not in range for along
getLongValue
long getLongValue(java.lang.String propertyName, long defaultValue)Gets 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.- 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
short getShortValue(java.lang.String propertyName)Gets the short value of the custom property with the provided name.- Parameters:
propertyName- the name of the custom property- Returns:
- the short value of the custom property
- Throws:
java.util.NoSuchElementException- if the custom property does not existjava.lang.NumberFormatException- if the custom property is not an integer or is out of range for ashort
getShortValue
short getShortValue(java.lang.String propertyName, short defaultValue)Gets 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.- 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
byte getByteValue(java.lang.String propertyName)Gets the byte value of the custom property with the provided name.- Parameters:
propertyName- the name of the custom property- Returns:
- the byte value of the custom property
- Throws:
java.util.NoSuchElementException- if the custom property does not existjava.lang.NumberFormatException- if the custom property is not an integer or is out of range for abyte
getByteValue
byte getByteValue(java.lang.String propertyName, byte defaultValue)Gets 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.- 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
boolean getBoolValue(java.lang.String propertyName)Gets the boolean value of the custom property with the provided name.- Parameters:
propertyName- the name of the custom property- Returns:
- the boolean value of the custom property
- Throws:
java.util.NoSuchElementException- if the custom property does not existjava.lang.NumberFormatException- if the custom property is not abooleanvalue
getBoolValue
boolean getBoolValue(java.lang.String propertyName, boolean defaultValue)Gets 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.- 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
float getFloatValue(java.lang.String propertyName)Gets the float value of the custom property with the provided name.- Parameters:
propertyName- the name of the custom property- Returns:
- the float value of the custom property
- Throws:
java.util.NoSuchElementException- if the custom property does not existjava.lang.NumberFormatException- if the custom property is not a number
getFloatValue
float getFloatValue(java.lang.String propertyName, float defaultValue)Gets 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.- 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
double getDoubleValue(java.lang.String propertyName)Gets the double value of the custom property with the provided name.- Parameters:
propertyName- the name of the custom property- Returns:
- the double value of the custom property
- Throws:
java.util.NoSuchElementException- if the custom property does not existjava.lang.NumberFormatException- if the custom property is not a number
getDoubleValue
double getDoubleValue(java.lang.String propertyName, double defaultValue)Gets 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.- 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
java.awt.Color getColorValue(java.lang.String propertyName)Gets the color value of the custom property with the provided name.- Parameters:
propertyName- the name of the custom property- Returns:
- the color value of the custom property
- Throws:
java.util.NoSuchElementException- if the custom property does not exist
getColorValue
java.awt.Color getColorValue(java.lang.String propertyName, java.awt.Color defaultValue)Gets 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.- 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
<T extends java.lang.Enum<T>> T getEnumValue(java.lang.String propertyName, java.lang.Class<T> enumType)Gets the enum value of the custom property with the provided name.- 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
- Throws:
java.util.NoSuchElementException- if the custom property does not exist
getEnumValue
<T extends java.lang.Enum<T>> T getEnumValue(java.lang.String propertyName, java.lang.Class<T> enumType, T defaultValue)Gets 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.- Type Parameters:
T- the enum type to use- Parameters:
propertyName- the name of the custom propertydefaultValue- the fallback value in case the property value is null.enumType- aClassobject for<T>- Returns:
- the enum value of the custom property, if present. Otherwise, the provided default value is returned.
getFileValue
java.net.URL getFileValue(java.lang.String propertyName)Gets the file value of the custom property with the provided name. If the property is not a file,nullis returned instead.- Parameters:
propertyName- the name of the custom property- Returns:
- the file value of the custom property, if present.
getFileValue
java.net.URL getFileValue(java.lang.String propertyName, java.net.URL defaultValue)Gets 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.- 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
void setValue(java.lang.String propertyName, java.net.URL value)Sets the value for the custom property with the given name to the given file.- Parameters:
propertyName- the name of the custom propertyvalue- the new value
setValue
void setValue(java.lang.String propertyName, java.lang.String value)Sets the value for the custom property with the given name to the given string.- Parameters:
propertyName- the name of the custom propertyvalue- the new value
setValue
void setValue(java.lang.String propertyName, boolean value)Sets the value for the custom property with the given name to the given boolean.- Parameters:
propertyName- the name of the custom propertyvalue- the new value
setValue
void setValue(java.lang.String propertyName, byte value)Sets the value for the custom property with the given name to the given byte.- Parameters:
propertyName- the name of the custom propertyvalue- the new value
setValue
void setValue(java.lang.String propertyName, short value)Sets the value for the custom property with the given name to the given short.- Parameters:
propertyName- the name of the custom propertyvalue- the new value
setValue
void setValue(java.lang.String propertyName, int value)Sets the value for the custom property with the given name to the given int.- Parameters:
propertyName- the name of the custom propertyvalue- the new value
setValue
void setValue(java.lang.String propertyName, long value)Sets the value for the custom property with the given name to the given long.- Parameters:
propertyName- the name of the custom propertyvalue- the new value
setValue
void setValue(java.lang.String propertyName, float value)Sets the value for the custom property with the given name to the given float.- Parameters:
propertyName- the name of the custom propertyvalue- the new value
setValue
void setValue(java.lang.String propertyName, double value)Sets the value for the custom property with the given name to the given double.- Parameters:
propertyName- the name of the custom propertyvalue- the new value
setValue
void setValue(java.lang.String propertyName, java.awt.Color value)Sets the value for the custom property with the given name to the given color.- Parameters:
propertyName- the name of the custom propertyvalue- the new value
setValue
void setValue(java.lang.String propertyName, java.lang.Enum<?> value)Sets the value for the custom property with the given name to the given enum.- Parameters:
propertyName- the name of the custom propertyvalue- the new value
getProperties
java.util.Map<java.lang.String,ICustomProperty> getProperties()Returns aMapview of the custom properties for thisICustomPropertyProvider.- Returns:
- a
Mapview of the custom properties for thisICustomPropertyProvider
setProperties
Sets 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.- Parameters:
props- the new list of properties
