## org.apache.hadoop.record.meta
Class RecordTypeInfo

    java.lang.Object
      org.apache.hadoop.record.Record
          org.apache.hadoop.record.meta.RecordTypeInfo

All Implemented Interfaces:
  Cloneable, Comparable, Writable, WritableComparable

    public class RecordTypeInfo

extends Record

A record's Type Information object which can read/write itself. Type information for a record comprises metadata about the record, as well as a collection of type information for each field in the record.

Constructor Summary
`RecordTypeInfo()` Create an empty RecordTypeInfo object.
`RecordTypeInfo(String name)` Create a RecordTypeInfo object representing a record with the given name

Method Summary
`void` `addField(String fieldName, TypeID tid)` Add a field.
`int` `compareTo(Object peer_)` This class doesn't implement Comparable as it's not meant to be used for anything besides de/serializing.
`void` `deserialize(RecordInput rin, String tag)` Deserialize the type information for a record
`Collection<FieldTypeInfo>` `getFieldTypeInfos()` Return a collection of field type infos
`String` `getName()` return the name of the record
`RecordTypeInfo` `getNestedStructTypeInfo(String name)` Return the type info of a nested record.
`void` `serialize(RecordOutput rout, String tag)` Serialize the type information for a record
`void` `setName(String name)` set the name of the record

Methods inherited from class org.apache.hadoop.record.Record
`deserialize, readFields, serialize, toString, write`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Constructor Detail

### RecordTypeInfo

    public RecordTypeInfo()

  Create an empty RecordTypeInfo object.

### RecordTypeInfo

    public RecordTypeInfo(String name)

  Create a RecordTypeInfo object representing a record with the given name

  Parameters:
    `name` - Name of the record

Method Detail

### getName

    public String getName()

  return the name of the record

### setName

    public void setName(String name)

  set the name of the record

### addField

    public void addField(String fieldName,
                         TypeID tid)

  Add a field.

  Parameters:
    `fieldName` - Name of the field
    `tid` - Type ID of the field

### getFieldTypeInfos

    public Collection<FieldTypeInfo> getFieldTypeInfos()

  Return a collection of field type infos

### getNestedStructTypeInfo

    public RecordTypeInfo getNestedStructTypeInfo(String name)

  Return the type info of a nested record. We only consider nesting to one level.

  Parameters:
    `name` - Name of the nested record

### serialize

    public void serialize(RecordOutput rout,
                          String tag)
                   throws IOException

  Serialize the type information for a record

  Specified by:
    `serialize` in class `Record`
  Parameters:
    `rout` - Record output destination
    `tag` - record tag (Used only in tagged serialization e.g. XML)
  Throws:
    `IOException`

### deserialize

    public void deserialize(RecordInput rin,
                            String tag)
                     throws IOException

  Deserialize the type information for a record

  Specified by:
    `deserialize` in class `Record`
  Parameters:
    `rin` - Record input source
    `tag` - Record tag (Used only in tagged serialization e.g. XML)
  Throws:
    `IOException`

### compareTo

    public int compareTo(Object peer_)
                  throws ClassCastException

  This class doesn't implement Comparable as it's not meant to be used for anything besides de/serializing. So we always throw an exception. Not implemented. Always returns 0 if another RecordTypeInfo is passed in.

  Specified by:
    `compareTo` in interface `Comparable`
  Specified by:
    `compareTo` in class `Record`
  Throws:
    `ClassCastException`

Copyright © 2009 The Apache Software Foundation