org.jboss.portal.common.util
Class TypedMap.Converter<E,I>

java.lang.Object
  extended by org.jboss.portal.common.util.TypedMap.Converter<E,I>
Enclosing class:
TypedMap<EK,EV,IK,IV>

public abstract static class TypedMap.Converter<E,I>
extends java.lang.Object


Constructor Summary
TypedMap.Converter()
           
 
Method Summary
protected abstract  boolean equals(I left, I right)
          Compare internal values, the passed argument are never null.
protected abstract  E getExternal(I internal)
          Wrap the internal key into its external representation, by default returns the same key.
protected abstract  I getInternal(E external)
          Unwraps the key to the the internal key that will be stored in the map.
 boolean safeEquals(I left, I right)
           
 I unwrap(E external)
           
 E wrap(I internal)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TypedMap.Converter

public TypedMap.Converter()
Method Detail

getInternal

protected abstract I getInternal(E external)
                          throws java.lang.IllegalArgumentException,
                                 java.lang.ClassCastException
Unwraps the key to the the internal key that will be stored in the map. This method calls the assertKeyValidity(Object key) and returns the same key. It can be overriden to provide a customized key that will be used instead of the external key.

Parameters:
external - the key to unwrap
Returns:
the unwrapped key
Throws:
java.lang.ClassCastException - if the class of the specified key prevents it from being stored in this map
java.lang.IllegalArgumentException - if some aspect of this key prevents it from being stored in this map

getExternal

protected abstract E getExternal(I internal)
Wrap the internal key into its external representation, by default returns the same key. It can be overriden to provide a customized key that will be used instead of the internal key.


unwrap

public I unwrap(E external)
         throws java.lang.IllegalArgumentException,
                java.lang.ClassCastException,
                java.lang.NullPointerException
Throws:
java.lang.IllegalArgumentException
java.lang.ClassCastException
java.lang.NullPointerException

wrap

public E wrap(I internal)
       throws java.lang.IllegalStateException
Throws:
java.lang.IllegalStateException

safeEquals

public boolean safeEquals(I left,
                          I right)

equals

protected abstract boolean equals(I left,
                                  I right)
Compare internal values, the passed argument are never null.

Parameters:
left - the left value
right - the right value
Returns:
true if the values are equals