no.feide.moria.servlet
Class AttribsData

java.lang.Object
  extended by no.feide.moria.servlet.AttribsData
All Implemented Interfaces:
java.util.Comparator

public class AttribsData
extends java.lang.Object
implements java.util.Comparator

Version:
$Revision: 1.12 $ Stores data for all possible user attributes registered. The attributes are read from an xml file to make it easy to add and change the attributes. The attribute is identified by the "key" keyword, which stores the attribute name, but each attribute has other data as well. See the attribute description file for more information.
Author:
Eva Indal

Field Summary
private  java.util.HashMap hashmap
          Used for storing all info about a attribute.
private  int idx
          Used for sorting the attributes.
 
Constructor Summary
AttribsData(int index)
          Constructor.
 
Method Summary
 void addData(java.lang.String name, java.lang.String data)
          Adds info/data for an attribute.
 int compare(java.lang.Object ad1, java.lang.Object ad2)
          Implements Comparator.compare to be able to sort attributes based on xml file order.
 boolean equals(java.lang.Object ad)
          Implements Comparator.equals.
 java.lang.String getData(java.lang.String name)
          Returns data for an attribute.
 int hashCode()
          Generates a hashCode.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

idx

private int idx
Used for sorting the attributes.


hashmap

private java.util.HashMap hashmap
Used for storing all info about a attribute.

Constructor Detail

AttribsData

public AttribsData(int index)
Constructor.

Parameters:
index - order in xml file.
Method Detail

compare

public final int compare(java.lang.Object ad1,
                         java.lang.Object ad2)
Implements Comparator.compare to be able to sort attributes based on xml file order.

Specified by:
compare in interface java.util.Comparator
Parameters:
ad1 - The first object.
ad2 - The second object.
Returns:
< 0 if object 1 index is less than object 2, > 0 if object 2 index i larger.
See Also:
Comparator.compare(T, T)

equals

public final boolean equals(java.lang.Object ad)
Implements Comparator.equals.

Specified by:
equals in interface java.util.Comparator
Overrides:
equals in class java.lang.Object
Parameters:
ad - Object to compare.
Returns:
true if equal.

hashCode

public final int hashCode()
Generates a hashCode.

Overrides:
hashCode in class java.lang.Object
Returns:
The hashcode.

addData

public final void addData(java.lang.String name,
                          java.lang.String data)
Adds info/data for an attribute.

Parameters:
name - The name of the information.
data - The actual data.
Throws:
java.lang.IllegalArgumentException - If name or data is null or zero length.

getData

public final java.lang.String getData(java.lang.String name)
Returns data for an attribute.

Parameters:
name - the name of the infotmation to return
Returns:
the data associated with name
Throws:
java.lang.IllegalArgumentException - If name is null or zero length.


Copyright © 2001-2006 UNINETT FAS. All Rights Reserved.