Class ObjectArrayColumn
- java.lang.Object
-
- org.apache.druid.query.rowsandcols.column.ObjectArrayColumn
-
-
Constructor Summary
Constructors Constructor Description ObjectArrayColumn(Object[] objects, ColumnType resultType)
ObjectArrayColumn(Object[] objects, ColumnType resultType, Comparator<Object> comparator)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description <T> T
as(Class<? extends T> clazz)
Asks the Column to return itself as a concrete implementation of a specific interface.Object[]
getObjects()
Gets the underlying object array.ColumnAccessor
toAccessor()
Returns the column as aColumnAccessor
.
-
-
-
Constructor Detail
-
ObjectArrayColumn
public ObjectArrayColumn(Object[] objects, ColumnType resultType)
-
ObjectArrayColumn
public ObjectArrayColumn(Object[] objects, ColumnType resultType, Comparator<Object> comparator)
-
-
Method Detail
-
getObjects
public Object[] getObjects()
Gets the underlying object array. This method is exposed on the concrete class explicitly to allow for mutation. This class does absolutely nothing to ensure that said mutation of the array is valid. It is up to the caller that is choosing to do this mutation to make sure that it is safe.- Returns:
- the object array backing this column
-
toAccessor
@Nonnull public ColumnAccessor toAccessor()
Description copied from interface:Column
Returns the column as aColumnAccessor
. Semantically, this would be equivalent to callingColumn.as(ColumnAccessor.class)
. However, being able to implement this interface is part of the explicit contract of implementing this interface, so instead of relying onColumn.as(java.lang.Class<? extends T>)
which allows for returning null, we define a top-level method that should never return null.- Specified by:
toAccessor
in interfaceColumn
- Returns:
- a
ColumnAccessor
representation of the column, this should never return null.
-
as
@Nullable public <T> T as(Class<? extends T> clazz)
Description copied from interface:Column
Asks the Column to return itself as a concrete implementation of a specific interface. The interface asked for will tend to be a semantically-meaningful interface. This method allows the calling code to interrogate the Column object about whether it can offer a meaningful optimization of the semantic interface. If a Column cannot do anything specifically optimal for the interface requested, it should return null instead of trying to come up with its own default implementation.- Specified by:
as
in interfaceColumn
- Type Parameters:
T
- The interface that the calling code wants a concrete implementation of- Parameters:
clazz
- A class object representing the interface that the calling code wants a concrete implementation of- Returns:
- A concrete implementation of the interface, or null if there is no meaningful optimization to be had through a local implementation of the interface.
-
-