Back to home page

OSCL-LXR

 
 

    


0001 /**
0002  * Autogenerated by Avro
0003  * 
0004  * DO NOT EDIT DIRECTLY
0005  */
0006 package org.apache.spark.sql.execution.datasources.parquet.test.avro;  
0007 @SuppressWarnings("all")
0008 @org.apache.avro.specific.AvroGenerated
0009 public class AvroOptionalPrimitives extends org.apache.avro.specific.SpecificRecordBase implements org.apache.avro.specific.SpecificRecord {
0010   public static final org.apache.avro.Schema SCHEMA$ = new org.apache.avro.Schema.Parser().parse("{\"type\":\"record\",\"name\":\"AvroOptionalPrimitives\",\"namespace\":\"org.apache.spark.sql.execution.datasources.parquet.test.avro\",\"fields\":[{\"name\":\"maybe_bool_column\",\"type\":[\"null\",\"boolean\"]},{\"name\":\"maybe_int_column\",\"type\":[\"null\",\"int\"]},{\"name\":\"maybe_long_column\",\"type\":[\"null\",\"long\"]},{\"name\":\"maybe_float_column\",\"type\":[\"null\",\"float\"]},{\"name\":\"maybe_double_column\",\"type\":[\"null\",\"double\"]},{\"name\":\"maybe_binary_column\",\"type\":[\"null\",\"bytes\"]},{\"name\":\"maybe_string_column\",\"type\":[\"null\",{\"type\":\"string\",\"avro.java.string\":\"String\"}]}]}");
0011   public static org.apache.avro.Schema getClassSchema() { return SCHEMA$; }
0012   @Deprecated public java.lang.Boolean maybe_bool_column;
0013   @Deprecated public java.lang.Integer maybe_int_column;
0014   @Deprecated public java.lang.Long maybe_long_column;
0015   @Deprecated public java.lang.Float maybe_float_column;
0016   @Deprecated public java.lang.Double maybe_double_column;
0017   @Deprecated public java.nio.ByteBuffer maybe_binary_column;
0018   @Deprecated public java.lang.String maybe_string_column;
0019 
0020   /**
0021    * Default constructor.  Note that this does not initialize fields
0022    * to their default values from the schema.  If that is desired then
0023    * one should use <code>newBuilder()</code>. 
0024    */
0025   public AvroOptionalPrimitives() {}
0026 
0027   /**
0028    * All-args constructor.
0029    */
0030   public AvroOptionalPrimitives(java.lang.Boolean maybe_bool_column, java.lang.Integer maybe_int_column, java.lang.Long maybe_long_column, java.lang.Float maybe_float_column, java.lang.Double maybe_double_column, java.nio.ByteBuffer maybe_binary_column, java.lang.String maybe_string_column) {
0031     this.maybe_bool_column = maybe_bool_column;
0032     this.maybe_int_column = maybe_int_column;
0033     this.maybe_long_column = maybe_long_column;
0034     this.maybe_float_column = maybe_float_column;
0035     this.maybe_double_column = maybe_double_column;
0036     this.maybe_binary_column = maybe_binary_column;
0037     this.maybe_string_column = maybe_string_column;
0038   }
0039 
0040   public org.apache.avro.Schema getSchema() { return SCHEMA$; }
0041   // Used by DatumWriter.  Applications should not call. 
0042   public java.lang.Object get(int field$) {
0043     switch (field$) {
0044     case 0: return maybe_bool_column;
0045     case 1: return maybe_int_column;
0046     case 2: return maybe_long_column;
0047     case 3: return maybe_float_column;
0048     case 4: return maybe_double_column;
0049     case 5: return maybe_binary_column;
0050     case 6: return maybe_string_column;
0051     default: throw new org.apache.avro.AvroRuntimeException("Bad index");
0052     }
0053   }
0054   // Used by DatumReader.  Applications should not call. 
0055   @SuppressWarnings(value="unchecked")
0056   public void put(int field$, java.lang.Object value$) {
0057     switch (field$) {
0058     case 0: maybe_bool_column = (java.lang.Boolean)value$; break;
0059     case 1: maybe_int_column = (java.lang.Integer)value$; break;
0060     case 2: maybe_long_column = (java.lang.Long)value$; break;
0061     case 3: maybe_float_column = (java.lang.Float)value$; break;
0062     case 4: maybe_double_column = (java.lang.Double)value$; break;
0063     case 5: maybe_binary_column = (java.nio.ByteBuffer)value$; break;
0064     case 6: maybe_string_column = (java.lang.String)value$; break;
0065     default: throw new org.apache.avro.AvroRuntimeException("Bad index");
0066     }
0067   }
0068 
0069   /**
0070    * Gets the value of the 'maybe_bool_column' field.
0071    */
0072   public java.lang.Boolean getMaybeBoolColumn() {
0073     return maybe_bool_column;
0074   }
0075 
0076   /**
0077    * Sets the value of the 'maybe_bool_column' field.
0078    * @param value the value to set.
0079    */
0080   public void setMaybeBoolColumn(java.lang.Boolean value) {
0081     this.maybe_bool_column = value;
0082   }
0083 
0084   /**
0085    * Gets the value of the 'maybe_int_column' field.
0086    */
0087   public java.lang.Integer getMaybeIntColumn() {
0088     return maybe_int_column;
0089   }
0090 
0091   /**
0092    * Sets the value of the 'maybe_int_column' field.
0093    * @param value the value to set.
0094    */
0095   public void setMaybeIntColumn(java.lang.Integer value) {
0096     this.maybe_int_column = value;
0097   }
0098 
0099   /**
0100    * Gets the value of the 'maybe_long_column' field.
0101    */
0102   public java.lang.Long getMaybeLongColumn() {
0103     return maybe_long_column;
0104   }
0105 
0106   /**
0107    * Sets the value of the 'maybe_long_column' field.
0108    * @param value the value to set.
0109    */
0110   public void setMaybeLongColumn(java.lang.Long value) {
0111     this.maybe_long_column = value;
0112   }
0113 
0114   /**
0115    * Gets the value of the 'maybe_float_column' field.
0116    */
0117   public java.lang.Float getMaybeFloatColumn() {
0118     return maybe_float_column;
0119   }
0120 
0121   /**
0122    * Sets the value of the 'maybe_float_column' field.
0123    * @param value the value to set.
0124    */
0125   public void setMaybeFloatColumn(java.lang.Float value) {
0126     this.maybe_float_column = value;
0127   }
0128 
0129   /**
0130    * Gets the value of the 'maybe_double_column' field.
0131    */
0132   public java.lang.Double getMaybeDoubleColumn() {
0133     return maybe_double_column;
0134   }
0135 
0136   /**
0137    * Sets the value of the 'maybe_double_column' field.
0138    * @param value the value to set.
0139    */
0140   public void setMaybeDoubleColumn(java.lang.Double value) {
0141     this.maybe_double_column = value;
0142   }
0143 
0144   /**
0145    * Gets the value of the 'maybe_binary_column' field.
0146    */
0147   public java.nio.ByteBuffer getMaybeBinaryColumn() {
0148     return maybe_binary_column;
0149   }
0150 
0151   /**
0152    * Sets the value of the 'maybe_binary_column' field.
0153    * @param value the value to set.
0154    */
0155   public void setMaybeBinaryColumn(java.nio.ByteBuffer value) {
0156     this.maybe_binary_column = value;
0157   }
0158 
0159   /**
0160    * Gets the value of the 'maybe_string_column' field.
0161    */
0162   public java.lang.String getMaybeStringColumn() {
0163     return maybe_string_column;
0164   }
0165 
0166   /**
0167    * Sets the value of the 'maybe_string_column' field.
0168    * @param value the value to set.
0169    */
0170   public void setMaybeStringColumn(java.lang.String value) {
0171     this.maybe_string_column = value;
0172   }
0173 
0174   /** Creates a new AvroOptionalPrimitives RecordBuilder */
0175   public static org.apache.spark.sql.execution.datasources.parquet.test.avro.AvroOptionalPrimitives.Builder newBuilder() {
0176     return new org.apache.spark.sql.execution.datasources.parquet.test.avro.AvroOptionalPrimitives.Builder();
0177   }
0178   
0179   /** Creates a new AvroOptionalPrimitives RecordBuilder by copying an existing Builder */
0180   public static org.apache.spark.sql.execution.datasources.parquet.test.avro.AvroOptionalPrimitives.Builder newBuilder(org.apache.spark.sql.execution.datasources.parquet.test.avro.AvroOptionalPrimitives.Builder other) {
0181     return new org.apache.spark.sql.execution.datasources.parquet.test.avro.AvroOptionalPrimitives.Builder(other);
0182   }
0183   
0184   /** Creates a new AvroOptionalPrimitives RecordBuilder by copying an existing AvroOptionalPrimitives instance */
0185   public static org.apache.spark.sql.execution.datasources.parquet.test.avro.AvroOptionalPrimitives.Builder newBuilder(org.apache.spark.sql.execution.datasources.parquet.test.avro.AvroOptionalPrimitives other) {
0186     return new org.apache.spark.sql.execution.datasources.parquet.test.avro.AvroOptionalPrimitives.Builder(other);
0187   }
0188   
0189   /**
0190    * RecordBuilder for AvroOptionalPrimitives instances.
0191    */
0192   public static class Builder extends org.apache.avro.specific.SpecificRecordBuilderBase<AvroOptionalPrimitives>
0193     implements org.apache.avro.data.RecordBuilder<AvroOptionalPrimitives> {
0194 
0195     private java.lang.Boolean maybe_bool_column;
0196     private java.lang.Integer maybe_int_column;
0197     private java.lang.Long maybe_long_column;
0198     private java.lang.Float maybe_float_column;
0199     private java.lang.Double maybe_double_column;
0200     private java.nio.ByteBuffer maybe_binary_column;
0201     private java.lang.String maybe_string_column;
0202 
0203     /** Creates a new Builder */
0204     private Builder() {
0205       super(org.apache.spark.sql.execution.datasources.parquet.test.avro.AvroOptionalPrimitives.SCHEMA$);
0206     }
0207     
0208     /** Creates a Builder by copying an existing Builder */
0209     private Builder(org.apache.spark.sql.execution.datasources.parquet.test.avro.AvroOptionalPrimitives.Builder other) {
0210       super(other);
0211       if (isValidValue(fields()[0], other.maybe_bool_column)) {
0212         this.maybe_bool_column = data().deepCopy(fields()[0].schema(), other.maybe_bool_column);
0213         fieldSetFlags()[0] = true;
0214       }
0215       if (isValidValue(fields()[1], other.maybe_int_column)) {
0216         this.maybe_int_column = data().deepCopy(fields()[1].schema(), other.maybe_int_column);
0217         fieldSetFlags()[1] = true;
0218       }
0219       if (isValidValue(fields()[2], other.maybe_long_column)) {
0220         this.maybe_long_column = data().deepCopy(fields()[2].schema(), other.maybe_long_column);
0221         fieldSetFlags()[2] = true;
0222       }
0223       if (isValidValue(fields()[3], other.maybe_float_column)) {
0224         this.maybe_float_column = data().deepCopy(fields()[3].schema(), other.maybe_float_column);
0225         fieldSetFlags()[3] = true;
0226       }
0227       if (isValidValue(fields()[4], other.maybe_double_column)) {
0228         this.maybe_double_column = data().deepCopy(fields()[4].schema(), other.maybe_double_column);
0229         fieldSetFlags()[4] = true;
0230       }
0231       if (isValidValue(fields()[5], other.maybe_binary_column)) {
0232         this.maybe_binary_column = data().deepCopy(fields()[5].schema(), other.maybe_binary_column);
0233         fieldSetFlags()[5] = true;
0234       }
0235       if (isValidValue(fields()[6], other.maybe_string_column)) {
0236         this.maybe_string_column = data().deepCopy(fields()[6].schema(), other.maybe_string_column);
0237         fieldSetFlags()[6] = true;
0238       }
0239     }
0240     
0241     /** Creates a Builder by copying an existing AvroOptionalPrimitives instance */
0242     private Builder(org.apache.spark.sql.execution.datasources.parquet.test.avro.AvroOptionalPrimitives other) {
0243             super(org.apache.spark.sql.execution.datasources.parquet.test.avro.AvroOptionalPrimitives.SCHEMA$);
0244       if (isValidValue(fields()[0], other.maybe_bool_column)) {
0245         this.maybe_bool_column = data().deepCopy(fields()[0].schema(), other.maybe_bool_column);
0246         fieldSetFlags()[0] = true;
0247       }
0248       if (isValidValue(fields()[1], other.maybe_int_column)) {
0249         this.maybe_int_column = data().deepCopy(fields()[1].schema(), other.maybe_int_column);
0250         fieldSetFlags()[1] = true;
0251       }
0252       if (isValidValue(fields()[2], other.maybe_long_column)) {
0253         this.maybe_long_column = data().deepCopy(fields()[2].schema(), other.maybe_long_column);
0254         fieldSetFlags()[2] = true;
0255       }
0256       if (isValidValue(fields()[3], other.maybe_float_column)) {
0257         this.maybe_float_column = data().deepCopy(fields()[3].schema(), other.maybe_float_column);
0258         fieldSetFlags()[3] = true;
0259       }
0260       if (isValidValue(fields()[4], other.maybe_double_column)) {
0261         this.maybe_double_column = data().deepCopy(fields()[4].schema(), other.maybe_double_column);
0262         fieldSetFlags()[4] = true;
0263       }
0264       if (isValidValue(fields()[5], other.maybe_binary_column)) {
0265         this.maybe_binary_column = data().deepCopy(fields()[5].schema(), other.maybe_binary_column);
0266         fieldSetFlags()[5] = true;
0267       }
0268       if (isValidValue(fields()[6], other.maybe_string_column)) {
0269         this.maybe_string_column = data().deepCopy(fields()[6].schema(), other.maybe_string_column);
0270         fieldSetFlags()[6] = true;
0271       }
0272     }
0273 
0274     /** Gets the value of the 'maybe_bool_column' field */
0275     public java.lang.Boolean getMaybeBoolColumn() {
0276       return maybe_bool_column;
0277     }
0278     
0279     /** Sets the value of the 'maybe_bool_column' field */
0280     public org.apache.spark.sql.execution.datasources.parquet.test.avro.AvroOptionalPrimitives.Builder setMaybeBoolColumn(java.lang.Boolean value) {
0281       validate(fields()[0], value);
0282       this.maybe_bool_column = value;
0283       fieldSetFlags()[0] = true;
0284       return this; 
0285     }
0286     
0287     /** Checks whether the 'maybe_bool_column' field has been set */
0288     public boolean hasMaybeBoolColumn() {
0289       return fieldSetFlags()[0];
0290     }
0291     
0292     /** Clears the value of the 'maybe_bool_column' field */
0293     public org.apache.spark.sql.execution.datasources.parquet.test.avro.AvroOptionalPrimitives.Builder clearMaybeBoolColumn() {
0294       maybe_bool_column = null;
0295       fieldSetFlags()[0] = false;
0296       return this;
0297     }
0298 
0299     /** Gets the value of the 'maybe_int_column' field */
0300     public java.lang.Integer getMaybeIntColumn() {
0301       return maybe_int_column;
0302     }
0303     
0304     /** Sets the value of the 'maybe_int_column' field */
0305     public org.apache.spark.sql.execution.datasources.parquet.test.avro.AvroOptionalPrimitives.Builder setMaybeIntColumn(java.lang.Integer value) {
0306       validate(fields()[1], value);
0307       this.maybe_int_column = value;
0308       fieldSetFlags()[1] = true;
0309       return this; 
0310     }
0311     
0312     /** Checks whether the 'maybe_int_column' field has been set */
0313     public boolean hasMaybeIntColumn() {
0314       return fieldSetFlags()[1];
0315     }
0316     
0317     /** Clears the value of the 'maybe_int_column' field */
0318     public org.apache.spark.sql.execution.datasources.parquet.test.avro.AvroOptionalPrimitives.Builder clearMaybeIntColumn() {
0319       maybe_int_column = null;
0320       fieldSetFlags()[1] = false;
0321       return this;
0322     }
0323 
0324     /** Gets the value of the 'maybe_long_column' field */
0325     public java.lang.Long getMaybeLongColumn() {
0326       return maybe_long_column;
0327     }
0328     
0329     /** Sets the value of the 'maybe_long_column' field */
0330     public org.apache.spark.sql.execution.datasources.parquet.test.avro.AvroOptionalPrimitives.Builder setMaybeLongColumn(java.lang.Long value) {
0331       validate(fields()[2], value);
0332       this.maybe_long_column = value;
0333       fieldSetFlags()[2] = true;
0334       return this; 
0335     }
0336     
0337     /** Checks whether the 'maybe_long_column' field has been set */
0338     public boolean hasMaybeLongColumn() {
0339       return fieldSetFlags()[2];
0340     }
0341     
0342     /** Clears the value of the 'maybe_long_column' field */
0343     public org.apache.spark.sql.execution.datasources.parquet.test.avro.AvroOptionalPrimitives.Builder clearMaybeLongColumn() {
0344       maybe_long_column = null;
0345       fieldSetFlags()[2] = false;
0346       return this;
0347     }
0348 
0349     /** Gets the value of the 'maybe_float_column' field */
0350     public java.lang.Float getMaybeFloatColumn() {
0351       return maybe_float_column;
0352     }
0353     
0354     /** Sets the value of the 'maybe_float_column' field */
0355     public org.apache.spark.sql.execution.datasources.parquet.test.avro.AvroOptionalPrimitives.Builder setMaybeFloatColumn(java.lang.Float value) {
0356       validate(fields()[3], value);
0357       this.maybe_float_column = value;
0358       fieldSetFlags()[3] = true;
0359       return this; 
0360     }
0361     
0362     /** Checks whether the 'maybe_float_column' field has been set */
0363     public boolean hasMaybeFloatColumn() {
0364       return fieldSetFlags()[3];
0365     }
0366     
0367     /** Clears the value of the 'maybe_float_column' field */
0368     public org.apache.spark.sql.execution.datasources.parquet.test.avro.AvroOptionalPrimitives.Builder clearMaybeFloatColumn() {
0369       maybe_float_column = null;
0370       fieldSetFlags()[3] = false;
0371       return this;
0372     }
0373 
0374     /** Gets the value of the 'maybe_double_column' field */
0375     public java.lang.Double getMaybeDoubleColumn() {
0376       return maybe_double_column;
0377     }
0378     
0379     /** Sets the value of the 'maybe_double_column' field */
0380     public org.apache.spark.sql.execution.datasources.parquet.test.avro.AvroOptionalPrimitives.Builder setMaybeDoubleColumn(java.lang.Double value) {
0381       validate(fields()[4], value);
0382       this.maybe_double_column = value;
0383       fieldSetFlags()[4] = true;
0384       return this; 
0385     }
0386     
0387     /** Checks whether the 'maybe_double_column' field has been set */
0388     public boolean hasMaybeDoubleColumn() {
0389       return fieldSetFlags()[4];
0390     }
0391     
0392     /** Clears the value of the 'maybe_double_column' field */
0393     public org.apache.spark.sql.execution.datasources.parquet.test.avro.AvroOptionalPrimitives.Builder clearMaybeDoubleColumn() {
0394       maybe_double_column = null;
0395       fieldSetFlags()[4] = false;
0396       return this;
0397     }
0398 
0399     /** Gets the value of the 'maybe_binary_column' field */
0400     public java.nio.ByteBuffer getMaybeBinaryColumn() {
0401       return maybe_binary_column;
0402     }
0403     
0404     /** Sets the value of the 'maybe_binary_column' field */
0405     public org.apache.spark.sql.execution.datasources.parquet.test.avro.AvroOptionalPrimitives.Builder setMaybeBinaryColumn(java.nio.ByteBuffer value) {
0406       validate(fields()[5], value);
0407       this.maybe_binary_column = value;
0408       fieldSetFlags()[5] = true;
0409       return this; 
0410     }
0411     
0412     /** Checks whether the 'maybe_binary_column' field has been set */
0413     public boolean hasMaybeBinaryColumn() {
0414       return fieldSetFlags()[5];
0415     }
0416     
0417     /** Clears the value of the 'maybe_binary_column' field */
0418     public org.apache.spark.sql.execution.datasources.parquet.test.avro.AvroOptionalPrimitives.Builder clearMaybeBinaryColumn() {
0419       maybe_binary_column = null;
0420       fieldSetFlags()[5] = false;
0421       return this;
0422     }
0423 
0424     /** Gets the value of the 'maybe_string_column' field */
0425     public java.lang.String getMaybeStringColumn() {
0426       return maybe_string_column;
0427     }
0428     
0429     /** Sets the value of the 'maybe_string_column' field */
0430     public org.apache.spark.sql.execution.datasources.parquet.test.avro.AvroOptionalPrimitives.Builder setMaybeStringColumn(java.lang.String value) {
0431       validate(fields()[6], value);
0432       this.maybe_string_column = value;
0433       fieldSetFlags()[6] = true;
0434       return this; 
0435     }
0436     
0437     /** Checks whether the 'maybe_string_column' field has been set */
0438     public boolean hasMaybeStringColumn() {
0439       return fieldSetFlags()[6];
0440     }
0441     
0442     /** Clears the value of the 'maybe_string_column' field */
0443     public org.apache.spark.sql.execution.datasources.parquet.test.avro.AvroOptionalPrimitives.Builder clearMaybeStringColumn() {
0444       maybe_string_column = null;
0445       fieldSetFlags()[6] = false;
0446       return this;
0447     }
0448 
0449     @Override
0450     public AvroOptionalPrimitives build() {
0451       try {
0452         AvroOptionalPrimitives record = new AvroOptionalPrimitives();
0453         record.maybe_bool_column = fieldSetFlags()[0] ? this.maybe_bool_column : (java.lang.Boolean) defaultValue(fields()[0]);
0454         record.maybe_int_column = fieldSetFlags()[1] ? this.maybe_int_column : (java.lang.Integer) defaultValue(fields()[1]);
0455         record.maybe_long_column = fieldSetFlags()[2] ? this.maybe_long_column : (java.lang.Long) defaultValue(fields()[2]);
0456         record.maybe_float_column = fieldSetFlags()[3] ? this.maybe_float_column : (java.lang.Float) defaultValue(fields()[3]);
0457         record.maybe_double_column = fieldSetFlags()[4] ? this.maybe_double_column : (java.lang.Double) defaultValue(fields()[4]);
0458         record.maybe_binary_column = fieldSetFlags()[5] ? this.maybe_binary_column : (java.nio.ByteBuffer) defaultValue(fields()[5]);
0459         record.maybe_string_column = fieldSetFlags()[6] ? this.maybe_string_column : (java.lang.String) defaultValue(fields()[6]);
0460         return record;
0461       } catch (Exception e) {
0462         throw new org.apache.avro.AvroRuntimeException(e);
0463       }
0464     }
0465   }
0466 }