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 TypeMethodDescriptionvoid
Add 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.boolean
hasValueForKey
(String key) Indicates if a value is set for the given key.keySet()
Get a Set containing all the keys in the AttributeBlockboolean
nameEquals
(String value) Indicates if the name of the block is equal to the given valuevoid
Set the Name string for the AttributeBlockvoid
Set the Type string for the AttributeBlocktoString()
boolean
typeEquals
(String test) Tests whether thisAttributeBlock
has 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 thisAttributeBlock
has the given type.- Parameters:
test
- A type to test theAttributeBlock
's type against. Ifnull
result will be false (as type can never benull
).- Returns:
true
if thisAttributeBlock
type is exactly equal to the given test value,false
if 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. Ifnull
result will befalse
(as name can never bynull
).- Returns:
true
if this name of this block is equal to the given valuefalse
otherwise.- 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
null
if 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. Ifnull
result will befalse
- Returns:
true
if a value is set for that key, {false
otherwise.- 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
-