AccelerationAdapter.java

  1. package org.opentrafficsim.xml.bindings;

  2. import org.djunits.value.vdouble.scalar.Acceleration;
  3. import org.djutils.logger.CategoryLogger;

  4. /**
  5.  * AccelerationAdapter converts between the XML String for an Acceleration and the DJUnits Acceleration. <br>
  6.  * <br>
  7.  * Copyright (c) 2003-2022 Delft University of Technology, Jaffalaan 5, 2628 BX Delft, the Netherlands. All rights reserved. See
  8.  * for project information <a href="https://www.simulation.tudelft.nl/" target="_blank">www.simulation.tudelft.nl</a>. The
  9.  * source code and binary code of this software is proprietary information of Delft University of Technology.
  10.  * @author <a href="https://www.tudelft.nl/averbraeck" target="_blank">Alexander Verbraeck</a>
  11.  */
  12. public class AccelerationAdapter extends UnitAdapter<Acceleration>
  13. {
  14.     /** {@inheritDoc} */
  15.     @Override
  16.     public Acceleration unmarshal(final String field) throws IllegalArgumentException
  17.     {
  18.         try
  19.         {
  20.             return Acceleration.valueOf(field);
  21.         }
  22.         catch (Exception exception)
  23.         {
  24.             CategoryLogger.always().error(exception, "Problem parsing Acceleration '" + field + "'");
  25.             throw exception;
  26.         }
  27.     }
  28. }