Class DynamicModel<T>
- java.lang.Object
-
- com.ibm.cloud.sdk.core.service.model.DynamicModel<T>
-
- All Implemented Interfaces:
ObjectModel
public abstract class DynamicModel<T> extends java.lang.Object implements ObjectModel
Abstract model class for a model which supports dynamic (arbitrary) properties of type T.
-
-
Constructor Summary
Constructors Constructor Description DynamicModel(com.google.gson.reflect.TypeToken<T> t)This ctor accepts a TypeToken instance that represents the type of values stored in the map.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(java.lang.Object o)Tget(java.lang.String key)Returns the value of the specified property.com.google.gson.reflect.TypeToken<T>getAdditionalPropertyTypeToken()Returns the TypeToken which describes the type of additional properties stored in the map.java.util.Map<java.lang.String,T>getProperties()Returns a map containing the arbitrary properties set on this object.java.util.Set<java.lang.String>getPropertyNames()Returns the names of arbitrary properties set on this object.inthashCode()Tput(java.lang.String key, T value)Sets an arbitrary property.voidremoveProperties()Removes all of the arbitrary properties set on this object.TremoveProperty(java.lang.String key)Removes the specified property from this object's map of arbitrary properties.voidsetProperties(java.util.Map<java.lang.String,T> properties)Sets the map containing the arbitrary properties set on this object.java.lang.StringtoString()
-
-
-
Constructor Detail
-
DynamicModel
public DynamicModel(com.google.gson.reflect.TypeToken<T> t)
This ctor accepts a TypeToken instance that represents the type of values stored in the map.- Parameters:
t- the TypeToken which represents the type of map values
-
-
Method Detail
-
getAdditionalPropertyTypeToken
public com.google.gson.reflect.TypeToken<T> getAdditionalPropertyTypeToken()
Returns the TypeToken which describes the type of additional properties stored in the map.- Returns:
- The TypeToken which describes the map value type
-
put
public T put(java.lang.String key, T value)
Sets an arbitrary property.- Parameters:
key- the name of the property to setvalue- the value of the property to be set- Returns:
- the previous value of the property, or null if the property was not previously set
-
get
public T get(java.lang.String key)
Returns the value of the specified property.- Parameters:
key- the name of the property to get- Returns:
- the value of the property, or null if the property is not set
-
setProperties
public void setProperties(java.util.Map<java.lang.String,T> properties)
Sets the map containing the arbitrary properties set on this object.- Parameters:
properties- a map containing arbitrary properties to set on this object
-
getProperties
public java.util.Map<java.lang.String,T> getProperties()
Returns a map containing the arbitrary properties set on this object.- Returns:
- a copy of the map containing arbitrary properties set on this object
-
getPropertyNames
public java.util.Set<java.lang.String> getPropertyNames()
Returns the names of arbitrary properties set on this object.- Returns:
- a set containing the names of arbitrary properties set on this object
-
removeProperty
public T removeProperty(java.lang.String key)
Removes the specified property from this object's map of arbitrary properties.- Parameters:
key- the name of the property to be removed- Returns:
- the previous value of the property, or null if the property was not previously set
-
removeProperties
public void removeProperties()
Removes all of the arbitrary properties set on this object.
-
equals
public boolean equals(java.lang.Object o)
- Specified by:
equalsin interfaceObjectModel- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()
- Specified by:
hashCodein interfaceObjectModel- Overrides:
hashCodein classjava.lang.Object
-
toString
public java.lang.String toString()
- Specified by:
toStringin interfaceObjectModel- Overrides:
toStringin classjava.lang.Object
-
-