Class UnitAdapter

java.lang.Object
javax.xml.bind.annotation.adapters.XmlAdapter<String,javax.measure.Unit<?>>
org.apache.sis.internal.jaxb.gco.UnitAdapter
Direct Known Subclasses:
UnitAdapter.ForCS, UnitAdapter.Since2014

public class UnitAdapter extends XmlAdapter<String,javax.measure.Unit<?>>
JAXB adapter for unit of measurement.
Since:
0.3
Version:
1.0
See Also:
  • Constructor Details

    • UnitAdapter

      public UnitAdapter()
      Invoked by reflection by JAXB.
  • Method Details

    • unmarshal

      public final javax.measure.Unit<?> unmarshal(String value) throws IllegalArgumentException
      Returns a unit for the given string.
      Specified by:
      unmarshal in class XmlAdapter<String,javax.measure.Unit<?>>
      Parameters:
      value - the unit symbol.
      Returns:
      the unit for the given symbol.
      Throws:
      IllegalArgumentException - if the given symbol is unknown.
    • marshal

      public String marshal(javax.measure.Unit<?> value)
      Returns the symbol of the given unit.
      Specified by:
      marshal in class XmlAdapter<String,javax.measure.Unit<?>>
      Parameters:
      value - the unit.
      Returns:
      the unit symbol.