Package org.vast.data
Class DataBlockProxy
java.lang.Object
org.vast.data.DataBlockProxy
- All Implemented Interfaces:
InvocationHandler
,IDataAccessor
This class dynamically generates an accessor with Java Dynamic Proxy Classes using a data component schema and an interface with annotations that maps get/set methods to component paths.
The SweComponent
annotation must be used. When omitted, the
generator will try to infer the name of the component from the get/set method
name and look for a corresponding component at the root of the record.
The following data types are supported in get/set methods: - All primitive types - java.time.Instant - java.lang.Date - JTS geometries - SWE vector, quaternion, matrix, etc. - primitive arrays?
TODO more efficient implementation based on generated methods compiled in memory with Janino or equivalent.- Since:
- Jan 20, 2025
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.vast.data.IDataAccessor
IDataAccessor.SweMapping
-
Method Summary
Modifier and TypeMethodDescriptionprotected DataArray
assertDataArray
(Method m, DataComponent comp) protected Instant
convertToInstant
(DataBlock data) protected Collection<IDataAccessor>
createCollection
(Class<IDataAccessor> clazz, DataArray array) protected IDataAccessor
createElementProxy
(Class<IDataAccessor> clazz, DataComponent arrayElt) protected DataComponent
static <T extends IDataAccessor>
Tgenerate
(DataComponent recordSchema, Class<T> targetInterface) protected boolean
protected boolean
protected boolean
protected boolean
protected void
setFromInstant
(DataBlock data, Instant ts) toString()
void
-
Method Details
-
generate
public static <T extends IDataAccessor> T generate(DataComponent recordSchema, Class<T> targetInterface) -
invoke
- Specified by:
invoke
in interfaceInvocationHandler
-
findComponentData
-
isGetMethod
-
isSetMethod
-
isAddMethod
-
isSetNumMethod
-
convertToInstant
-
setFromInstant
-
createElementProxy
-
createCollection
-
assertDataArray
-
wrap
- Specified by:
wrap
in interfaceIDataAccessor
-
toString
-