Package org.apache.sqoop.lib
Class SqoopRecord
- java.lang.Object
-
- org.apache.sqoop.lib.SqoopRecord
-
- All Implemented Interfaces:
java.lang.Cloneable,org.apache.hadoop.io.Writable,FieldMappable,org.apache.sqoop.mapreduce.DBWritable
public abstract class SqoopRecord extends java.lang.Object implements java.lang.Cloneable, org.apache.sqoop.mapreduce.DBWritable, FieldMappable, org.apache.hadoop.io.Writable
Interface implemented by the classes generated by sqoop's orm.ClassWriter.
-
-
Constructor Summary
Constructors Constructor Description SqoopRecord()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description java.lang.Objectclone()voiddelegate(FieldMapProcessor processor)Use the delegate pattern to allow arbitrary processing of the fields of this record.abstract intgetClassFormatVersion()Returns an integer specifying which API format version the generated class conforms to.java.util.Map<java.lang.String,java.lang.Object>getFieldMap()Returns a map containing all fields of this record.abstract voidloadLargeObjects(LargeObjectLoader objLoader)abstract voidparse(byte[] s)abstract voidparse(char[] s)abstract voidparse(java.lang.CharSequence s)abstract voidparse(java.nio.ByteBuffer s)abstract voidparse(java.nio.CharBuffer s)abstract voidparse(org.apache.hadoop.io.Text s)voidsetField(java.lang.String fieldName, java.lang.Object fieldVal)Allows an arbitrary field to be set programmatically to the specified value object.java.lang.StringtoString(boolean useRecordDelim)Use the default delimiters, but only append an end-of-record delimiter if useRecordDelim is true.abstract java.lang.StringtoString(DelimiterSet delimiters)Format output data according to the specified delimiters.java.lang.StringtoString(DelimiterSet delimiters, boolean useRecordDelim)Format the record according to the specified delimiters.abstract intwrite(java.sql.PreparedStatement stmt, int offset)Inserts the data in this object into the PreparedStatement, starting at parameter 'offset'.
-
-
-
Method Detail
-
parse
public abstract void parse(java.lang.CharSequence s) throws RecordParser.ParseError- Throws:
RecordParser.ParseError
-
parse
public abstract void parse(org.apache.hadoop.io.Text s) throws RecordParser.ParseError- Throws:
RecordParser.ParseError
-
parse
public abstract void parse(byte[] s) throws RecordParser.ParseError- Throws:
RecordParser.ParseError
-
parse
public abstract void parse(char[] s) throws RecordParser.ParseError- Throws:
RecordParser.ParseError
-
parse
public abstract void parse(java.nio.ByteBuffer s) throws RecordParser.ParseError- Throws:
RecordParser.ParseError
-
parse
public abstract void parse(java.nio.CharBuffer s) throws RecordParser.ParseError- Throws:
RecordParser.ParseError
-
loadLargeObjects
public abstract void loadLargeObjects(LargeObjectLoader objLoader) throws java.sql.SQLException, java.io.IOException, java.lang.InterruptedException
- Throws:
java.sql.SQLExceptionjava.io.IOExceptionjava.lang.InterruptedException
-
write
public abstract int write(java.sql.PreparedStatement stmt, int offset) throws java.sql.SQLExceptionInserts the data in this object into the PreparedStatement, starting at parameter 'offset'.- Returns:
- the number of fields written to the statement.
- Throws:
java.sql.SQLException
-
toString
public abstract java.lang.String toString(DelimiterSet delimiters)
Format output data according to the specified delimiters.
-
toString
public java.lang.String toString(boolean useRecordDelim)
Use the default delimiters, but only append an end-of-record delimiter if useRecordDelim is true.
-
toString
public java.lang.String toString(DelimiterSet delimiters, boolean useRecordDelim)
Format the record according to the specified delimiters. An end-of-record delimiter is optional, and only used if useRecordDelim is true. For use with TextOutputFormat, calling this with useRecordDelim=false may make more sense.
-
clone
public java.lang.Object clone() throws java.lang.CloneNotSupportedException- Overrides:
clonein classjava.lang.Object- Throws:
java.lang.CloneNotSupportedException
-
getClassFormatVersion
public abstract int getClassFormatVersion()
Returns an integer specifying which API format version the generated class conforms to. Used by internal APIs for backwards compatibility.- Returns:
- the API version this class was generated against.
-
delegate
public void delegate(FieldMapProcessor processor) throws java.io.IOException, ProcessingException
Use the delegate pattern to allow arbitrary processing of the fields of this record.- Parameters:
processor- A delegate that operates on this object.- Throws:
java.io.IOException- if the processor encounters an IO error when operating on this object.ProcessingException- if the FieldMapProcessor encounters a general processing error when operating on this object.
-
getFieldMap
public java.util.Map<java.lang.String,java.lang.Object> getFieldMap()
Description copied from interface:FieldMappableReturns a map containing all fields of this record.- Specified by:
getFieldMapin interfaceFieldMappable- Returns:
- a map from column names to the object-based values for this record. The map may not be null, though it may be empty.
-
setField
public void setField(java.lang.String fieldName, java.lang.Object fieldVal)Allows an arbitrary field to be set programmatically to the specified value object. The value object must match the type expected for the particular field or a RuntimeException will result.- Throws:
java.lang.RuntimeException- if the specified field name does not exist.
-
-