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 Type
    Method
    Description
    boolean
    getBoolValue(String propertyName)
    Gets the boolean value of the custom property with the provided name.
    boolean
    getBoolValue(String propertyName, boolean defaultValue)
    Gets the boolean value of the custom property with the provided name.
    byte
    getByteValue(String propertyName)
    Gets the byte value of the custom property with the provided name.
    byte
    getByteValue(String propertyName, byte defaultValue)
    Gets the byte value of the custom property with the provided name.
    char
    getCharValue(String propertyName)
    Gets the char value of the custom property with the provided name.
    char
    getCharValue(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.
    double
    getDoubleValue(String propertyName)
    Gets the double value of the custom property with the provided name.
    double
    getDoubleValue(String propertyName, double defaultValue)
    Gets the double value of the custom property with the provided name.
    <T extends Enum<T>>
    T
    getEnumValue(String propertyName, Class<T> enumType)
    Gets the enum value of the custom property with the provided name.
    <T extends Enum<T>>
    T
    getEnumValue(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.
    float
    getFloatValue(String propertyName)
    Gets the float value of the custom property with the provided name.
    float
    getFloatValue(String propertyName, float defaultValue)
    Gets the float value of the custom property with the provided name.
    int
    getIntValue(String propertyName)
    Gets the int value of the custom property with the provided name.
    int
    getIntValue(String propertyName, int defaultValue)
    Gets the int value of the custom property with the provided name.
    long
    getLongValue(String propertyName)
    Gets the long value of the custom property with the provided name.
    long
    getLongValue(String propertyName, long defaultValue)
    Gets the long value of the custom property with the provided name.
    int
    getMapObjectId(String propertyName)
     
    Returns a Map view of the custom properties for this ICustomPropertyProvider.
    getProperty(String propertyName)
     
    short
    getShortValue(String propertyName)
    Gets the short value of the custom property with the provided name.
    short
    getShortValue(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.
    boolean
    hasCustomProperty(String propertyName)
    Checks if a custom property with the given name is present.
    void
    removeProperty(String propertyName)
     
    void
    Sets all the custom properties on this object to the provided values.
    void
    setValue(String propertyName, boolean value)
    Sets the value for the custom property with the given name to the given boolean.
    void
    setValue(String propertyName, byte value)
    Sets the value for the custom property with the given name to the given byte.
    void
    setValue(String propertyName, char value)
    Sets the value for the custom property with the given name to the given char.
    void
    setValue(String propertyName, double value)
    Sets the value for the custom property with the given name to the given double.
    void
    setValue(String propertyName, float value)
    Sets the value for the custom property with the given name to the given float.
    void
    setValue(String propertyName, int value)
    Sets the value for the custom property with the given name to the given int.
    void
    setValue(String propertyName, long value)
    Sets the value for the custom property with the given name to the given long.
    void
    setValue(String propertyName, short value)
    Sets the value for the custom property with the given name to the given short.
    void
    setValue(String propertyName, ICustomProperty value)
     
    void
    setValue(String propertyName, IMapObject value)
    Sets the value for the custom property with the ID of the given map object.
    void
    setValue(String propertyName, Color value)
    Sets the value for the custom property with the given name to the given color.
    void
    setValue(String propertyName, Enum<?> value)
    Sets the value for the custom property with the given name to the given enum.
    void
    setValue(String propertyName, String value)
    Sets the value for the custom property with the given name to the given string.
    void
    setValue(String propertyName, URL value)
    Sets the value for the custom property with the given name to the given file.
  • Method Details

    • hasCustomProperty

      boolean hasCustomProperty(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.
    • getProperty

      ICustomProperty getProperty(String propertyName)
    • setValue

      void setValue(String propertyName, ICustomProperty value)
    • removeProperty

      void removeProperty(String propertyName)
    • getStringValue

      String getStringValue(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:
      NoSuchElementException - if the custom property does not exist
    • getStringValue

      String getStringValue(String propertyName, 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 property
      defaultValue - 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

      List<String> getCommaSeparatedStringValues(String propertyName, String defaultValue)
      Gets a list of strings stored in a single comma-separated property.
      Parameters:
      propertyName - the name of the custom property
      defaultValue - 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

      char getCharValue(String propertyName)
      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 exist
      NumberFormatException - if the custom property is not a char or is not in range for a char
    • getCharValue

      char getCharValue(String propertyName, char defaultValue)
      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 property
      defaultValue - 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

      int getIntValue(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:
      NoSuchElementException - if the custom property does not exist
      NumberFormatException - if the custom property is not an integer or is not in range for an int
    • getIntValue

      int getIntValue(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 property
      defaultValue - 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

      long getLongValue(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:
      NoSuchElementException - if the custom property does not exist
      NumberFormatException - if the custom property is not an integer or is not in range for a long
    • getLongValue

      long getLongValue(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 property
      defaultValue - 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(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:
      NoSuchElementException - if the custom property does not exist
      NumberFormatException - if the custom property is not an integer or is out of range for a short
    • getShortValue

      short getShortValue(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 property
      defaultValue - 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(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:
      NoSuchElementException - if the custom property does not exist
      NumberFormatException - if the custom property is not an integer or is out of range for a byte
    • getByteValue

      byte getByteValue(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 property
      defaultValue - 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(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:
      NoSuchElementException - if the custom property does not exist
      NumberFormatException - if the custom property is not a boolean value
    • getBoolValue

      boolean getBoolValue(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 property
      defaultValue - 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(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:
      NoSuchElementException - if the custom property does not exist
      NumberFormatException - if the custom property is not a number
    • getFloatValue

      float getFloatValue(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 property
      defaultValue - 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(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:
      NoSuchElementException - if the custom property does not exist
      NumberFormatException - if the custom property is not a number
    • getDoubleValue

      double getDoubleValue(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 property
      defaultValue - 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

      Color getColorValue(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:
      NoSuchElementException - if the custom property does not exist
    • getColorValue

      Color getColorValue(String propertyName, 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 property
      defaultValue - 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 Enum<T>> T getEnumValue(String propertyName, 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 property
      enumType - a Class object for <T>
      Returns:
      the enum value of the custom property
      Throws:
      NoSuchElementException - if the custom property does not exist
    • getEnumValue

      <T extends Enum<T>> T getEnumValue(String propertyName, 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 property
      enumType - a Class object 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

      URL getFileValue(String propertyName)
      Gets the file value of the custom property with the provided name. If the property is not a file, null is returned instead.
      Parameters:
      propertyName - the name of the custom property
      Returns:
      the file value of the custom property, if present.
    • getFileValue

      URL getFileValue(String propertyName, 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 property
      defaultValue - 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

      int getMapObjectId(String propertyName)
    • setValue

      void setValue(String propertyName, URL value)
      Sets the value for the custom property with the given name to the given file.
      Parameters:
      propertyName - the name of the custom property
      value - the new value
    • setValue

      void setValue(String propertyName, String value)
      Sets the value for the custom property with the given name to the given string.
      Parameters:
      propertyName - the name of the custom property
      value - the new value
    • setValue

      void setValue(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 property
      value - the new value
    • setValue

      void setValue(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 property
      value - the new value
    • setValue

      void setValue(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 property
      value - the new value
    • setValue

      void setValue(String propertyName, char value)
      Sets the value for the custom property with the given name to the given char.
      Parameters:
      propertyName - the name of the custom property
      value - the new value
    • setValue

      void setValue(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 property
      value - the new value
    • setValue

      void setValue(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 property
      value - the new value
    • setValue

      void setValue(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 property
      value - the new value
    • setValue

      void setValue(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 property
      value - the new value
    • setValue

      void setValue(String propertyName, Color value)
      Sets the value for the custom property with the given name to the given color.
      Parameters:
      propertyName - the name of the custom property
      value - the new value
    • setValue

      void setValue(String propertyName, Enum<?> value)
      Sets the value for the custom property with the given name to the given enum.
      Parameters:
      propertyName - the name of the custom property
      value - the new value
    • setValue

      void setValue(String propertyName, IMapObject value)
      Sets the value for the custom property with the ID of the given map object.
      Parameters:
      propertyName - the name of the custom property
      value - the new value
    • getProperties

      Map<String,ICustomProperty> getProperties()
      Returns a Map view of the custom properties for this ICustomPropertyProvider.
      Returns:
      a Map view of the custom properties for this ICustomPropertyProvider
    • setProperties

      void setProperties(Map<String,ICustomProperty> props)
      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