public class DefaultRecord extends Object implements Record, Serializable
DefaultRecord
instantiation are unspecified. Some may be null, or some may be zero.
DefaultRecord instances are not thread-safe.
Synchronization, if needed, shall be done externally by the caller.RecordType and all
values are also serializable. Note in particular that DefaultRecordSchema is currently
not serializable, so users wanting serialization may need to define their own
schema implementation.DefaultRecordType,
DefaultRecordSchema,
Serialized FormDefined in the sis-utility module
| Constructor and Description |
|---|
DefaultRecord(Record record)
Creates a new record initialized to a shallow copy of the given record.
|
DefaultRecord(RecordType type)
Creates a new record for the given record type.
|
| Modifier and Type | Method and Description |
|---|---|
static DefaultRecord |
castOrCopy(Record other)
Returns a SIS implementation with the name and members of the given arbitrary implementation.
|
boolean |
equals(Object object)
Compares this record with the given object for equality.
|
Map<MemberName,Object> |
getAttributes()
Returns the dictionary of all (name, value) pairs in this record.
|
RecordType |
getRecordType()
Returns the type definition of this record.
|
int |
hashCode()
Returns a hash code value for this record.
|
Object |
locate(MemberName name)
Returns the value for an attribute of the specified name.
|
void |
set(MemberName name,
Object value)
Sets the value for the attribute of the specified name.
|
void |
setAll(Object... newValues)
Sets all attribute values in this record, in attribute order.
|
String |
toString()
Returns a string representation of this record.
|
public DefaultRecord(RecordType type)
setAll(Object[]).type - the type definition of the new record.public DefaultRecord(Record record)
record - the record to copy (can not be null).public static DefaultRecord castOrCopy(Record other)
null, then this method returns null.DefaultRecord,
then it is returned unchanged.DefaultRecord instance is created using the
copy constructor and returned.
Note that this is a shallow copy operation, since the members contained
in the given object are not recursively copied.other - The object to get as a SIS implementation, or null if none.null if the argument was null.public RecordType getRecordType()
getRecordType in interface Recordpublic Map<MemberName,Object> getAttributes()
get and put operations to
the locate(MemberName) and set(MemberName, Object) methods respectively.getAttributes in interface RecordRecordType.getMemberTypes()public Object locate(MemberName name)
public void set(MemberName name, Object value)
set in interface Recordname - the name of the attribute to modify.value - the new value for the attribute.IllegalArgumentException - if the given name is not a member of this record.ClassCastException - if the given value is not an instance of the expected type for this record.public void setAll(Object... newValues)
newValues - the attribute values.IllegalArgumentException - if the given number of values does not match the expected number.ClassCastException - if a value is not an instance of the expected type for this record.public boolean equals(Object object)
public int hashCode()
Copyright © 2010–2017 The Apache Software Foundation. All rights reserved.