org.apache.hcatalog.data.schema
Class HCatSchema

java.lang.Object
  extended by org.apache.hcatalog.data.schema.HCatSchema
All Implemented Interfaces:
java.io.Serializable

public class HCatSchema
extends java.lang.Object
implements java.io.Serializable

HCatSchema. This class is NOT thread-safe.

See Also:
Serialized Form

Constructor Summary
HCatSchema(java.util.List<HCatFieldSchema> fieldSchemas)
           
 
Method Summary
 void append(HCatFieldSchema hfs)
           
 HCatFieldSchema get(int position)
           
 HCatFieldSchema get(java.lang.String fieldName)
           
 java.util.List<java.lang.String> getFieldNames()
           
 java.util.List<HCatFieldSchema> getFields()
          Users are not allowed to modify the list directly, since HCatSchema maintains internal state.
 java.lang.Integer getPosition(java.lang.String fieldName)
           
 void remove(HCatFieldSchema hcatFieldSchema)
           
 int size()
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

HCatSchema

public HCatSchema(java.util.List<HCatFieldSchema> fieldSchemas)
Parameters:
fieldSchemas - is now owned by HCatSchema. Any subsequent modifications on fieldSchemas won't get reflected in HCatSchema. Each fieldSchema's name in the list must be unique, otherwise throws IllegalArgumentException.
Method Detail

append

public void append(HCatFieldSchema hfs)
            throws HCatException
Throws:
HCatException

getFields

public java.util.List<HCatFieldSchema> getFields()
Users are not allowed to modify the list directly, since HCatSchema maintains internal state. Use append/remove to modify the schema.


getPosition

public java.lang.Integer getPosition(java.lang.String fieldName)
Parameters:
fieldName -
Returns:
the index of field named fieldName in Schema. If field is not present, returns null.

get

public HCatFieldSchema get(java.lang.String fieldName)
                    throws HCatException
Throws:
HCatException

getFieldNames

public java.util.List<java.lang.String> getFieldNames()

get

public HCatFieldSchema get(int position)

size

public int size()

remove

public void remove(HCatFieldSchema hcatFieldSchema)
            throws HCatException
Throws:
HCatException

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object