Class TyperUtils


  • public final class TyperUtils
    extends Object
    Utility methods for typed OVSDB schema data.
    • Method Detail

      • getTableSchema

        @Deprecated
        public static GenericTableSchema getTableSchema​(DatabaseSchema dbSchema,
                                                        Class<?> klazz)
        Deprecated.
        Retrieve the table schema for the given table in the given database schema.
        Parameters:
        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.
        Returns:
        the table schema.
      • getTypedRowWrapper

        @Deprecated
        public static <T extends TypedBaseTable<?>> T getTypedRowWrapper​(DatabaseSchema dbSchema,
                                                                         Class<T> klazz)
        Deprecated.
        Returns a Typed Proxy implementation for the klazz passed as a parameter. Per design choice, the Typed Proxy implementation is just a Wrapper on top of the actual Row which is untyped.

        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.

        Parameters:
        dbSchema - DatabaseSchema as learnt from a OVSDB connection
        klazz - Typed Class that represents a Table
      • getTypedRowWrapper

        @Deprecated
        public static <T extends TypedBaseTable<?>> T getTypedRowWrapper​(DatabaseSchema dbSchema,
                                                                         Class<T> klazz,
                                                                         Row<GenericTableSchema> row)
        Deprecated.
        Returns a Typed Proxy implementation for the klazz passed as a parameter. Per design choice, the Typed Proxy implementation is just a Wrapper on top of the actual Row which is untyped.

        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.

        Parameters:
        dbSchema - DatabaseSchema as learnt from a OVSDB connection
        klazz - Typed Class that represents a Table
        row - The actual Row that the wrapper is operating on. It can be null if the caller is just interested in getting ColumnSchema.
      • extractRowsUpdated

        public static <T extends TypedBaseTable<?>> 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. Example: Map<UUID,Bridge> updatedBridges = extractRowsUpdated(Bridge.class,updates,dbSchema)
        Parameters:
        klazz - Class for row type to be extracted
        updates - TableUpdates from which to extract rowUpdates
        dbSchema - Dbschema for the TableUpdates
        Returns:
        Map<UUID,T> for the type of things being sought
      • extractRowsOld

        public static <T extends TypedBaseTable<?>> 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. Example: Map<UUID,Bridge> oldBridges = extractRowsOld(Bridge.class,updates,dbSchema)
        Parameters:
        klazz - Class for row type to be extracted
        updates - TableUpdates from which to extract rowUpdates
        dbSchema - Dbschema for the TableUpdates
        Returns:
        Map<UUID,T> for the type of things being sought
      • extractRowsRemoved

        public static <T extends TypedBaseTable<?>> 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. Example: Map<UUID,Bridge> updatedBridges = extractRowsRemoved(Bridge.class,updates,dbSchema)
        Parameters:
        klazz - Class for row type to be extracted
        updates - TableUpdates from which to extract rowUpdates
        dbSchema - Dbschema for the TableUpdates
        Returns:
        Map<UUID,T> for the type of things being sought