Package com.piketec.tpt.api.properties
Class PropertyMap
- java.lang.Object
-
- com.piketec.tpt.api.properties.PropertyMap
-
- All Implemented Interfaces:
Property
,java.io.Serializable
public class PropertyMap extends java.lang.Object implements Property, java.io.Serializable
A property consisting of multiple key-value-pairs.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description PropertyMap()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(java.lang.Object obj)
java.util.Collection<java.lang.String>
getKeys()
Property
getValue(java.lang.String key)
Get the Values defined for a given key.int
hashCode()
PropertyList
setListValue(java.lang.String key)
Shorthand forsetValue(key, new PropertyList())
PropertyMap
setMapValue(java.lang.String key)
Shorthand forsetValue(key, new PropertyMap())
void
setValue(java.lang.String key, boolean value)
Shorthand forsetValue(key, new PropertyBool(value))
void
setValue(java.lang.String key, double value)
Shorthand forsetValue(key, new PropertyDecimal(value))
void
setValue(java.lang.String key, int value)
Shorthand forsetValue(key, new PropertyInt(value))
void
setValue(java.lang.String key, long value)
Shorthand forsetValue(key, new PropertyLong(value))
void
setValue(java.lang.String key, Property value)
Assign a property value to a given key.Already existing properties will be overwritten.void
setValue(java.lang.String key, java.lang.String value)
Shorthand forsetValue(key, new PropertyString(value))
java.lang.String
toString()
void
toString(java.lang.StringBuffer buffer, java.lang.String indentation)
Fills the givenStringBuffer
with a clear String-representation of all (possibly nested) property values of thisProperty
object.
-
-
-
Method Detail
-
getKeys
public java.util.Collection<java.lang.String> getKeys()
- Returns:
- Returns a set of all keys
-
getValue
public Property getValue(java.lang.String key)
Get the Values defined for a given key.- Parameters:
key
- The key- Returns:
- The value that is stored in the map for this key.
-
setValue
public void setValue(java.lang.String key, Property value)
Assign a property value to a given key.Already existing properties will be overwritten.- Parameters:
key
- The property keyvalue
- The property value that shall be assigned to this key.
-
setValue
public void setValue(java.lang.String key, boolean value)
Shorthand forsetValue(key, new PropertyBool(value))
- Parameters:
key
- The property keyvalue
- The boolean value that shall be assigned to this key.
-
setValue
public void setValue(java.lang.String key, double value)
Shorthand forsetValue(key, new PropertyDecimal(value))
- Parameters:
key
- The property keyvalue
- The double value that shall be assigned to this key.
-
setValue
public void setValue(java.lang.String key, int value)
Shorthand forsetValue(key, new PropertyInt(value))
- Parameters:
key
- The property keyvalue
- The integer property value that shall be assigned to this key.
-
setValue
public void setValue(java.lang.String key, long value)
Shorthand forsetValue(key, new PropertyLong(value))
- Parameters:
key
- The property keyvalue
- The long integer property value that shall be assigned to this key.
-
setValue
public void setValue(java.lang.String key, java.lang.String value)
Shorthand forsetValue(key, new PropertyString(value))
- Parameters:
key
- The property keyvalue
- TheString
property value that shall be assigned to this key.
-
setListValue
public PropertyList setListValue(java.lang.String key)
Shorthand forsetValue(key, new PropertyList())
- Parameters:
key
- The property key- Returns:
- the new
PropertyList
-
setMapValue
public PropertyMap setMapValue(java.lang.String key)
Shorthand forsetValue(key, new PropertyMap())
- Parameters:
key
- The property key- Returns:
- the new
PropertyMap
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
toString
public void toString(java.lang.StringBuffer buffer, java.lang.String indentation)
Description copied from interface:Property
Fills the givenStringBuffer
with a clear String-representation of all (possibly nested) property values of thisProperty
object.For that, the given String
indentation
is used initially and each additional element is shifted by additional whitespaces.
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equals
in classjava.lang.Object
-
-