org.geotools.util
Class RecordTypeImpl

Object
  extended by RecordTypeImpl
All Implemented Interfaces:
RecordType

public class RecordTypeImpl
extends Object
implements RecordType

The type definition of a record. Used to provide a record of data type (in a manner similar to a strongly typed Map).

Please note that a record is strongly typed (and may be better thought of as a mathematical tuple). The "keys" are strictly controlled "MemberNames" and are usually defined in the context of a schema.

Since:
2.4
Author:
Jody Garnet, Martin Desruisseaux
Module:
modules/library/metadata (gt-metadata.jar)

Constructor Summary
RecordTypeImpl(RecordSchema parent, TypeName typeName, Collection<MemberName> members)
          Creates a record with all attribute types specified.
RecordTypeImpl(RecordSchema parent, TypeName typeName, Map<MemberName,TypeName> attributeTypes)
          Creates a record with all attribute types specified.
 
Method Summary
 Map<MemberName,TypeName> getAttributeTypes()
          Returns the unmodifiable dictionary of all (name, type) pairs in this record type.
 RecordSchema getContainer()
          Returns the schema that contains this record type.
 Set<MemberName> getMembers()
          Returns the set of attribute names defined in this RecordType's dictionary.
 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 memberName)
          Looks up the provided attribute name and returns the associated type name.
 
Methods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

RecordTypeImpl

public RecordTypeImpl(RecordSchema parent,
                      TypeName typeName,
                      Collection<MemberName> members)
Creates a record with all attribute types specified.

Parameters:
parent - The schema that contains this record type.
typeName - The name that identifies this record type.
members - The name of the members to be included in this record type.

RecordTypeImpl

public RecordTypeImpl(RecordSchema parent,
                      TypeName typeName,
                      Map<MemberName,TypeName> attributeTypes)
Creates a record with all attribute types specified.

Parameters:
parent - The schema that contains this record type.
typeName - The name that identifies this record type.
attributeTypes -
Method Detail

getTypeName

public TypeName getTypeName()
Returns the name that identifies this record type. If this RecordType is contained in a record schema, then the record type name should be a valid in the name space of the record schema:
getContainer().getSchemaName().scope()

Specified by:
getTypeName in interface RecordType

getContainer

public RecordSchema getContainer()
Returns the schema that contains this record type.

Specified by:
getContainer in interface RecordType

getAttributeTypes

public Map<MemberName,TypeName> getAttributeTypes()
Returns the unmodifiable dictionary of all (name, type) pairs in this record type.

Specified by:
getAttributeTypes in interface RecordType

getMembers

public Set<MemberName> getMembers()
Returns the set of attribute names defined in this RecordType's dictionary. If there are no attributes, this method returns the empty set. This method is functionally equivalent to getAttributeTypes().keySet().

Specified by:
getMembers in interface RecordType

locate

public TypeName locate(MemberName memberName)
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 returns null. This method is functionnaly equivalent to getAttributeTypes().get(name).

Specified by:
locate in interface RecordType

isInstance

public boolean isInstance(Record record)
Determines if the specified record is compatible with this record type. This method returns true if the specified record argument is non-null and the following condition holds:

Specified by:
isInstance in interface RecordType


Copyright © 1996-2009 Geotools. All Rights Reserved.