Change Doubles to Strings in messages
[aquarium] / src / main / java / gr / grnet / aquarium / message / avro / gen / EffectiveUnitPriceMsg.java
1 /**
2  * Autogenerated by Avro
3  * 
4  * DO NOT EDIT DIRECTLY
5  */
6 package gr.grnet.aquarium.message.avro.gen;  
7 @SuppressWarnings("all")
8 public class EffectiveUnitPriceMsg extends org.apache.avro.specific.SpecificRecordBase implements org.apache.avro.specific.SpecificRecord {
9   public static final org.apache.avro.Schema SCHEMA$ = new org.apache.avro.Schema.Parser().parse("{\"type\":\"record\",\"name\":\"EffectiveUnitPriceMsg\",\"namespace\":\"gr.grnet.aquarium.message.avro.gen\",\"fields\":[{\"name\":\"unitPrice\",\"type\":\"double\"},{\"name\":\"when\",\"type\":[{\"type\":\"record\",\"name\":\"CronSpecTupleMsg\",\"fields\":[{\"name\":\"a\",\"type\":{\"type\":\"string\",\"avro.java.string\":\"String\"}},{\"name\":\"b\",\"type\":{\"type\":\"string\",\"avro.java.string\":\"String\"}}]},\"null\"]}]}");
10   @Deprecated public double unitPrice;
11   @Deprecated public gr.grnet.aquarium.message.avro.gen.CronSpecTupleMsg when;
12
13   /**
14    * Default constructor.
15    */
16   public EffectiveUnitPriceMsg() {}
17
18   /**
19    * All-args constructor.
20    */
21   public EffectiveUnitPriceMsg(java.lang.Double unitPrice, gr.grnet.aquarium.message.avro.gen.CronSpecTupleMsg when) {
22     this.unitPrice = unitPrice;
23     this.when = when;
24   }
25
26   public org.apache.avro.Schema getSchema() { return SCHEMA$; }
27   // Used by DatumWriter.  Applications should not call. 
28   public java.lang.Object get(int field$) {
29     switch (field$) {
30     case 0: return unitPrice;
31     case 1: return when;
32     default: throw new org.apache.avro.AvroRuntimeException("Bad index");
33     }
34   }
35   // Used by DatumReader.  Applications should not call. 
36   @SuppressWarnings(value="unchecked")
37   public void put(int field$, java.lang.Object value$) {
38     switch (field$) {
39     case 0: unitPrice = (java.lang.Double)value$; break;
40     case 1: when = (gr.grnet.aquarium.message.avro.gen.CronSpecTupleMsg)value$; break;
41     default: throw new org.apache.avro.AvroRuntimeException("Bad index");
42     }
43   }
44
45   /**
46    * Gets the value of the 'unitPrice' field.
47    */
48   public java.lang.Double getUnitPrice() {
49     return unitPrice;
50   }
51
52   /**
53    * Sets the value of the 'unitPrice' field.
54    * @param value the value to set.
55    */
56   public void setUnitPrice(java.lang.Double value) {
57     this.unitPrice = value;
58   }
59
60   /**
61    * Gets the value of the 'when' field.
62    */
63   public gr.grnet.aquarium.message.avro.gen.CronSpecTupleMsg getWhen() {
64     return when;
65   }
66
67   /**
68    * Sets the value of the 'when' field.
69    * @param value the value to set.
70    */
71   public void setWhen(gr.grnet.aquarium.message.avro.gen.CronSpecTupleMsg value) {
72     this.when = value;
73   }
74
75   /** Creates a new EffectiveUnitPriceMsg RecordBuilder */
76   public static gr.grnet.aquarium.message.avro.gen.EffectiveUnitPriceMsg.Builder newBuilder() {
77     return new gr.grnet.aquarium.message.avro.gen.EffectiveUnitPriceMsg.Builder();
78   }
79   
80   /** Creates a new EffectiveUnitPriceMsg RecordBuilder by copying an existing Builder */
81   public static gr.grnet.aquarium.message.avro.gen.EffectiveUnitPriceMsg.Builder newBuilder(gr.grnet.aquarium.message.avro.gen.EffectiveUnitPriceMsg.Builder other) {
82     return new gr.grnet.aquarium.message.avro.gen.EffectiveUnitPriceMsg.Builder(other);
83   }
84   
85   /** Creates a new EffectiveUnitPriceMsg RecordBuilder by copying an existing EffectiveUnitPriceMsg instance */
86   public static gr.grnet.aquarium.message.avro.gen.EffectiveUnitPriceMsg.Builder newBuilder(gr.grnet.aquarium.message.avro.gen.EffectiveUnitPriceMsg other) {
87     return new gr.grnet.aquarium.message.avro.gen.EffectiveUnitPriceMsg.Builder(other);
88   }
89   
90   /**
91    * RecordBuilder for EffectiveUnitPriceMsg instances.
92    */
93   public static class Builder extends org.apache.avro.specific.SpecificRecordBuilderBase<EffectiveUnitPriceMsg>
94     implements org.apache.avro.data.RecordBuilder<EffectiveUnitPriceMsg> {
95
96     private double unitPrice;
97     private gr.grnet.aquarium.message.avro.gen.CronSpecTupleMsg when;
98
99     /** Creates a new Builder */
100     private Builder() {
101       super(gr.grnet.aquarium.message.avro.gen.EffectiveUnitPriceMsg.SCHEMA$);
102     }
103     
104     /** Creates a Builder by copying an existing Builder */
105     private Builder(gr.grnet.aquarium.message.avro.gen.EffectiveUnitPriceMsg.Builder other) {
106       super(other);
107     }
108     
109     /** Creates a Builder by copying an existing EffectiveUnitPriceMsg instance */
110     private Builder(gr.grnet.aquarium.message.avro.gen.EffectiveUnitPriceMsg other) {
111             super(gr.grnet.aquarium.message.avro.gen.EffectiveUnitPriceMsg.SCHEMA$);
112       if (isValidValue(fields()[0], other.unitPrice)) {
113         this.unitPrice = (java.lang.Double) data().deepCopy(fields()[0].schema(), other.unitPrice);
114         fieldSetFlags()[0] = true;
115       }
116       if (isValidValue(fields()[1], other.when)) {
117         this.when = (gr.grnet.aquarium.message.avro.gen.CronSpecTupleMsg) data().deepCopy(fields()[1].schema(), other.when);
118         fieldSetFlags()[1] = true;
119       }
120     }
121
122     /** Gets the value of the 'unitPrice' field */
123     public java.lang.Double getUnitPrice() {
124       return unitPrice;
125     }
126     
127     /** Sets the value of the 'unitPrice' field */
128     public gr.grnet.aquarium.message.avro.gen.EffectiveUnitPriceMsg.Builder setUnitPrice(double value) {
129       validate(fields()[0], value);
130       this.unitPrice = value;
131       fieldSetFlags()[0] = true;
132       return this; 
133     }
134     
135     /** Checks whether the 'unitPrice' field has been set */
136     public boolean hasUnitPrice() {
137       return fieldSetFlags()[0];
138     }
139     
140     /** Clears the value of the 'unitPrice' field */
141     public gr.grnet.aquarium.message.avro.gen.EffectiveUnitPriceMsg.Builder clearUnitPrice() {
142       fieldSetFlags()[0] = false;
143       return this;
144     }
145
146     /** Gets the value of the 'when' field */
147     public gr.grnet.aquarium.message.avro.gen.CronSpecTupleMsg getWhen() {
148       return when;
149     }
150     
151     /** Sets the value of the 'when' field */
152     public gr.grnet.aquarium.message.avro.gen.EffectiveUnitPriceMsg.Builder setWhen(gr.grnet.aquarium.message.avro.gen.CronSpecTupleMsg value) {
153       validate(fields()[1], value);
154       this.when = value;
155       fieldSetFlags()[1] = true;
156       return this; 
157     }
158     
159     /** Checks whether the 'when' field has been set */
160     public boolean hasWhen() {
161       return fieldSetFlags()[1];
162     }
163     
164     /** Clears the value of the 'when' field */
165     public gr.grnet.aquarium.message.avro.gen.EffectiveUnitPriceMsg.Builder clearWhen() {
166       when = null;
167       fieldSetFlags()[1] = false;
168       return this;
169     }
170
171     @Override
172     public EffectiveUnitPriceMsg build() {
173       try {
174         EffectiveUnitPriceMsg record = new EffectiveUnitPriceMsg();
175         record.unitPrice = fieldSetFlags()[0] ? this.unitPrice : (java.lang.Double) defaultValue(fields()[0]);
176         record.when = fieldSetFlags()[1] ? this.when : (gr.grnet.aquarium.message.avro.gen.CronSpecTupleMsg) defaultValue(fields()[1]);
177         return record;
178       } catch (Exception e) {
179         throw new org.apache.avro.AvroRuntimeException(e);
180       }
181     }
182   }
183 }