Class ColumnTypeMapper<T,M>

java.lang.Object
docking.widgets.table.constraint.ColumnTypeMapper<T,M>
Type Parameters:
T - The column type that has no inherent ColumnConstraint for filtering that column type.
M - The column type to map to that already has ColumnConstraints defined for that type.
All Implemented Interfaces:
ExtensionPoint
Direct Known Subclasses:
AddressBasedLocationColumnTypeMapper, DataTypeColumnTypeMapper, DateColumnTypeMapper, FloatColumnTypeMapper, NamespaceColumnTypeMapper, ObjectToStringMapper, ProgramLocationColumnTypeMapper, ScalarToLongColumnTypeMapper, SymbolColumnTypeMapper

public abstract class ColumnTypeMapper<T,M> extends Object implements ExtensionPoint
ColumnConstraintTypeMappers allows columns of one type be filterable using an existing ColumnConstraint for a different type by defining a mapping from the column type to the desired filter type. To get the benefit of one of these mappers, all that is required is to implement one of these mappers. The mapper class must be public and it's name must end in "TypeMapper".

For example, if you have a column type of "Person" that holds various information about a person including their age and you want to filter on their age, you could define a ColumnTypeMapper that converts a "Person" to an int. Just by creating such a mapper class, any table with "Person" column types would now be able to filter on a person's age.

In the example above, you created a filter of a single attribute of person. If, however, you want more than that, you could instead create a new ColumnConstraint that filters on more attributes of a Person. See NumberColumnConstraintProvider for an example of how to create these ColumnConstraints and their associated editors.

  • Constructor Details

    • ColumnTypeMapper

      public ColumnTypeMapper()
    • ColumnTypeMapper

      protected ColumnTypeMapper(Class<T> sourceType, Class<M> destinationType)
  • Method Details

    • toString

      public String toString()
      Overrides:
      toString in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • convert

      public abstract M convert(T value)
      Converts an object of type T1 to an object of type T2
      Parameters:
      value - the object to convert.
      Returns:
      the converted object.
    • getSourceType

      public final Class<T> getSourceType()
      Returns the class of the objects that this mapper will convert from.
      Returns:
      the class of the objects that this mapper will convert from.
    • getDestinationType

      public final Class<M> getDestinationType()
      Returns the class of the objects that this mapper will convert to.
      Returns:
      the class of the objects that this mapper will convert to.