Class AttributeBlock

java.lang.Object
com.isode.dsapi.profile.AttributeBlock

public class AttributeBlock extends Object
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 Details

    • AttributeBlock

      public AttributeBlock()
      Create an empty AttributeBlock.
    • AttributeBlock

      public AttributeBlock(String type, String name)
      Create an empty AttributeBlock with a specific type and name
      Parameters:
      type - The type string for the AttributeBlock, which must not be null
      name - The name string for the AttributeBlock, which must not be null
    • AttributeBlock

      public AttributeBlock(AttributeBlock other)
      Construct a new object by copying another (so that subsequent changes to the original object won't affect this one).
      Parameters:
      other - another object (not null)
  • Method Details

    • getType

      public String getType()
      Get the Type string for the AttributeBlock
      Returns:
      type, which will never be null
    • setType

      public void setType(String type)
      Set the Type string for the AttributeBlock
      Parameters:
      type - which may not be null
    • typeEquals

      public boolean typeEquals(String test)
      Tests whether this AttributeBlock has the given type.
      Parameters:
      test - A type to test the AttributeBlock's type against. If null result will be false (as type can never be null).
      Returns:
      true if this AttributeBlock type is exactly equal to the given test value, false if not.
      Since:
      17.0
    • getName

      public String getName()
      Get the name string for the AttributeBlock
      Returns:
      name which will never be null
    • nameEquals

      public boolean nameEquals(String value)
      Indicates if the name of the block is equal to the given value
      Parameters:
      value - a value to compare this blocks name to. If null result will be false (as name can never by null).
      Returns:
      true if this name of this block is equal to the given value false otherwise.
      Since:
      17.0
    • setName

      public void setName(String name)
      Set the Name string for the AttributeBlock
      Parameters:
      name - which must not be null
    • AddPair

      public void AddPair(String key, String value)
      Add a key/value attribute pair to the block
      Parameters:
      key - which may not be null
      value - which may not be null
    • GetValue

      public String GetValue(String key)
      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

      public boolean hasValueForKey(String key)
      Indicates if a value is set for the given key.
      Parameters:
      key - A key to check for. If null result will be false
      Returns:
      true if a value is set for that key, {false otherwise.
      Since:
      17.0
    • getValueThrowIfNotSet

      public String getValueThrowIfNotSet(String key)
      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 be null
      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

      public Set<String> keySet()
      Get a Set containing all the keys in the AttributeBlock
      Returns:
      set of keys, which will not be null
    • toString

      public String toString()
      Overrides:
      toString in class Object