info.bioinfweb.jphyloio.objecttranslation.implementations

## Class NumericValueTranslator<O extends java.lang.Number>

- java.lang.Object
- - info.bioinfweb.jphyloio.objecttranslation.implementations.AbstractObjectTranslator<O>
  - - info.bioinfweb.jphyloio.objecttranslation.implementations.SimpleValueTranslator<O>
    - - info.bioinfweb.jphyloio.objecttranslation.implementations.NumericValueTranslator<O>

- Type Parameters:
    `O` - the type of Java object this translator instance is able to handle
  All Implemented Interfaces:
    ObjectTranslator<O>
  Direct Known Subclasses:
    BigDecimalTranslator, BigIntegerTranslator, ByteTranslator, DoubleTranslator, FloatTranslator, IntegerTranslator, LongTranslator, ShortTranslator

      public abstract class NumericValueTranslator<O extends java.lang.Number>
      extends SimpleValueTranslator<O>

  Abstract base class for converting numeric types that wrappes `NumberFormatException`s as `InvalidObjectSourceDataException`s.
  Since:
    0.0.0
  Author:
    Ben Stöver

- - ### Field Summary

    - ### Fields inherited from class info.bioinfweb.jphyloio.objecttranslation.implementations.SimpleValueTranslator

      `MAX_STRING_REPRESENTATION_LENGTH`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `NumericValueTranslator()`

  - ### Method Summary

    All Methods Instance Methods Abstract Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected abstract O` | `parseValue(java.lang.String representation, ReaderStreamDataProvider<?> streamDataProvider)`
    `O` | `representationToJava(java.lang.String representation, ReaderStreamDataProvider<?> streamDataProvider)` Converts the specified string representation to a new instance of the according Java object.

    - ### Methods inherited from class info.bioinfweb.jphyloio.objecttranslation.implementations.SimpleValueTranslator

      `hasStringRepresentation, javaToRepresentation, readXMLRepresentation, writeXMLRepresentation`

    - ### Methods inherited from class info.bioinfweb.jphyloio.objecttranslation.implementations.AbstractObjectTranslator

      `equals, hashCode`

    - ### Methods inherited from class java.lang.Object

      `clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait`

    - ### Methods inherited from interface info.bioinfweb.jphyloio.objecttranslation.ObjectTranslator

      `getObjectClass`

- - ### Constructor Detail

    - #### NumericValueTranslator

          public NumericValueTranslator()

  - ### Method Detail

    - #### parseValue

          protected abstract O parseValue(java.lang.String representation,
                                          ReaderStreamDataProvider<?> streamDataProvider)
                                   throws java.lang.NumberFormatException

      Throws:
        `java.lang.NumberFormatException`

    - #### representationToJava

          public O representationToJava(java.lang.String representation,
                                        ReaderStreamDataProvider<?> streamDataProvider)
                                 throws InvalidObjectSourceDataException,
                                        java.lang.UnsupportedOperationException

      Description copied from interface: `ObjectTranslator`
      Converts the specified string representation to a new instance of the according Java object.

      If `#getClass()` returns an interface for this instance, the concrete class of the returned object may depend on the representation.

      Parameters:
        `representation` - the string representation of the object to be created
        `streamDataProvider` - the stream data provider of the calling reader (Maybe `null`. Some translators will use it to gain additional status information required for translating, e.g. prefix to namespace mapping for creating QNames.)
      Returns:
        the new object
      Throws:
        `InvalidObjectSourceDataException` - if the specified string representation cannot be parsed to a supported object
        `java.lang.UnsupportedOperationException` - if objects handled by this instance can only be represented as XML