Package docking.widgets.table.constraint
Class ColumnTypeMapper<T,M>
- java.lang.Object
-
- docking.widgets.table.constraint.ColumnTypeMapper<T,M>
-
- Type Parameters:
T
- The column type that has no inherentColumnConstraint
for filtering that column type.M
- The column type to map to that already hasColumnConstraint
s 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 java.lang.Object implements ExtensionPoint
ColumnConstraintTypeMappers allows columns of one type be filterable using an existingColumnConstraint
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. SeeNumberColumnConstraintProvider
for an example of how to create these ColumnConstraints and their associated editors.
-
-
Constructor Summary
Constructors Modifier Constructor Description ColumnTypeMapper()
protected
ColumnTypeMapper(java.lang.Class<T> sourceType, java.lang.Class<M> destinationType)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description abstract M
convert(T value)
Converts an object of type T1 to an object of type T2boolean
equals(java.lang.Object obj)
java.lang.Class<M>
getDestinationType()
Returns the class of the objects that this mapper will convert to.java.lang.Class<T>
getSourceType()
Returns the class of the objects that this mapper will convert from.int
hashCode()
-
-
-
Method Detail
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equals
in classjava.lang.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 java.lang.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 java.lang.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.
-
-