1 package org.opentrafficsim.xml.bindings;
2
3 import org.djunits.value.vdouble.scalar.Length;
4 import org.opentrafficsim.xml.bindings.types.LengthType;
5
6
7
8
9
10
11
12
13
14
15 public class LengthAdapter extends ScalarAdapter<Length, LengthType>
16 {
17
18
19 @Override
20 public LengthType unmarshal(final String field)
21 {
22 if (isExpression(field))
23 {
24 return new LengthType(trimBrackets(field));
25 }
26 try
27 {
28 return new LengthType(Length.valueOf(field));
29 }
30 catch (Exception exception)
31 {
32 throw exception;
33 }
34 }
35
36 }