Interface RecordType
-
- All Superinterfaces:
Type
@UML(identifier="RecordType", specification=ISO_19103) public interface RecordType extends Type
The type definition of a record. ARecordType
defines dynamically constructed data type. This interface has methods for data access, but no methods to dynamically add members. This approach ensures that once aRecordType
is constructed, it is immutable.A
RecordType
is identified by aTypeName
. It contains an arbitrary amount of member types. ARecordType
may therefore contain anotherRecordType
as a member.This class can be think as the equivalent of the Java
Class
class.- Since:
- 2.1
- Version:
- 3.0
- See Also:
Record
,RecordSchema
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description RecordSchema
getContainer()
Returns the schema that contains this record type.java.util.Set<MemberName>
getMembers()
Returns the set of member names defined in thisRecordType
's dictionary.java.util.Map<MemberName,Type>
getMemberTypes()
Returns the dictionary of all (name, type) pairs in this record type.TypeName
getTypeName()
Returns the name that identifies this record type.boolean
isInstance(Record record)
Determines if the specified record is compatible with this record type.TypeName
locate(MemberName name)
Looks up the provided attribute name and returns the associated type name.
-
-
-
Method Detail
-
getTypeName
@UML(identifier="typeName", obligation=MANDATORY, specification=ISO_19103) TypeName getTypeName()
Returns the name that identifies this record type. If thisRecordType
is contained in a record schema, then the record type name shall be a valid in the name space of the record schema:
This method can be think as the equivalent of the JavagetContainer().getSchemaName().scope()
Class.getName()
method.- Specified by:
getTypeName
in interfaceType
- Returns:
- The name that identifies this record type.
-
getContainer
RecordSchema getContainer()
Returns the schema that contains this record type.- Returns:
- The schema that contains this record type.
-
getMemberTypes
@UML(identifier="memberTypes", obligation=MANDATORY, specification=ISO_19103) java.util.Map<MemberName,Type> getMemberTypes()
Returns the dictionary of all (name, type) pairs in this record type. If there are no attributes, this method returns the empty map. The dictionary shall be unmodifiable.The name space associated with a
RecordType
contains only members of thisRecordType
. There is no potential for conflict with sub-packages.This method can be think as the equivalent of the Java
Class.getFields()
method.- Returns:
- The dictionary of all (name, type) pairs in this record type.
- See Also:
Record.getAttributes()
-
getMembers
java.util.Set<MemberName> getMembers()
Returns the set of member names defined in thisRecordType
's dictionary. If there are no members, this method returns the empty set. This method is functionally equivalent togetMemberTypes().keySet()
.The name space associated with a
RecordType
contains only members of thisRecordType
. There is no potential for conflict with sub-packages.This method can be think as the equivalent of the Java
Class.getFields()
method.- Returns:
- The set of attribute names defined in this
RecordType
's dictionary.
-
locate
@UML(identifier="locate", obligation=MANDATORY, specification=ISO_19103) TypeName locate(MemberName name)
Looks up the provided attribute name and returns the associated type name. If the attribute name is not defined in this record type, then this method returnsnull
. This method is functionally equivalent togetMemberTypes().get(name).getTypeName()
.This method can be think as the equivalent of the Java
Class.getField(String)
method.- Parameters:
name
- The name of the attribute we are looking for.- Returns:
- The type of of attribute of the given name, or
null
. - See Also:
Record.locate(MemberName)
-
isInstance
boolean isInstance(Record record)
Determines if the specified record is compatible with this record type. This method returnstrue
if the specifiedrecord
argument is non-null and the following condition holds:getMembers().containsAll(record.getAttributes().keySet())
- Any other implementation-specific conditions.
This method can be think as the equivalent of the Java
Class.isInstance(Object)
method.- Parameters:
record
- The record to test for compatibility.- Returns:
true
if the given record is compatible with this record type.
-
-