Record Class StructType
java.lang.Object
java.lang.Record
smile.data.type.StructType
- Record Components:
fields- The struct fields.index- The map of field name to index.
- All Implemented Interfaces:
Serializable, DataType
-
Nested Class Summary
Nested classes/interfaces inherited from interface DataType
DataType.ID -
Constructor Summary
ConstructorsConstructorDescriptionStructType(List<StructField> fields) Constructor.StructType(List<StructField> fields, Map<String, Integer> index) Creates an instance of aStructTyperecord class.StructType(StructField... fields) Constructor. -
Method Summary
Modifier and TypeMethodDescriptionvoidadd(StructField field) Adds a field.apply(int i) Return the i-th field.Return the field of given name.DataType[]dtypes()Returns the field data types.booleanIndicates whether some other object is "equal to" this one.field(int i) Return the i-th field.Return the field of given name.fields()Returns the value of thefieldsrecord component.final inthashCode()Returns a hash code value for this object.id()Returns the type ID enum.index()Returns the value of theindexrecord component.intReturns the ordinal index of a field.intlength()Returns the number of fields.Measure[]measures()Returns the field's level of measurements.name()Returns the type name used in external catalogs.String[]names()Returns the field names.static StructTypeReturns the struct type of record or bean class.static StructTypeReturns a struct data type from JDBC result set meta data.static StructTypeof(ResultSetMetaData meta, String dbms) Returns a struct data type from JDBC result set meta data.static StructTypeReturns the struct type of record or bean class properties.static StructTypeof(ValueVector... columns) Returns the schema of a set of columns.parser()Returns the lambda functions that parse field values.voidRenames a field.voidset(int i, StructField field) Sets a field.toString()Returns a string representation of this record class.Returns the string representation of a value of the type.voidupdate(int i, StructField field) Sets a field.Returns the value from its string representation.Methods inherited from interface DataType
isBoolean, isByte, isChar, isDecimal, isDouble, isFloat, isFloating, isInt, isIntegral, isLong, isNullable, isNumeric, isObject, isPrimitive, isShort, isString
-
Constructor Details
-
StructType
-
StructType
-
StructType
-
-
Method Details
-
of
Returns the schema of a set of columns.- Parameters:
columns- the columns to form a data frame.- Returns:
- the schema.
-
length
public int length()Returns the number of fields.- Returns:
- the number of fields.
-
field
Return the i-th field.- Parameters:
i- the field index.- Returns:
- the field.
-
field
Return the field of given name.- Parameters:
name- the field name.- Returns:
- the field.
-
apply
Return the i-th field. This is an alias tofieldfor Scala's convenience.- Parameters:
i- the field index.- Returns:
- the field.
-
apply
Return the field of given name. This is an alias tofieldfor Scala's convenience.- Parameters:
name- the field name.- Returns:
- the field.
-
set
Sets a field.- Parameters:
i- the field index.field- the new field.
-
update
Sets a field. This is an alias tosetfor Scala's convenience.- Parameters:
i- the field index.field- the new field.
-
rename
-
add
-
indexOf
Returns the ordinal index of a field.- Parameters:
field- the field name.- Returns:
- the index of field.
-
names
-
dtypes
-
measures
Returns the field's level of measurements.- Returns:
- the field's level of measurements.
-
parser
-
name
-
id
Description copied from interface:DataTypeReturns the type ID enum. -
toString
-
toString
-
valueOf
-
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared withObjects::equals(Object,Object). -
of
Returns the struct type of record or bean class.- Parameters:
clazz- the class type of elements.- Returns:
- the struct type.
-
of
Returns the struct type of record or bean class properties.- Parameters:
props- the record or bean class properties.- Returns:
- the struct type.
-
of
Returns a struct data type from JDBC result set meta data.- Parameters:
rs- the JDBC result set.- Returns:
- the struct data type.
- Throws:
SQLException- when JDBC operation fails.
-
of
Returns a struct data type from JDBC result set meta data.- Parameters:
meta- the JDBC result set meta data.dbms- the name of database management system.- Returns:
- the struct data type.
- Throws:
SQLException- when JDBC operation fails.
-
hashCode
-
fields
-
index
-