Interface ICustomPropertyProvider
- All Known Subinterfaces:
IGroupLayer,IImageLayer,ILayer,ILayerList,IMap,IMapImage,IMapObject,IMapObjectLayer,ITerrainSet,ITile,ITileLayer,ITileset,ITilesetEntry
- All Known Implementing Classes:
Blueprint,CustomPropertyProvider,GameInfo,GroupLayer,ImageLayer,Layer,MapImage,MapObject,MapObjectLayer,Material,Tile,TileLayer,Tileset,TilesetEntry,TmxMap,WangSet
public interface ICustomPropertyProvider
The Interface ICustomPropertyProvider is providing methods to get and set custom properties.
-
Method Summary
Modifier and TypeMethodDescriptionbooleangetBoolValue(String propertyName) Gets the boolean value of the custom property with the provided name.booleangetBoolValue(String propertyName, boolean defaultValue) Gets the boolean value of the custom property with the provided name.bytegetByteValue(String propertyName) Gets the byte value of the custom property with the provided name.bytegetByteValue(String propertyName, byte defaultValue) Gets the byte value of the custom property with the provided name.chargetCharValue(String propertyName) Gets the char value of the custom property with the provided name.chargetCharValue(String propertyName, char defaultValue) Gets the char value of the custom property with the provided name.getColorValue(String propertyName) Gets the color value of the custom property with the provided name.getColorValue(String propertyName, Color defaultValue) Gets the color value of the custom property with the provided name.getCommaSeparatedStringValues(String propertyName, String defaultValue) Gets a list of strings stored in a single comma-separated property.doublegetDoubleValue(String propertyName) Gets the double value of the custom property with the provided name.doublegetDoubleValue(String propertyName, double defaultValue) Gets the double value of the custom property with the provided name.<T extends Enum<T>>
TgetEnumValue(String propertyName, Class<T> enumType) Gets the enum value of the custom property with the provided name.<T extends Enum<T>>
TgetEnumValue(String propertyName, Class<T> enumType, T defaultValue) Gets the enum value of the custom property with the provided name.getFileValue(String propertyName) Gets the file value of the custom property with the provided name.getFileValue(String propertyName, URL defaultValue) Gets the file value of the custom property with the provided name.floatgetFloatValue(String propertyName) Gets the float value of the custom property with the provided name.floatgetFloatValue(String propertyName, float defaultValue) Gets the float value of the custom property with the provided name.intgetIntValue(String propertyName) Gets the int value of the custom property with the provided name.intgetIntValue(String propertyName, int defaultValue) Gets the int value of the custom property with the provided name.longgetLongValue(String propertyName) Gets the long value of the custom property with the provided name.longgetLongValue(String propertyName, long defaultValue) Gets the long value of the custom property with the provided name.intgetMapObjectId(String propertyName) Returns aMapview of the custom properties for thisICustomPropertyProvider.getProperty(String propertyName) shortgetShortValue(String propertyName) Gets the short value of the custom property with the provided name.shortgetShortValue(String propertyName, short defaultValue) Gets the short value of the custom property with the provided name.getStringValue(String propertyName) Gets the string value of the custom property with the provided name.getStringValue(String propertyName, String defaultValue) Gets the string value of the custom property with the provided name.booleanhasCustomProperty(String propertyName) Checks if a custom property with the given name is present.voidremoveProperty(String propertyName) voidsetProperties(Map<String, ICustomProperty> props) Sets all the custom properties on this object to the provided values.voidSets the value for the custom property with the given name to the given boolean.voidSets the value for the custom property with the given name to the given byte.voidSets the value for the custom property with the given name to the given char.voidSets the value for the custom property with the given name to the given double.voidSets the value for the custom property with the given name to the given float.voidSets the value for the custom property with the given name to the given int.voidSets the value for the custom property with the given name to the given long.voidSets the value for the custom property with the given name to the given short.voidsetValue(String propertyName, ICustomProperty value) voidsetValue(String propertyName, IMapObject value) Sets the value for the custom property with the ID of the given map object.voidSets the value for the custom property with the given name to the given color.voidSets the value for the custom property with the given name to the given enum.voidSets the value for the custom property with the given name to the given string.voidSets the value for the custom property with the given name to the given file.
-
Method Details
-
hasCustomProperty
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.
-
getProperty
-
setValue
-
removeProperty
-
getStringValue
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:
NoSuchElementException- if the custom property does not exist
-
getStringValue
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
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.
-
getCharValue
Gets the char value of the custom property with the provided name.- Parameters:
propertyName- the name of the custom property- Returns:
- the char value of the custom property
- Throws:
NoSuchElementException- if the custom property does not existNumberFormatException- if the custom property is not a char or is not in range for achar
-
getCharValue
Gets the char 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 char value of the custom property, if present. Otherwise, the provided default value is returned.
-
getIntValue
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:
NoSuchElementException- if the custom property does not existNumberFormatException- if the custom property is not an integer or is not in range for anint
-
getIntValue
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
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:
NoSuchElementException- if the custom property does not existNumberFormatException- if the custom property is not an integer or is not in range for along
-
getLongValue
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
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:
NoSuchElementException- if the custom property does not existNumberFormatException- if the custom property is not an integer or is out of range for ashort
-
getShortValue
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
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:
NoSuchElementException- if the custom property does not existNumberFormatException- if the custom property is not an integer or is out of range for abyte
-
getByteValue
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
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:
NoSuchElementException- if the custom property does not existNumberFormatException- if the custom property is not abooleanvalue
-
getBoolValue
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
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:
NoSuchElementException- if the custom property does not existNumberFormatException- if the custom property is not a number
-
getFloatValue
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
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:
NoSuchElementException- if the custom property does not existNumberFormatException- if the custom property is not a number
-
getDoubleValue
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
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:
NoSuchElementException- if the custom property does not exist
-
getColorValue
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
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:
NoSuchElementException- if the custom property does not exist
-
getEnumValue
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 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
-
getFileValue
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.
-
getMapObjectId
-
setValue
-
setValue
-
setValue
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
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
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
Sets the value for the custom property with the given name to the given char.- Parameters:
propertyName- the name of the custom propertyvalue- the new value
-
setValue
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
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
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
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
-
setValue
-
setValue
Sets the value for the custom property with the ID of the given map object.- Parameters:
propertyName- the name of the custom propertyvalue- the new value
-
getProperties
Map<String,ICustomProperty> getProperties()Returns aMapview of the custom properties for thisICustomPropertyProvider.- Returns:
- a
Mapview of the custom properties for thisICustomPropertyProvider
-
setProperties
Sets all 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
-