public final class TyperUtils extends Object
Modifier and Type | Method and Description |
---|---|
static <T> Map<UUID,T> |
extractRowsOld(Class<T> klazz,
TableUpdates updates,
DatabaseSchema dbSchema)
This method extracts all row updates of Class<T> klazz from a TableUpdates
that correspond to old version of rows of type klazz that have been updated.
|
static <T> Map<UUID,T> |
extractRowsRemoved(Class<T> klazz,
TableUpdates updates,
DatabaseSchema dbSchema)
This method extracts all row updates of Class<T> klazz from a TableUpdates
that correspond to removal of rows of type klazz.
|
static <T> Map<UUID,T> |
extractRowsUpdated(Class<T> klazz,
TableUpdates updates,
DatabaseSchema dbSchema)
This method extracts all row updates of Class<T> klazz from a TableUpdates
that correspond to insertion or updates of rows of type klazz.
|
static Map<UUID,TableUpdate.RowUpdate<GenericTableSchema>> |
extractRowUpdates(Class<?> klazz,
TableUpdates updates,
DatabaseSchema dbSchema)
This method extracts all RowUpdates of Class<T> klazz from a TableUpdates
that correspond to rows of type klazz.
|
static Version |
getColumnFromVersion(Method method) |
static ColumnSchema<GenericTableSchema,Object> |
getColumnSchema(GenericTableSchema tableSchema,
String columnName,
Class<Object> metaClass) |
static Version |
getColumnUntilVersion(Method method) |
static <T> Version |
getTableFromVersion(Class<T> klazz) |
static GenericTableSchema |
getTableSchema(DatabaseSchema dbSchema,
Class<?> klazz)
Retrieve the table schema for the given table in the given database schema.
|
static <T> Version |
getTableUntilVersion(Class<T> klazz) |
static <T> T |
getTypedRowWrapper(DatabaseSchema dbSchema,
Class<T> klazz)
Returns a Typed Proxy implementation for the klazz passed as a parameter.
|
static <T> T |
getTypedRowWrapper(DatabaseSchema dbSchema,
Class<T> klazz,
Row<GenericTableSchema> row)
Returns a Typed Proxy implementation for the klazz passed as a parameter.
|
public static GenericTableSchema getTableSchema(DatabaseSchema dbSchema, Class<?> klazz)
dbSchema
- The database schema.klazz
- The class whose table schema should be retrieved. Classes are matched in the database schema either
using their TypedTable
annotation, if they have one, or by name.public static ColumnSchema<GenericTableSchema,Object> getColumnSchema(GenericTableSchema tableSchema, String columnName, Class<Object> metaClass)
public static <T> T getTypedRowWrapper(DatabaseSchema dbSchema, Class<T> klazz)
Being just a wrapper, it is state-less and more of a convenience functionality to provide a type-safe infrastructure for the applications to built on top of. And this Typed infra is completely optional.
It is the applications responsibility to pass on the raw Row parameter and this method will return the appropriate Proxy wrapper for the passed klazz Type. The raw Row parameter may be null if the caller is interested in just the ColumnSchema. But that is not a very common use-case.
dbSchema
- DatabaseSchema as learnt from a OVSDB connectionklazz
- Typed Class that represents a Tablepublic static <T> T getTypedRowWrapper(DatabaseSchema dbSchema, Class<T> klazz, Row<GenericTableSchema> row)
Being just a wrapper, it is state-less and more of a convenience functionality to provide a type-safe infrastructure for the applications to built on top of. And this Typed infra is completely optional.
It is the applications responsibility to pass on the raw Row parameter and this method will return the appropriate Proxy wrapper for the passed klazz Type. The raw Row parameter may be null if the caller is interested in just the ColumnSchema. But that is not a very common use-case.
dbSchema
- DatabaseSchema as learnt from a OVSDB connectionklazz
- Typed Class that represents a Tablerow
- The actual Row that the wrapper is operating on. It can be null if the caller
is just interested in getting ColumnSchema.public static <T> Map<UUID,T> extractRowsUpdated(Class<T> klazz, TableUpdates updates, DatabaseSchema dbSchema)
Map<UUID,Bridge> updatedBridges = extractRowsUpdated(Bridge.class,updates,dbSchema)
klazz
- Class for row type to be extractedupdates
- TableUpdates from which to extract rowUpdatesdbSchema
- Dbschema for the TableUpdatespublic static <T> Map<UUID,T> extractRowsOld(Class<T> klazz, TableUpdates updates, DatabaseSchema dbSchema)
Map<UUID,Bridge> oldBridges = extractRowsOld(Bridge.class,updates,dbSchema)
klazz
- Class for row type to be extractedupdates
- TableUpdates from which to extract rowUpdatesdbSchema
- Dbschema for the TableUpdatespublic static <T> Map<UUID,T> extractRowsRemoved(Class<T> klazz, TableUpdates updates, DatabaseSchema dbSchema)
Map<UUID,Bridge> updatedBridges = extractRowsRemoved(Bridge.class,updates,dbSchema)
klazz
- Class for row type to be extractedupdates
- TableUpdates from which to extract rowUpdatesdbSchema
- Dbschema for the TableUpdatespublic static Map<UUID,TableUpdate.RowUpdate<GenericTableSchema>> extractRowUpdates(Class<?> klazz, TableUpdates updates, DatabaseSchema dbSchema)
Map<UUID,TableUpdate<GenericTableSchema>.RowUpdate<GenericTableSchema>> updatedBridges =
extractRowsUpdates(Bridge.class,updates,dbSchema)
klazz
- Class for row type to be extractedupdates
- TableUpdates from which to extract rowUpdatesdbSchema
- Dbschema for the TableUpdatesCopyright © 2019 OpenDaylight. All rights reserved.