Interface CyColumn
- All Superinterfaces:
CyIdentifiable
Column Namespaces
A column name can be broken down into two parts, a "namespace" and a "name". The namespace and name can be combined into a String by separating them with a "::", for example: "MyNamespace::MyName". The namespace part is optional, for example the column name "MyName" does not have a namespace. All methods that take a namespace argument will accept null to indicate no namespace. All of the default network columns created by Cytoscape do not have a namespace.
Apps are encouraged to put any columns they create into a namespace. The advantages of doing this are:
- Avoid name collision with other apps.
- Enable UI features based on namespaces.
- Use namespace aware APIs in CyColumn, CyRow and CyTable
Column Naming Rules
Case is ignored when column names are compared, or example "MyColumnName" and "mycolumnname" are equivalent. This also applies to namespaces, for example "MyNamespace::MyName" and "mynamespace::myname" are equivalent.
Whitespace is significant in both the namespace and the name (for historical reasons), for example " mynamespace ::myname" is in the namespace " mynamespace ". The empty string is a valid name for a namespace, for example "::myname" is in the "" namespace. It is highly recommended not to use whitespace in namespace identifiers, stick with alphanumeric characters and underscores.
Pick a namespace identifier that is between 6-15 characters in length that does not contain whitespace or special characters. Good examples are "EnrichmentMap", "clusterMaker" or "WordCloud".
Module: model-api
To use this in your app, include the following dependency in your POM:
<dependency> <groupId>org.cytoscape</groupId> <artifactId>model-api</artifactId> </dependency>
Cytoscape Backwards Compatibility (API Interface): We expect that this interface will be used but not implemented by developers using this interface. As such, we reserve the right to add methods to the interface as part of minor version upgrades. We will not remove methods for any changes other than major version upgrades.
-
Field Summary
Fields inherited from interface org.cytoscape.model.CyIdentifiable
SUID
-
Method Summary
Modifier and TypeMethodDescriptionReturns the default value for the column, possibly null.Class<?>
Returns the data type of the list elements if the column type is List.class otherwise null.getName()
Returns the fully-qualified name of the column.default String
Returns the name portion without the namespace.default String
Returns the namespace of the column, or null if the column does not have a namespace.getTable()
Returns the table for this column.Class<?>
getType()
Returns the data type of the column.<T> List<T>
Returns all the values, some of which may be null, for this given column.Returns information about the virtual column definition of this column.boolean
Returns true if the column is immutable i.e.boolean
Returns true if the column is the primary key, otherwise false.static String
joinColumnName(String namespace, String name)
Joins a namespace and a name string into a fully-qualified column name.void
Change the name of this column.default void
Change the name of this column.static String[]
splitColumnName(String fullyQualifiedName)
Splits a column name into a namespace part and a name part at the first occurrence of a "::".Methods inherited from interface org.cytoscape.model.CyIdentifiable
getSUID
-
Field Details
-
NAMESPACE_SEPARATOR
- See Also:
- Constant Field Values
-
-
Method Details
-
splitColumnName
Splits a column name into a namespace part and a name part at the first occurrence of a "::". If the column name does not contain a "::" then the namespace part will be null. Whitespace is significant. The string "::hello" has "" as the namespace. -
joinColumnName
Joins a namespace and a name string into a fully-qualified column name. For example:joinColumnName("MyNamespace", "MyName")
results in"MyNamespace::MyName"
. -
getName
String getName()Returns the fully-qualified name of the column.- Returns:
- the fully-qualified name of the column.
-
getNamespace
Returns the namespace of the column, or null if the column does not have a namespace. Default columns created by Cytoscape do not have a namespace. -
getNameOnly
Returns the name portion without the namespace. -
setName
Change the name of this column. If another column with a matching name already exists in the same namespace, IllegalArgumentException will be thrown. The check for matching column names is case insensitive.- Parameters:
newName
- the new fully qualified column name- Throws:
IllegalArgumentException
- if the column is immutable
-
setName
Change the name of this column. If another column with a matching name already exists in the same namespace, IllegalArgumentException will be thrown. The check for matching column names is case insensitive.- Parameters:
namespace
- the new namespace, use null to indicate no namespacename
- the new name- Throws:
IllegalArgumentException
- if the column is immutable
-
getType
Class<?> getType()Returns the data type of the column.- Returns:
- the data type of the column.
-
getListElementType
Class<?> getListElementType()Returns the data type of the list elements if the column type is List.class otherwise null.- Returns:
- the data type of the list elements if the column type is List.class otherwise null
-
isPrimaryKey
boolean isPrimaryKey()Returns true if the column is the primary key, otherwise false.- Returns:
- true if the column is the primary key, otherwise false.
-
isImmutable
boolean isImmutable()Returns true if the column is immutable i.e. cannot be deleted or renamed, otherwise false.- Returns:
- true if the column is immutable i.e. cannot be deleted or renamed, otherwise false. Please note that this does not affect the ability to add or modify values in this column!
-
getTable
CyTable getTable()Returns the table for this column.- Returns:
- the table that this column is a part of
-
getValues
Returns all the values, some of which may be null, for this given column. When type is List.class, call getListElementType() get the type of the list elements.- Type Parameters:
T
- the generic type of the column.- Parameters:
type
- the datatype of this column. (You can use getType() to obtain it.)- Returns:
- the values in this column in some arbitrary but consistent order. When type is List.class, a List
- is returned.
-
getVirtualColumnInfo
VirtualColumnInfo getVirtualColumnInfo()Returns information about the virtual column definition of this column. This method will return an instance even if the column is not virtual.- Returns:
- an instance of
VirtualColumnInfo
.
-
getDefaultValue
Object getDefaultValue()Returns the default value for the column, possibly null.- Returns:
- The default value for the column, possibly null.
-