Class AttributeModel
- java.lang.Object
-
- de.gsi.dataset.spi.financial.api.attrs.AttributeModel
-
- All Implemented Interfaces:
java.lang.Cloneable
public class AttributeModel extends java.lang.Object implements java.lang.Cloneable
-
-
Constructor Summary
Constructors Constructor Description AttributeModel()AttributeModel(java.util.Map<AttributeKey<?>,java.lang.Object> attributes)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.Objectclone()static AttributeModelconfigure()static AttributeModelconfigure(AttributeModel template)booleancontainsAttribute(AttributeKey<?> key)Returns true if the plugin model contains an attribute specified by given keyAttributeModeldeepCopyAttributes()<T> TgetAttribute(AttributeKey<T> key)Returns an attribute of the plugin model<T,E extends T>
EgetAttribute(AttributeKey<T> key, java.lang.Class<E> clazz)Returns an attribute of the plugin model<T,E extends T>
EgetAttribute(AttributeKey<T> key, java.lang.Class<E> clazz, E defaultValue)Returns an attribute of the plugin model<T> TgetAttribute(AttributeKey<T> key, T defaultValue)Returns an attribute of the model<T> TgetAttributeAndSet(AttributeKey<T> key, T defaultValue)Returns an attribute of the model, if it is not available - the default value is taken and automatically is set to the model!java.util.Set<AttributeKey<?>>getAttributes()<T> TgetRequiredAttribute(AttributeKey<T> key)Returns an attribute value as requiredvoidmerge(AttributeModel model)Merge model to this actual model<T> AttributeModelsetAttribute(AttributeKey<T> key, T value)Sets an attribute on the plugin model.java.lang.StringtoString()
-
-
-
Constructor Detail
-
AttributeModel
public AttributeModel()
-
AttributeModel
public AttributeModel(java.util.Map<AttributeKey<?>,java.lang.Object> attributes)
-
-
Method Detail
-
configure
public static AttributeModel configure()
- Returns:
- factory method for builder template
-
configure
public static AttributeModel configure(AttributeModel template)
- Parameters:
template- configure model by given filled model- Returns:
- factory method for builder template
-
getAttribute
public <T> T getAttribute(AttributeKey<T> key)
Returns an attribute of the plugin model- Type Parameters:
T- Type of the value- Parameters:
key- Key which identifies the attribute- Returns:
- Attribute value or
nullif the attribute is not set
-
getRequiredAttribute
public <T> T getRequiredAttribute(AttributeKey<T> key)
Returns an attribute value as required- Type Parameters:
T- Type of the value- Parameters:
key- Key which identifies the attribute- Returns:
- Attribute value,
null- throws IllegalArgumentException - required attributes
-
getAttribute
public <T> T getAttribute(AttributeKey<T> key, T defaultValue)
Returns an attribute of the model- Type Parameters:
T- Type of the value- Parameters:
key- Key which identifies the attributedefaultValue- value is used, if the value doesn't exist- Returns:
- Attribute value or
default valueif the attribute is not set
-
getAttributeAndSet
public <T> T getAttributeAndSet(AttributeKey<T> key, T defaultValue)
Returns an attribute of the model, if it is not available - the default value is taken and automatically is set to the model!- Type Parameters:
T- Type of the value- Parameters:
key- Key which identifies the attributedefaultValue- value is used, if the value doesn't exist, and set to the instance model- Returns:
- Attribute value or
default valueif the attribute is not set
-
getAttribute
public <T,E extends T> E getAttribute(AttributeKey<T> key, java.lang.Class<E> clazz)
Returns an attribute of the plugin model- Type Parameters:
T- Type of the valueE- retype to specific inherited class- Parameters:
key- Key which identifies the attributeclazz- specific class which will be used for casting- Returns:
- Attribute value or
default valueif the attribute is not set
-
getAttribute
public <T,E extends T> E getAttribute(AttributeKey<T> key, java.lang.Class<E> clazz, E defaultValue)
Returns an attribute of the plugin model- Type Parameters:
T- Type of the valueE- retype to specific inherited class- Parameters:
key- Key which identifies the attributeclazz- specific class which will be used for castingdefaultValue- default value is used, if the value doesn't exist- Returns:
- Attribute value or
default valueif the attribute is not set
-
setAttribute
public <T> AttributeModel setAttribute(AttributeKey<T> key, T value)
Sets an attribute on the plugin model. The key must not be null. If a value is null, the attribute is removed, so containsAttribute method will return false after this operation.- Type Parameters:
T- Type of the value- Parameters:
key- Key which identifies the attributevalue- Attribute value- Returns:
- this instance, can be used for builder syntax
-
containsAttribute
public boolean containsAttribute(AttributeKey<?> key)
Returns true if the plugin model contains an attribute specified by given key- Parameters:
key- Key which identifies the attribute
-
getAttributes
public java.util.Set<AttributeKey<?>> getAttributes()
- Returns:
- provides all attribute keys in the model
-
merge
public void merge(AttributeModel model)
Merge model to this actual model- Parameters:
model- AttributeModel
-
deepCopyAttributes
public AttributeModel deepCopyAttributes()
- Returns:
- copy attributes model - deep copy of objects
-
clone
public java.lang.Object clone()
- Overrides:
clonein classjava.lang.Object
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-