Class Adapters
java.lang.Object
org.opentrafficsim.editor.extensions.Adapters
Class that houses static instances of adapters, for common usage within the editor.
Copyright (c) 2023-2026 Delft University of Technology, PO Box 5, 2600 AA, Delft, the Netherlands. All rights reserved.
BSD-style license. See OpenTrafficSim License.
- Author:
- Alexander Verbraeck, Wouter Schakel
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final DoublePositiveAdapterAdapter for positive doubles, excluding 0.0.static final DoublePositiveInclusiveAdapterAdapter for positive doubles, including 0.0. -
Method Summary
Modifier and TypeMethodDescriptionstatic <T,E extends ExpressionType<T>>
ExpressionAdapter<T,E> Returns an adapter for the given class.static <T,E extends ExpressionType<T>>
voidset(Class<T> clazz, ExpressionAdapter<T, E> adapter) Add an adapter for the given class.
-
Field Details
-
DOUBLE_POSITIVE_ADAPTER
Adapter for positive doubles, excluding 0.0. -
DOUBLE_POSITIVE_INCLUSIVE_ADAPTER
Adapter for positive doubles, including 0.0.
-
-
Method Details
-
get
Returns an adapter for the given class. Adapters are only provided for known classes. This is to limit the number of adapters in memory, as these are stateless. Adapters are available for: Angle, ArcDirection, Boolean, Direction, Double, Integer, Length, LinearDensity, Point2d, String, and Stripe.Type.- Type Parameters:
T- output type of the adapter.E- expression type of the adapter.- Parameters:
clazz- class of the output type of the adapter.- Returns:
- adapter.
-
set
public static <T,E extends ExpressionType<T>> void set(Class<T> clazz, ExpressionAdapter<T, E> adapter) Add an adapter for the given class.- Type Parameters:
T- output type of the adapter.E- expression type of the adapter.- Parameters:
clazz- class of the output type of the adapter.adapter- adapter.
-