edu.internet2.middleware.shibboleth.common.attribute.provider
Class BasicAttribute<ValueType>

java.lang.Object
  extended by edu.internet2.middleware.shibboleth.common.attribute.BaseAttribute<ValueType>
      extended by edu.internet2.middleware.shibboleth.common.attribute.provider.BasicAttribute<ValueType>
Type Parameters:
ValueType - value type
All Implemented Interfaces:
Cloneable, Comparable<BaseAttribute>

public class BasicAttribute<ValueType>
extends BaseAttribute<ValueType>
implements Cloneable

An attribute implementation that operates on simple value types. NOTE: many plugins will use the Object.toString() method on an attribute's values. Therefore any value should return something reasonable for that method and what is returned should be very stable across versions.


Field Summary
private  Comparator<ValueType> comparator
          Comparator for this attribute.
private  ArrayList<AttributeEncoder> encoders
          Map of attribute encoders for this attribute, keyed off of category.
private  String id
          ID of this attribute.
private  Collection<ValueType> values
          Set of values for this attribute.
 
Constructor Summary
BasicAttribute()
          Constructor.
BasicAttribute(String attributeId)
          Constructor.
 
Method Summary
 BasicAttribute<ValueType> clone()
          
 List<AttributeEncoder> getEncoders()
          Gets the list of attribute encoders usable with this attribute.
 String getId()
          Gets the unique ID of the attribute.
 Comparator<ValueType> getValueComparator()
          Gets the comparator used to sort values.
 Collection<ValueType> getValues()
          Gets the values of the attribute.
 void setId(String newID)
          Set id of this attribute.
 void setValueComparator(Comparator<ValueType> newComparator)
          Set value comparator for this attribute.
 void setValues(Collection<ValueType> newValues)
          Replace the current set of values with the given set.
 
Methods inherited from class edu.internet2.middleware.shibboleth.common.attribute.BaseAttribute
compareTo, equals, getDisplayDescriptions, getDisplayNames, hashCode, toString
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

id

private String id
ID of this attribute.


encoders

private ArrayList<AttributeEncoder> encoders
Map of attribute encoders for this attribute, keyed off of category.


values

private Collection<ValueType> values
Set of values for this attribute.


comparator

private Comparator<ValueType> comparator
Comparator for this attribute.

Constructor Detail

BasicAttribute

public BasicAttribute()
Constructor.


BasicAttribute

public BasicAttribute(String attributeId)
Constructor.

Parameters:
attributeId - the ID of this attribute
Method Detail

getEncoders

public List<AttributeEncoder> getEncoders()
Gets the list of attribute encoders usable with this attribute.

Specified by:
getEncoders in class BaseAttribute<ValueType>
Returns:
attribute encoders usable with this attribute, must never be null

getId

public String getId()
Gets the unique ID of the attribute.

Specified by:
getId in class BaseAttribute<ValueType>
Returns:
unique ID of the attribute

setId

public void setId(String newID)
Set id of this attribute.

Parameters:
newID - new ID

getValueComparator

public Comparator<ValueType> getValueComparator()
Gets the comparator used to sort values. If no comparator is set then the value set with be natural ordering sorted.

Specified by:
getValueComparator in class BaseAttribute<ValueType>
Returns:
comparator used to sort values

setValueComparator

public void setValueComparator(Comparator<ValueType> newComparator)
Set value comparator for this attribute.

Parameters:
newComparator - new value comparator

getValues

public Collection<ValueType> getValues()
Gets the values of the attribute.

Specified by:
getValues in class BaseAttribute<ValueType>
Returns:
values of the attribute, must never be null

setValues

public void setValues(Collection<ValueType> newValues)
Replace the current set of values with the given set.

Parameters:
newValues - new values to replace existing ones

clone

public BasicAttribute<ValueType> clone()

Overrides:
clone in class Object


Copyright © 1999-2012. All Rights Reserved.