Package ch.ivyteam.ivy.scripting.objects
Class Record
- java.lang.Object
-
- ch.ivyteam.ivy.scripting.objects.NestedObject
-
- ch.ivyteam.ivy.scripting.objects.Record
-
- All Implemented Interfaces:
IIvyDataObject,Serializable,Cloneable
public final class Record extends NestedObject
Records are rows in DB tables.- See Also:
- Serialized Form
- API:
- This is a public API.
-
-
Constructor Summary
Constructors Constructor Description Record()Creates an empty uninitialized record.Record(String[] _keys, Object[] _values)Creates a new Record with given initial values.Record(List<String> _keys, List<? extends Object> _values)Creates a new Record with given initial values.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Recordclone()Clones this record (shallow copy).RecorddeepClone()Clones this record (deep copy).ObjectgetField(String key)Retuns the value of a given field.intgetFieldIndex(String keyStr)Computes the index of a field.List<String>getKeys()Returns (a copy of) the keys of this Record.List<Object>getValues()Returns (a copy of) the values of this Record.booleanisEmpty()Tests whether the record is empty.voidputField(String key, Object value)Set the value of a field.intsize()Returns the size of this recordset.-
Methods inherited from class ch.ivyteam.ivy.scripting.objects.NestedObject
equals, hashCode, toString
-
-
-
-
Constructor Detail
-
Record
public Record()
Creates an empty uninitialized record.- API:
- This public API is available in IvyScript and Java. It has the visibility NOVICE.
-
Record
public Record(String[] _keys, Object[] _values)
Creates a new Record with given initial values.- Parameters:
_keys- The keys of the record._values- The values of the record. The parameter list must be of the same size.- API:
- This public API is available in IvyScript and Java. It has the visibility NOVICE.
-
Record
public Record(List<String> _keys, List<? extends Object> _values)
Creates a new Record with given initial values.- Parameters:
_keys- The keys of the record._values- The values of the record. The parameter list must be of the same size.- API:
- This public API is available in IvyScript and Java. It has the visibility NOVICE.
-
-
Method Detail
-
getField
public Object getField(String key)
Retuns the value of a given field.- Parameters:
key- The name of the field.- Returns:
- The value of the field.
- API:
- This public API is available in IvyScript and Java. It has the visibility NOVICE.
-
putField
public void putField(String key, Object value)
Set the value of a field. If already a filed of this name exists, the value of this field is overwritten; otherwise, a new field is created in this record. The search for a key is not case-sensitive.- Parameters:
key- The key of a field.value- The new value of the field.- API:
- This public API is available in IvyScript and Java. It has the visibility NOVICE.
-
getKeys
public List<String> getKeys()
Returns (a copy of) the keys of this Record.- Returns:
- A List with keys.
- API:
- This public API is available in IvyScript and Java. It has the visibility NOVICE.
-
getValues
public List<Object> getValues()
Returns (a copy of) the values of this Record.- Returns:
- A List with values.
- API:
- This public API is available in IvyScript and Java. It has the visibility NOVICE.
-
getFieldIndex
public int getFieldIndex(String keyStr)
Computes the index of a field. The search is not case-sensitive.- Parameters:
keyStr- the key whose value you want- Returns:
- index of the field if the field is not found -1
- API:
- This public API is available in IvyScript and Java. It has the visibility NOVICE.
-
size
public int size()
Returns the size of this recordset.- Returns:
- The size of this recordset.
- API:
- This public API is available in IvyScript and Java. It has the visibility NOVICE.
-
isEmpty
public boolean isEmpty()
Tests whether the record is empty.- Returns:
- True if this record is empty.
- API:
- This public API is available in IvyScript and Java. It has the visibility NOVICE.
-
clone
public Record clone()
Clones this record (shallow copy).- Specified by:
clonein interfaceIIvyDataObject- Overrides:
clonein classNestedObject- Returns:
- A shallow of this object.
- See Also:
Object.clone()- API:
- This public API is available in IvyScript and Java. It has the visibility NOVICE.
-
deepClone
public Record deepClone()
Clones this record (deep copy).- Specified by:
deepClonein interfaceIIvyDataObject- Overrides:
deepClonein classNestedObject- Returns:
- A deep of this object.
- API:
- This public API is available in IvyScript and Java. It has the visibility NOVICE.
-
-