Package com.redwood.scheduler.api.rtx
Class RTXMetadata
- java.lang.Object
-
- com.redwood.scheduler.api.rtx.RTXMetadata
-
- All Implemented Interfaces:
Serializable
public class RTXMetadata extends Object implements Serializable
RTX Metadata: column definitions and sources.- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description RTXMetadata()Create a new empty RTX metadata.RTXMetadata(boolean ignoreCase)Create a new empty RTX metadata and sets case sensitivity flag
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description voidaddColumn(RTXColumn column)Add a new column with the name and type of an existing column, the column will be added to the end of this metadata (ie.voidaddColumn(String columnName, RTXType columnType)Add a new column with the specified name and type, the column will be added to the end of this metadata.voidaddColumn(String columnName, String columnType)Add a new column with the specified name and type, the column will be added to the end of this metadata.voidaddColumn(String columnName, String columnDescription, RTXType columnType)Add a new column with the specified name, description and type, the column will be added to the end of this metadata.voidaddColumns(Collection<RTXColumn> newColumns)Add a new columns based on the input columns, the columns will be added in the order that they occur in the list, to the end of this metadata (ie.voidaddSource(RTXSource source)Add a source.voidaddSource(RTXSource source, String prefix)Add a source.voidaddSources(Collection<RTXSource> newSources)Add multiple sourcesvoidaddSources(Collection<RTXSource> newSources, String prefix)Add multiple sources with a prefix.voidassertAssignableFrom(RTXMetadata another)Deprecated.protected voidassertColumnIndex(int index)voidassertColumnsCompatible(RTXMetadata another)Deprecated.<T> RTXColumn<T>createColumn(String columnName, Class<T> columnClass)Create, add and return a new column with the specified name and type, the column will be added to the end of this metadata.RTXColumngetColumnByIndex(int columnIndex)Get a column by index (0 based).RTXColumngetColumnByName(String columnName)Get a column by name (case-insensitive).intgetColumnIndex(String columnName)Get the index of a column.Map<String,RTXColumn>getColumnMap()Get a map of columns.StringgetColumnName(int columnIndex)Get the name of a column.List<RTXColumn>getColumns()Get a list of columns.RTXTypegetColumnType(int columnIndex)Get the type of a column.RTXTypegetColumnType(String columnName)Get the type of a column.Map<String,RTXSource>getSources()Get a map of all sources.booleanhasColumn(String columnName)Does the metadata contain a column?booleanisReadOnly()Is this metadata read-only?voidsetReadOnly()Make the metadata read only, changing anything after this point will cause an exception to be thrown.StringtoString()
-
-
-
Method Detail
-
setReadOnly
public void setReadOnly()
Make the metadata read only, changing anything after this point will cause an exception to be thrown.
-
addColumn
public void addColumn(RTXColumn column) throws RTXMetadataRuntimeException, RTXMetadataReadOnlyRuntimeException
Add a new column with the name and type of an existing column, the column will be added to the end of this metadata (ie. the index of the input column is ignored).- Parameters:
column- the column to get the name and type from.- Throws:
RTXMetadataRuntimeException- if an error occurs.RTXMetadataReadOnlyRuntimeException- if the metadata is read-only.
-
addColumn
public void addColumn(String columnName, String columnType) throws RTXMetadataRuntimeException, RTXMetadataReadOnlyRuntimeException
Add a new column with the specified name and type, the column will be added to the end of this metadata.- Parameters:
columnName- the column name.columnType- the column type.- Throws:
RTXMetadataRuntimeException- if an error occurs.RTXMetadataReadOnlyRuntimeException- if the metadata is read-only.
-
addColumn
public void addColumn(String columnName, String columnDescription, RTXType columnType) throws RTXMetadataRuntimeException, RTXMetadataReadOnlyRuntimeException
Add a new column with the specified name, description and type, the column will be added to the end of this metadata.- Parameters:
columnName- the column name.columnDescription- the column description.columnType- the column type.- Throws:
RTXMetadataRuntimeException- if an error occurs.RTXMetadataReadOnlyRuntimeException- if the metadata is read-only.
-
addColumn
public void addColumn(String columnName, RTXType columnType) throws RTXMetadataRuntimeException, RTXMetadataReadOnlyRuntimeException
Add a new column with the specified name and type, the column will be added to the end of this metadata.- Parameters:
columnName- the column name.columnType- the column type.- Throws:
RTXMetadataRuntimeException- if an error occurs.RTXMetadataReadOnlyRuntimeException- if the metadata is read-only.
-
createColumn
public <T> RTXColumn<T> createColumn(String columnName, Class<T> columnClass)
Create, add and return a new column with the specified name and type, the column will be added to the end of this metadata.- Parameters:
columnName- the column name.columnClass- the column type.- Returns:
- the new column.
- Throws:
RTXMetadataRuntimeException- if an error occurs.RTXMetadataReadOnlyRuntimeException- if the metadata is read-only.
-
addColumns
public void addColumns(Collection<RTXColumn> newColumns) throws RTXMetadataRuntimeException, RTXMetadataReadOnlyRuntimeException
Add a new columns based on the input columns, the columns will be added in the order that they occur in the list, to the end of this metadata (ie. the index of on each input column is ignored).- Parameters:
newColumns- the columns to get the name and type from.- Throws:
RTXMetadataRuntimeException- if an error occurs.RTXMetadataReadOnlyRuntimeException- if the metadata is read-only.
-
getColumnByIndex
public RTXColumn getColumnByIndex(int columnIndex) throws RTXColumnRuntimeException
Get a column by index (0 based).- Parameters:
columnIndex- the index (0 based).- Returns:
- the column if it exists.
- Throws:
RTXColumnRuntimeException- if the column does not exist.
-
getColumnByName
public RTXColumn getColumnByName(String columnName) throws RTXColumnRuntimeException
Get a column by name (case-insensitive).- Parameters:
columnName- the index (case-insensitive).- Returns:
- the column if it exists.
- Throws:
RTXColumnRuntimeException- if the column does not exist.
-
getColumns
public List<RTXColumn> getColumns()
Get a list of columns.- Returns:
- an unmodifiable list of columns, the columns themselves are modifiable if the metadata is.
-
getColumnMap
public Map<String,RTXColumn> getColumnMap()
Get a map of columns.- Returns:
- an unmodifiable map of columns, the key is the column name (in lower case), the value is the column, the columns themselves are modifiable if the metadata is.
-
assertColumnIndex
protected void assertColumnIndex(int index) throws RTXColumnRuntimeException- Throws:
RTXColumnRuntimeException
-
getColumnIndex
public int getColumnIndex(String columnName) throws RTXColumnRuntimeException
Get the index of a column.- Parameters:
columnName- the name of the column (case insensitive)- Returns:
- the column index.
- Throws:
RTXColumnRuntimeException- if the column does not exist.
-
hasColumn
public boolean hasColumn(String columnName)
Does the metadata contain a column?- Parameters:
columnName- the name of the column (case insensitive)- Returns:
- true if the column is in the metadata, false otherwise.
-
getColumnName
public String getColumnName(int columnIndex) throws RTXColumnRuntimeException
Get the name of a column.- Parameters:
columnIndex- the index of the column (0 based)- Returns:
- the column index.
- Throws:
RTXColumnRuntimeException- if the column does not exist.
-
getColumnType
public RTXType getColumnType(int columnIndex) throws RTXColumnRuntimeException
Get the type of a column.- Parameters:
columnIndex- the index of the column (0 based)- Returns:
- the column index.
- Throws:
RTXColumnRuntimeException- if the column does not exist.
-
getColumnType
public RTXType getColumnType(String columnName) throws RTXColumnRuntimeException
Get the type of a column.- Parameters:
columnName- the name of the column (case insensitive)- Returns:
- the column index.
- Throws:
RTXColumnRuntimeException- if the column does not exist.
-
getSources
public Map<String,RTXSource> getSources()
Get a map of all sources.- Returns:
- a map of all sources.
-
addSource
public void addSource(RTXSource source) throws RTXMetadataRuntimeException, RTXMetadataReadOnlyRuntimeException
Add a source.- Parameters:
source- the source to add- Throws:
RTXMetadataRuntimeException- if an error occurs.RTXMetadataReadOnlyRuntimeException- if the metadata is read only.
-
addSource
public void addSource(RTXSource source, String prefix) throws RTXMetadataRuntimeException, RTXMetadataReadOnlyRuntimeException
Add a source.- Parameters:
source- the source to addprefix- the prefix to use for identifiers.- Throws:
RTXMetadataRuntimeException- if an error occurs.RTXMetadataReadOnlyRuntimeException- if the metadata is read only.
-
addSources
public void addSources(Collection<RTXSource> newSources) throws RTXMetadataRuntimeException, RTXMetadataReadOnlyRuntimeException
Add multiple sources- Parameters:
newSources- multiple sources.- Throws:
RTXMetadataRuntimeException- if an error occurs.RTXMetadataReadOnlyRuntimeException- if the metadata is read only.
-
addSources
public void addSources(Collection<RTXSource> newSources, String prefix) throws RTXMetadataRuntimeException, RTXMetadataReadOnlyRuntimeException
Add multiple sources with a prefix.- Parameters:
newSources- multiple sources.prefix- the prefix to use.- Throws:
RTXMetadataRuntimeException- if an error occurs.RTXMetadataReadOnlyRuntimeException- if the metadata is read only.
-
assertColumnsCompatible
@Deprecated public void assertColumnsCompatible(RTXMetadata another) throws RTXIncompatibleColumnException
Deprecated.- Throws:
RTXIncompatibleColumnException
-
assertAssignableFrom
@Deprecated public void assertAssignableFrom(RTXMetadata another) throws RTXIncompatibleColumnException
Deprecated.- Throws:
RTXIncompatibleColumnException
-
isReadOnly
public boolean isReadOnly()
Is this metadata read-only?- Returns:
- true if it is read-only, false otherwise.
-
-