Skip navigation links


org.identityconnectors.framework.common.objects
Class AttributesAccessor

java.lang.Object
  extended by org.identityconnectors.framework.common.objects.AttributesAccessor


public class AttributesAccessor
extends java.lang.Object

Attributes Accessor convenience methods for accessing attributes. This class wraps a set of attributes to make lookup faster than the AttributeUtil.find(String, Set) method, since that method must re-create the map each time.

Author:
Warren Strange

Constructor Summary
AttributesAccessor(java.util.Set<Attribute> attrs)
           

 

Method Summary
 Attribute find(java.lang.String name)
          Find the named attribute
 java.math.BigDecimal findBigDecimal(java.lang.String name)
          Get the big decimal value from the specified (single-valued) attribute.
 java.lang.Boolean findBoolean(java.lang.String name)
          Get the boolean value from the specified (single-valued) attribute.
 java.util.Date findDate(java.lang.String name)
          Get the date value from the specified (single-valued) attribute that contains a long.
 java.lang.Double findDouble(java.lang.String name)
          Get the integer value from the specified (single-valued) attribute.
 java.lang.Integer findInteger(java.lang.String name)
          Get the integer value from the specified (single-valued) attribute.
 java.util.List<java.lang.Object> findList(java.lang.String name)
          Return a list of attributes
 java.lang.Long findLong(java.lang.String name)
          Get the long value from the specified (single-valued) attribute.
 java.lang.String findString(java.lang.String name)
          Get the string value from the specified (single-valued) attribute.
 java.util.List<java.lang.String> findStringList(java.lang.String name)
          Return the multivalued attribute as a list of strings.
 boolean getEnabled(boolean dflt)
          Return the enabled status of the account.
 Name getName()
          Get the Name attribute from the set of attributes.
 GuardedString getPassword()
          Get the password as a GuardeString
 Uid getUid()
          Get the Uid attribute from the set of attributes.
 boolean hasAttribute(java.lang.String name)
          Determines if the set as the attribute specified.

 

Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

 

Constructor Detail

AttributesAccessor

public AttributesAccessor(java.util.Set<Attribute> attrs)

Method Detail

find

public Attribute find(java.lang.String name)
Find the named attribute
Parameters:
name - - the attribute name to search for
Returns:
the Attribute, or null if not found.

getName

public Name getName()
Get the Name attribute from the set of attributes.
Returns:
the Name attribute in the set.

getUid

public Uid getUid()
Get the Uid attribute from the set of attributes.
Returns:
the Uid attribute in the set.

getEnabled

public boolean getEnabled(boolean dflt)
Return the enabled status of the account. If the ENABLE operational attribute is present, it's value takes precedence over the current value. If it is missing, the currentlyEnabled status is returned instead.
Parameters:
dflt - the default state if enable is not found.
Returns:
true if the account is enabled, false otherwise

getPassword

public GuardedString getPassword()
Get the password as a GuardeString
Returns:
the password as a guarded String

findList

public java.util.List<java.lang.Object> findList(java.lang.String name)
Return a list of attributes
Parameters:
name - - name of attribute to search for.
Returns:
The List (generic object) iff it exists otherwise null.

findStringList

public java.util.List<java.lang.String> findStringList(java.lang.String name)
Return the multivalued attribute as a list of strings. This will throw a ClassCastException if the underlying attribute list is not of type String.
Parameters:
name - the name of the attribute to search for
Returns:
a List of String values for the attribute

hasAttribute

public boolean hasAttribute(java.lang.String name)
Determines if the set as the attribute specified.
Parameters:
name - attribute name
Returns:
true if the named attribute exists, false otherwise

findString

public java.lang.String findString(java.lang.String name)
Get the string value from the specified (single-valued) attribute.
Parameters:
name - Attribute from which to retrieve the long value.
Returns:
null if the value is null otherwise the long value for the attribute.
Throws:
java.lang.ClassCastException - iff the object in the attribute is not an long.
java.lang.IllegalArgumentException - iff the attribute is a multi-valued (rather than single-valued).

findInteger

public java.lang.Integer findInteger(java.lang.String name)
Get the integer value from the specified (single-valued) attribute.
Parameters:
name - Attribute from which to retrieve the long value.
Returns:
null if the value is null otherwise the long value for the attribute.
Throws:
java.lang.ClassCastException - iff the object in the attribute is not an long.
java.lang.IllegalArgumentException - iff the attribute is a multi-valued (rather than single-valued).

findLong

public java.lang.Long findLong(java.lang.String name)
Get the long value from the specified (single-valued) attribute.
Parameters:
name - Attribute from which to retrieve the long value.
Returns:
null if the value is null otherwise the long value for the attribute.
Throws:
java.lang.ClassCastException - iff the object in the attribute is not an long.
java.lang.IllegalArgumentException - iff the attribute is a multi-valued (rather than single-valued).

findDate

public java.util.Date findDate(java.lang.String name)
Get the date value from the specified (single-valued) attribute that contains a long.
Parameters:
name - Attribute from which to retrieve the date value.
Returns:
null if the value is null otherwise the date value for the attribute.
Throws:
java.lang.ClassCastException - iff the object in the attribute is not an long.
java.lang.IllegalArgumentException - iff the attribute is a multi-valued (rather than single-valued).

findDouble

public java.lang.Double findDouble(java.lang.String name)
Get the integer value from the specified (single-valued) attribute.
Parameters:
name - Attribute from which to retrieve the integer value.
Returns:
null if the value is null otherwise the integer value for the attribute.
Throws:
java.lang.ClassCastException - iff the object in the attribute is not an integer.
java.lang.IllegalArgumentException - iff the attribute is a multi-valued (rather than single-valued)..

findBigDecimal

public java.math.BigDecimal findBigDecimal(java.lang.String name)
Get the big decimal value from the specified (single-valued) attribute.
Parameters:
name - Attribute from which to retrieve the big decimal value.
Returns:
null if the value is null otherwise the big decimal value for the attribute.
Throws:
java.lang.ClassCastException - iff the object in the attribute is not an big decimal.
java.lang.IllegalArgumentException - iff the attribute is a multi-valued (rather than single-valued).

findBoolean

public java.lang.Boolean findBoolean(java.lang.String name)
Get the boolean value from the specified (single-valued) attribute.
Parameters:
name - Attribute from which to retrieve the boolean value.
Returns:
null if the value is null otherwise the boolean value for the attribute.
Throws:
java.lang.ClassCastException - iff the object in the attribute is not an Boolean.
java.lang.IllegalArgumentException - iff the attribute is a multi-valued (rather than single-valued).

Skip navigation links


Copyright © 2013, Oracle and/or its affiliates. All rights reserved.