1 package org.opentrafficsim.xml.bindings; 2 3 import org.opentrafficsim.xml.bindings.types.BooleanType; 4 5 /** 6 * Adapter for Boolean expression type. 7 * <p> 8 * Copyright (c) 2023-2024 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved. <br> 9 * BSD-style license. See <a href="https://opentrafficsim.org/docs/license.html">OpenTrafficSim License</a>. 10 * </p> 11 * @author <a href="https://github.com/wjschakel">Wouter Schakel</a> 12 */ 13 public class BooleanAdapter extends ExpressionAdapter<Boolean, BooleanType> 14 { 15 16 /** {@inheritDoc} */ 17 @Override 18 public BooleanType unmarshal(final String field) 19 { 20 if (isExpression(field)) 21 { 22 return new BooleanType(trimBrackets(field)); 23 } 24 return new BooleanType(Boolean.valueOf(field)); 25 } 26 27 }