Package com.isode.dsapi.profile
Class AttributeBlock
java.lang.Object
com.isode.dsapi.profile.AttributeBlock
An AttributeBlock is a way of saving a structured set of key/value pairs in a BindProfile.
Each AttributeBlock has a Type and Name attribute. Multiple AttributeBlocks can be stored
in each BindProfile.
- Since:
- 16.6
- Author:
- tc
-
Constructor Summary
ConstructorsConstructorDescriptionCreate an empty AttributeBlock.AttributeBlock(AttributeBlock other) Construct a new object by copying another (so that subsequent changes to the original object won't affect this one).AttributeBlock(String type, String name) Create an empty AttributeBlock with a specific type and name -
Method Summary
Modifier and TypeMethodDescriptionvoidAdd a key/value attribute pair to the blockgetName()Get the name string for the AttributeBlockgetType()Get the Type string for the AttributeBlockGet the value corresponding to a keyGet the value associated with the given key.booleanhasValueForKey(String key) Indicates if a value is set for the given key.keySet()Get a Set containing all the keys in the AttributeBlockbooleannameEquals(String value) Indicates if the name of the block is equal to the given valuevoidSet the Name string for the AttributeBlockvoidSet the Type string for the AttributeBlocktoString()booleantypeEquals(String test) Tests whether thisAttributeBlockhas the given type.
-
Constructor Details
-
AttributeBlock
public AttributeBlock()Create an empty AttributeBlock. -
AttributeBlock
Create an empty AttributeBlock with a specific type and name- Parameters:
type- The type string for the AttributeBlock, which must not be nullname- The name string for the AttributeBlock, which must not be null
-
AttributeBlock
Construct a new object by copying another (so that subsequent changes to the original object won't affect this one).- Parameters:
other- another object (notnull)
-
-
Method Details
-
getType
Get the Type string for the AttributeBlock- Returns:
- type, which will never be null
-
setType
Set the Type string for the AttributeBlock- Parameters:
type- which may not be null
-
typeEquals
Tests whether thisAttributeBlockhas the given type.- Parameters:
test- A type to test theAttributeBlock's type against. Ifnullresult will be false (as type can never benull).- Returns:
trueif thisAttributeBlocktype is exactly equal to the given test value,falseif not.- Since:
- 17.0
-
getName
Get the name string for the AttributeBlock- Returns:
- name which will never be null
-
nameEquals
Indicates if the name of the block is equal to the given value- Parameters:
value- a value to compare this blocks name to. Ifnullresult will befalse(as name can never bynull).- Returns:
trueif this name of this block is equal to the given valuefalseotherwise.- Since:
- 17.0
-
setName
Set the Name string for the AttributeBlock- Parameters:
name- which must not be null
-
AddPair
Add a key/value attribute pair to the block- Parameters:
key- which may not be nullvalue- which may not be null
-
GetValue
Get the value corresponding to a key- Parameters:
key- which may not be null- Returns:
- corresponding value which will be
nullif and only if no value is set for that key.
-
hasValueForKey
Indicates if a value is set for the given key.- Parameters:
key- A key to check for. Ifnullresult will befalse- Returns:
trueif a value is set for that key, {falseotherwise.- Since:
- 17.0
-
getValueThrowIfNotSet
Get the value associated with the given key. If no value is set for the key throws an exception.- Parameters:
key- The key to get the value for. Should not benull- Returns:
- The value for that key. Will not be
null - Throws:
IllegalArgumentException- if there is no value for the given key- Since:
- 17.0
-
keySet
Get a Set containing all the keys in the AttributeBlock- Returns:
- set of keys, which will not be null
-
toString
-