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-2024 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
-
Constructor Summary
-
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.
-
Constructor Details
-
Adapters
public Adapters()
-
-
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<T>; class of the output type of the adapter.- Returns:
- ExpressionAdapter<T, ?>; 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<T>; class of the output type of the adapter.adapter
- ExpressionAdapter<T, ?>; adapter.
-