Package io.tiledb.java.api
Class Attribute
- java.lang.Object
-
- io.tiledb.java.api.Attribute
-
- All Implemented Interfaces:
java.lang.AutoCloseable
public class Attribute extends java.lang.Object implements java.lang.AutoCloseable
Describes an Attribute of an Array cell.An Attribute specifies a datatype for a particular parameter in each array cell. There are 3 supported Attribute types:
- Fundamental types: Character, String, Byte, Boolean, Short, Integer, Long, Double and Float.
- Fixed sized arrays of the above types.
- Variable length arrays of the above types.
Context ctx = new Context(); Attribute a1 = new Attribute(ctx,"a1",Integer.class); Attribute a2 = new Attribute(ctx,"a2",Character.class); Attribute a3 = new Attribute(ctx,"a3",Float.class); // Change compression scheme a1.setFilterList(new FilterList(ctx).addFilter(new LZ4Filter(ctx))); a2.setCellValNum(TILEDB_VAR_NUM); // Variable sized character attribute (String) a3.setCellValNum(2); // 2 floats stored per cell ArraySchema schema = new ArraySchema(ctx, TILEDB_DENSE); schema.setDomain(domain); schema.addAttribute(a1); schema.addAttribute(a2); schema.addAttribute(a3);
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
Attribute(Context ctx, SWIGTYPE_p_p_tiledb_attribute_t attributepp)
Attribute(Context ctx, java.lang.String name, Datatype attrType)
Construct an attribute with name and TileDB Datatype.Attribute(Context ctx, java.lang.String name, java.lang.Class attrType)
Construct an attribute with a name and java class type.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
Free's native TileDB resources associated with the Attribute objectprotected SWIGTYPE_p_tiledb_attribute_t
getAttributep()
long
getCellSize()
long
getCellValNum()
FilterList
getFilterList()
Gets the list of filtes associated with the attributejava.lang.String
getName()
Datatype
getType()
boolean
isVar()
Attribute
setCellValNum(long size)
Sets the number of Attribute values per cell.Attribute
setCellVar()
Sets the Attribute to have variable length cell representationAttribute
setFilterList(FilterList filters)
Sets the Attribute FilterList.java.lang.String
toString()
-
-
-
Constructor Detail
-
Attribute
public Attribute(Context ctx, java.lang.String name, java.lang.Class attrType) throws TileDBError
Construct an attribute with a name and java class type. `cellValNum` will be set to 1.- Parameters:
ctx
- TileDB contextname
- Name of the attributeattrType
- Java class type of the attribute- Throws:
TileDBError
- A TileDB exception
-
Attribute
public Attribute(Context ctx, java.lang.String name, Datatype attrType) throws TileDBError
Construct an attribute with name and TileDB Datatype. `cellValNum` will be set to 1.- Parameters:
ctx
- TileDB Contextname
- Name of the attributeattrType
- TileDB Datatype of attribute- Throws:
TileDBError
- A TileDB exception
-
Attribute
protected Attribute(Context ctx, SWIGTYPE_p_p_tiledb_attribute_t attributepp) throws TileDBError
- Throws:
TileDBError
-
-
Method Detail
-
getAttributep
protected SWIGTYPE_p_tiledb_attribute_t getAttributep()
-
getName
public java.lang.String getName() throws TileDBError
- Returns:
- The name of the Attribute.
- Throws:
TileDBError
- A TileDB exception
-
getType
public Datatype getType() throws TileDBError
- Returns:
- The Attribute Enumerated datatype (TileDB type).
- Throws:
TileDBError
- A TileDB exception
-
getCellSize
public long getCellSize() throws TileDBError
- Returns:
- The size (in bytes) of one cell on this Attribute.
- Throws:
TileDBError
- A TileDB exception
-
getCellValNum
public long getCellValNum() throws TileDBError
- Returns:
- The number of values stored in each cell. This is equal to the size of the Attribute * sizeof(attributeType). For variable size attributes this is TILEDB_VAR_NUM.
- Throws:
TileDBError
- A TileDB exception
-
isVar
public boolean isVar() throws TileDBError
- Returns:
- True if this is a variable length Attribute.
- Throws:
TileDBError
- A TileDB exception
-
setCellValNum
public Attribute setCellValNum(long size) throws TileDBError
Sets the number of Attribute values per cell.- Parameters:
size
- The number of values per cell. Use TILEDB_VAR_NUM for variable length.- Throws:
TileDBError
- A TileDB exception
-
setCellVar
public Attribute setCellVar() throws TileDBError
Sets the Attribute to have variable length cell representation- Returns:
- Attribute
- Throws:
TileDBError
- A TileDB exception
-
setFilterList
public Attribute setFilterList(FilterList filters) throws TileDBError
Sets the Attribute FilterList.- Parameters:
filters
- A TileDB FilterList- Throws:
TileDBError
- A TileDB exception
-
getFilterList
public FilterList getFilterList() throws TileDBError
Gets the list of filtes associated with the attribute- Returns:
- A FilterList instance
- Throws:
TileDBError
- A TileDB exception
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
- Returns:
- A String representation for the Attribute.
-
close
public void close()
Free's native TileDB resources associated with the Attribute object- Specified by:
close
in interfacejava.lang.AutoCloseable
-
-