Package org.apache.sis.util.collection
Class TableColumn<V>
java.lang.Object
org.apache.sis.util.collection.TableColumn<V>
- Type Parameters:
V
- base type of all values in the column identified by this instance.
- All Implemented Interfaces:
CheckedContainer<V>
- Direct Known Subclasses:
Column
,TableColumn.Constant
Identifies a column in
TreeTable.Node
instances.
Each TableColumn
instance contains the column header and the type of values
for a particular column. TableColumn
s are used for fetching values from nodes
as in the following example:
Identity comparisons and serialization
This base class relies on identity comparisons instead of defining theequals(Object)
method, because the element type
is not a sufficient criterion for differentiating the columns (many columns have values
of the same type) and the header is arbitrary. Consequently
developers who create their own instances are encouraged to declare them as static final
constants as in the above example, and use those constants consistently.
This base class is not serializable because the default deserialization mechanism does not resolve automatically the deserialized instances to the above-cited singleton instances. Developers who need serialization support for their own instances have to resolve them in their own subclass. The following example is one possible way to achieve that goal:
The constants defined in this class use a similar approach for providing serialization support.- Since:
- 0.3
- Version:
- 1.0
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static final class
Implementation ofTableColumn
for the predefined constants. -
Field Summary
FieldsModifier and TypeFieldDescription(package private) CharSequence
The column header, ornull
if not yet created.static final TableColumn<String>
Frequently-used constant for a column of object identifiers.static final TableColumn<Integer>
Frequently-used constant for a column of index values.static final TableColumn<CharSequence>
Frequently-used constant for a column of object names.(package private) static final Map<TableColumn<?>,
Integer> A map containing only theNAME
column.static final TableColumn<CharSequence>
Frequently-used constant for a column of remarks.Base type of all values in the column identified by thisColumnTable
instance.static final TableColumn<Class<?>>
Frequently-used constant for a column of object types.static final TableColumn<Object>
Frequently-used constant for a column of object values.static final TableColumn<Number>
Frequently-used constant for a column of object numerical values.static final TableColumn<CharSequence>
Frequently-used constant for a column of object textual values. -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
Invoked on deserialization for creating an initially empty instance.(package private)
TableColumn
(Class<V> type) Creates a new instance for a build-in constant.TableColumn
(Class<V> type, CharSequence header) Creates a new instance for the given type of values. -
Method Summary
Modifier and TypeMethodDescriptionReturns the base type of all values in any column identified by thisTableColumn
instance.org.opengis.util.InternationalString
Returns the text to display as column header.toString()
Returns a string representation of this table column.
-
Field Details
-
NAME
-
IDENTIFIER
-
INDEX
-
TYPE
Frequently-used constant for a column of object types. The column header is "Type" (eventually localized). -
VALUE
Frequently-used constant for a column of object values. The column header is "Value" (eventually localized) and the column elements can be instance of any kind of objects.- See Also:
-
VALUE_AS_TEXT
-
VALUE_AS_NUMBER
Frequently-used constant for a column of object numerical values. The column header is "Value" (eventually localized). -
REMARKS
Frequently-used constant for a column of remarks. The column header is "Remarks" (eventually localized) and the column elements are typically instances ofString
orInternationalString
, depending on whether the data provide localization support or not.- Since:
- 1.0
-
NAME_MAP
A map containing only theNAME
column. This is the default set of columns when parsing a tree table. -
type
Base type of all values in the column identified by thisColumnTable
instance. -
header
CharSequence headerThe column header, ornull
if not yet created.
-
-
Constructor Details
-
TableColumn
protected TableColumn()Invoked on deserialization for creating an initially empty instance. This constructor hasprotected
visibility only because the Java deserialization mechanism requires so; this constructor shall not be invoked in any other context. See the Identity comparisons and serialization section in the class javadoc for more information. -
TableColumn
Creates a new instance for a build-in constant.- Parameters:
type
- base type of all values in the column identified by this instance.
-
TableColumn
Creates a new instance for the given type of values.- Parameters:
type
- base type of all values in the column identified by this instance.header
- the text to display as column header.
-
-
Method Details
-
getHeader
public org.opengis.util.InternationalString getHeader()Returns the text to display as column header.- Returns:
- the text to display as column header.
-
getElementType
Returns the base type of all values in any column identified by thisTableColumn
instance.- Specified by:
getElementType
in interfaceCheckedContainer<V>
- Returns:
- the element type.
-
toString
Returns a string representation of this table column. The default implementation returns the header in its default locale.
-