Class MongoDbColumn

  • All Implemented Interfaces:
    DbColumn

    public final class MongoDbColumn
    extends Object
    implements DbColumn
    Mongo specific column data and metadata.
    • Method Detail

      • as

        public <T> T as​(Class<T> type)
                 throws MapperException
        Description copied from interface: DbColumn
        Typed value of this column. This method can return a correct result only if the type is the same as DbColumn.javaType() or there is a Mapper registered that can map it.
        Specified by:
        as in interface DbColumn
        Type Parameters:
        T - type of the returned value
        Parameters:
        type - class of the type that should be returned (must be supported by the underlying data type)
        Returns:
        value of this column correctly typed
        Throws:
        MapperException - in case the type is not the underlying DbColumn.javaType() and there is no mapper registered for it
      • as

        public <T> T as​(GenericType<T> type)
                 throws MapperException
        Description copied from interface: DbColumn
        Value of this column as a generic type. This method can return a correct result only if the type represents a class, or if there is a Mapper registered that can map underlying DbColumn.javaType() to the type requested.
        Specified by:
        as in interface DbColumn
        Type Parameters:
        T - type of the returned value
        Parameters:
        type - requested type
        Returns:
        value mapped to the expected type if possible
        Throws:
        MapperException - in case the mapping cannot be done
      • javaType

        public Class<?> javaType()
        Description copied from interface: DbColumn
        Type of the column as would be returned by the underlying database driver.
        Specified by:
        javaType in interface DbColumn
        Returns:
        class of the type
        See Also:
        DbColumn.dbType()
      • dbType

        public String dbType()
        Description copied from interface: DbColumn
        Type of the column in the language of the database.

        Example for SQL - if a column is declared as VARCHAR(256) in the database, this method would return VARCHAR and method DbColumn.javaType() would return String.

        Specified by:
        dbType in interface DbColumn
        Returns:
        column type as the database understands it
      • name

        public String name()
        Description copied from interface: DbColumn
        Column name.
        Specified by:
        name in interface DbColumn
        Returns:
        name of this column