joperties.interpreters
Class AbstractInterpreter<T>

java.lang.Object
  extended by joperties.interpreters.AbstractInterpreter<T>
Direct Known Subclasses:
AffineTransformInterpreter, BigDecimalInterpreter, BigIntegerInterpreter, BooleanInterpreter, ByteInterpreter, CharacterInterpreter, CollectionInterpreter, ColorInterpreter, DateInterpreter, DimensionInterpreter, DoubleInterpreter, FloatInterpreter, FontInterpreter, GradientPaintInterpreter, IntegerInterpreter, LocaleInterpreter, LongInterpreter, Point2DDInterpreter, Point2DFInterpreter, Point2DInterpreter, PointInterpreter, PolygonInterpreter, RadialGradientPaintInterpreter, RectangleInterpreter, ShortInterpreter, StringBufferInterpreter, StringInterpreter, URIInterpreter, URLInterpreter

public abstract class AbstractInterpreter<T>
extends java.lang.Object

This class is the abstract superclass of all the interpreters.

Author:
Savvas Dalkitsis

Constructor Summary
AbstractInterpreter()
           
 
Method Summary
abstract  java.lang.String encode(T obj)
          This method encodes the provided object to a string.
abstract  java.lang.Class<T> getClassType()
          This method returns the class that this interpreted handles.
abstract  java.lang.String getDescription()
          This method returns a description of the way this interpreter interprets and encodes the objects.
abstract  T interpret(java.lang.String string)
          This method will interpret the provided string as an object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AbstractInterpreter

public AbstractInterpreter()
Method Detail

interpret

public abstract T interpret(java.lang.String string)
                     throws InterpretationException,
                            NoApropriateInterpeterFoundException
This method will interpret the provided string as an object.

Parameters:
string - The string to interpret as an object.
Returns:
An object which corresponds to the provided string.
Throws:
InterpretationException - If there was an error interpreting the string.
NoApropriateInterpeterFoundException - If the method needs to call on other interpreters and none is found.

getClassType

public abstract java.lang.Class<T> getClassType()
This method returns the class that this interpreted handles.

Returns:
The class that this interpreted handles.

encode

public abstract java.lang.String encode(T obj)
                                 throws EncodingException,
                                        NoApropriateInterpeterFoundException
This method encodes the provided object to a string.

Parameters:
obj - The object to encode as a string.
Returns:
The encoded string which corresponds to the provided object.
Throws:
EncodingException - If there was an error encoding the string.
NoApropriateInterpeterFoundException - If the method needs to call on other interpreters and none is found.

getDescription

public abstract java.lang.String getDescription()
This method returns a description of the way this interpreter interprets and encodes the objects. Used as reference.

Returns:
A description of the way this interpreter interprets and encodes the objects. Used as reference.