org.chromattic.spi.type
Class SimpleTypeProvider<I,E>

java.lang.Object
  extended by org.chromattic.spi.type.SimpleTypeProvider<I,E>
Type Parameters:
I - the generic internal type
E - the generic external type
Direct Known Subclasses:
SimpleTypeProvider.BINARY, SimpleTypeProvider.BOOLEAN, SimpleTypeProvider.DATE, SimpleTypeProvider.DOUBLE, SimpleTypeProvider.LONG, SimpleTypeProvider.NAME, SimpleTypeProvider.PATH, SimpleTypeProvider.STRING

public abstract class SimpleTypeProvider<I,E>
extends java.lang.Object

The base class for the simple type Service Provider Interface. A provider performs a bidiectional conversion between an internal type and an external type, in addition a provider must be able to convert a string value to an external representation and vice-versa.

Version:
$Revision$
Author:
Julien Viet

Nested Class Summary
static class SimpleTypeProvider.BINARY<E>
           
static class SimpleTypeProvider.BOOLEAN<E>
           
static class SimpleTypeProvider.DATE<E>
           
static class SimpleTypeProvider.DOUBLE<E>
           
static class SimpleTypeProvider.LONG<E>
           
static class SimpleTypeProvider.NAME<E>
           
static class SimpleTypeProvider.PATH<E>
           
static class SimpleTypeProvider.STRING<E>
           
 
Method Summary
abstract  E fromString(java.lang.String s)
          Provide an external representation of a string value.
abstract  E getExternal(I i)
          Provide an external representation of an internal value.
abstract  java.lang.Class<E> getExternalType()
          Returns the external class type.
abstract  I getInternal(E e)
          Provide an internal representation of an external value.
abstract  java.lang.Class<I> getInternalType()
          Returns the internal class type.
abstract  java.lang.String toString(E e)
          Provide a string representation of an external value.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getInternalType

public abstract java.lang.Class<I> getInternalType()
Returns the internal class type.

Returns:
the internal class type

getExternalType

public abstract java.lang.Class<E> getExternalType()
Returns the external class type.

Returns:
the external class type

getInternal

public abstract I getInternal(E e)
                       throws TypeConversionException
Provide an internal representation of an external value.

Parameters:
e - the external value
Returns:
the internal value
Throws:
TypeConversionException - anything that would prevent the conversion

getExternal

public abstract E getExternal(I i)
                       throws TypeConversionException
Provide an external representation of an internal value.

Parameters:
i - the internal value
Returns:
the external value
Throws:
TypeConversionException - anything that would prevent the conversion

fromString

public abstract E fromString(java.lang.String s)
                      throws TypeConversionException
Provide an external representation of a string value.

Parameters:
s - the string value
Returns:
the external value
Throws:
TypeConversionException - anything that would prevent the conversion

toString

public abstract java.lang.String toString(E e)
                                   throws TypeConversionException
Provide a string representation of an external value.

Parameters:
e - the external value
Returns:
the string value
Throws:
TypeConversionException - anything that would prevent the conversion


Copyright © 2012 eXo Platform SAS. All Rights Reserved.