View Javadoc
1   package org.opentrafficsim.xml.bindings;
2   
3   import javax.xml.bind.annotation.adapters.XmlAdapter;
4   
5   import org.djunits.value.Scalar;
6   import org.djunits.value.vdouble.scalar.Acceleration;
7   
8   /**
9    * AccelerationAdapter converts between the XML String for an Acceleration and the DJUnits Acceleration. <br>
10   * <br>
11   * Copyright (c) 2003-2018 Delft University of Technology, Jaffalaan 5, 2628 BX Delft, the Netherlands. All rights reserved. See
12   * for project information <a href="https://www.simulation.tudelft.nl/" target="_blank">www.simulation.tudelft.nl</a>. The
13   * source code and binary code of this software is proprietary information of Delft University of Technology.
14   * @author <a href="https://www.tudelft.nl/averbraeck" target="_blank">Alexander Verbraeck</a>
15   */
16  public class AccelerationAdapter extends XmlAdapter<String, Acceleration>
17  {
18      /** {@inheritDoc} */
19      @Override
20      public Acceleration unmarshal(final String field) throws IllegalArgumentException
21      {
22          return Acceleration.valueOf(field);
23      }
24  
25      /** {@inheritDoc} */
26      @Override
27      public String marshal(final Acceleration acceleration) throws IllegalArgumentException
28      {
29          return Scalar.textualStringOfDefaultLocale(acceleration);
30      }
31  
32  }