001/** 002 * Autogenerated by Avro 003 * 004 * DO NOT EDIT DIRECTLY 005 */ 006package org.apache.reef.runtime.multi.utils.avro; 007@SuppressWarnings("all") 008/** Defines the schema for runtime definition. This avro object is used to pass runtimes definitions to the runtimes host */ 009@org.apache.avro.specific.AvroGenerated 010public class AvroRuntimeDefinition extends org.apache.avro.specific.SpecificRecordBase implements org.apache.avro.specific.SpecificRecord { 011 public static final org.apache.avro.Schema SCHEMA$ = new org.apache.avro.Schema.Parser().parse("{\"type\":\"record\",\"name\":\"AvroRuntimeDefinition\",\"namespace\":\"org.apache.reef.runtime.multi.utils.avro\",\"doc\":\"Defines the schema for runtime definition. This avro object is used to pass runtimes definitions to the runtimes host\",\"fields\":[{\"name\":\"runtimeName\",\"type\":\"string\",\"doc\":\"The name of the runtime, that will be provided with the resource allocation requests\"},{\"name\":\"serializedConfiguration\",\"type\":\"string\",\"doc\":\"Serialized Tang configuration\"}]}"); 012 public static org.apache.avro.Schema getClassSchema() { return SCHEMA$; } 013 /** The name of the runtime, that will be provided with the resource allocation requests */ 014 @Deprecated public java.lang.CharSequence runtimeName; 015 /** Serialized Tang configuration */ 016 @Deprecated public java.lang.CharSequence serializedConfiguration; 017 018 /** 019 * Default constructor. Note that this does not initialize fields 020 * to their default values from the schema. If that is desired then 021 * one should use <code>newBuilder()</code>. 022 */ 023 public AvroRuntimeDefinition() {} 024 025 /** 026 * All-args constructor. 027 */ 028 public AvroRuntimeDefinition(java.lang.CharSequence runtimeName, java.lang.CharSequence serializedConfiguration) { 029 this.runtimeName = runtimeName; 030 this.serializedConfiguration = serializedConfiguration; 031 } 032 033 public org.apache.avro.Schema getSchema() { return SCHEMA$; } 034 // Used by DatumWriter. Applications should not call. 035 public java.lang.Object get(int field$) { 036 switch (field$) { 037 case 0: return runtimeName; 038 case 1: return serializedConfiguration; 039 default: throw new org.apache.avro.AvroRuntimeException("Bad index"); 040 } 041 } 042 // Used by DatumReader. Applications should not call. 043 @SuppressWarnings(value="unchecked") 044 public void put(int field$, java.lang.Object value$) { 045 switch (field$) { 046 case 0: runtimeName = (java.lang.CharSequence)value$; break; 047 case 1: serializedConfiguration = (java.lang.CharSequence)value$; break; 048 default: throw new org.apache.avro.AvroRuntimeException("Bad index"); 049 } 050 } 051 052 /** 053 * Gets the value of the 'runtimeName' field. 054 * The name of the runtime, that will be provided with the resource allocation requests */ 055 public java.lang.CharSequence getRuntimeName() { 056 return runtimeName; 057 } 058 059 /** 060 * Sets the value of the 'runtimeName' field. 061 * The name of the runtime, that will be provided with the resource allocation requests * @param value the value to set. 062 */ 063 public void setRuntimeName(java.lang.CharSequence value) { 064 this.runtimeName = value; 065 } 066 067 /** 068 * Gets the value of the 'serializedConfiguration' field. 069 * Serialized Tang configuration */ 070 public java.lang.CharSequence getSerializedConfiguration() { 071 return serializedConfiguration; 072 } 073 074 /** 075 * Sets the value of the 'serializedConfiguration' field. 076 * Serialized Tang configuration * @param value the value to set. 077 */ 078 public void setSerializedConfiguration(java.lang.CharSequence value) { 079 this.serializedConfiguration = value; 080 } 081 082 /** Creates a new AvroRuntimeDefinition RecordBuilder */ 083 public static org.apache.reef.runtime.multi.utils.avro.AvroRuntimeDefinition.Builder newBuilder() { 084 return new org.apache.reef.runtime.multi.utils.avro.AvroRuntimeDefinition.Builder(); 085 } 086 087 /** Creates a new AvroRuntimeDefinition RecordBuilder by copying an existing Builder */ 088 public static org.apache.reef.runtime.multi.utils.avro.AvroRuntimeDefinition.Builder newBuilder(org.apache.reef.runtime.multi.utils.avro.AvroRuntimeDefinition.Builder other) { 089 return new org.apache.reef.runtime.multi.utils.avro.AvroRuntimeDefinition.Builder(other); 090 } 091 092 /** Creates a new AvroRuntimeDefinition RecordBuilder by copying an existing AvroRuntimeDefinition instance */ 093 public static org.apache.reef.runtime.multi.utils.avro.AvroRuntimeDefinition.Builder newBuilder(org.apache.reef.runtime.multi.utils.avro.AvroRuntimeDefinition other) { 094 return new org.apache.reef.runtime.multi.utils.avro.AvroRuntimeDefinition.Builder(other); 095 } 096 097 /** 098 * RecordBuilder for AvroRuntimeDefinition instances. 099 */ 100 public static class Builder extends org.apache.avro.specific.SpecificRecordBuilderBase<AvroRuntimeDefinition> 101 implements org.apache.avro.data.RecordBuilder<AvroRuntimeDefinition> { 102 103 private java.lang.CharSequence runtimeName; 104 private java.lang.CharSequence serializedConfiguration; 105 106 /** Creates a new Builder */ 107 private Builder() { 108 super(org.apache.reef.runtime.multi.utils.avro.AvroRuntimeDefinition.SCHEMA$); 109 } 110 111 /** Creates a Builder by copying an existing Builder */ 112 private Builder(org.apache.reef.runtime.multi.utils.avro.AvroRuntimeDefinition.Builder other) { 113 super(other); 114 if (isValidValue(fields()[0], other.runtimeName)) { 115 this.runtimeName = data().deepCopy(fields()[0].schema(), other.runtimeName); 116 fieldSetFlags()[0] = true; 117 } 118 if (isValidValue(fields()[1], other.serializedConfiguration)) { 119 this.serializedConfiguration = data().deepCopy(fields()[1].schema(), other.serializedConfiguration); 120 fieldSetFlags()[1] = true; 121 } 122 } 123 124 /** Creates a Builder by copying an existing AvroRuntimeDefinition instance */ 125 private Builder(org.apache.reef.runtime.multi.utils.avro.AvroRuntimeDefinition other) { 126 super(org.apache.reef.runtime.multi.utils.avro.AvroRuntimeDefinition.SCHEMA$); 127 if (isValidValue(fields()[0], other.runtimeName)) { 128 this.runtimeName = data().deepCopy(fields()[0].schema(), other.runtimeName); 129 fieldSetFlags()[0] = true; 130 } 131 if (isValidValue(fields()[1], other.serializedConfiguration)) { 132 this.serializedConfiguration = data().deepCopy(fields()[1].schema(), other.serializedConfiguration); 133 fieldSetFlags()[1] = true; 134 } 135 } 136 137 /** Gets the value of the 'runtimeName' field */ 138 public java.lang.CharSequence getRuntimeName() { 139 return runtimeName; 140 } 141 142 /** Sets the value of the 'runtimeName' field */ 143 public org.apache.reef.runtime.multi.utils.avro.AvroRuntimeDefinition.Builder setRuntimeName(java.lang.CharSequence value) { 144 validate(fields()[0], value); 145 this.runtimeName = value; 146 fieldSetFlags()[0] = true; 147 return this; 148 } 149 150 /** Checks whether the 'runtimeName' field has been set */ 151 public boolean hasRuntimeName() { 152 return fieldSetFlags()[0]; 153 } 154 155 /** Clears the value of the 'runtimeName' field */ 156 public org.apache.reef.runtime.multi.utils.avro.AvroRuntimeDefinition.Builder clearRuntimeName() { 157 runtimeName = null; 158 fieldSetFlags()[0] = false; 159 return this; 160 } 161 162 /** Gets the value of the 'serializedConfiguration' field */ 163 public java.lang.CharSequence getSerializedConfiguration() { 164 return serializedConfiguration; 165 } 166 167 /** Sets the value of the 'serializedConfiguration' field */ 168 public org.apache.reef.runtime.multi.utils.avro.AvroRuntimeDefinition.Builder setSerializedConfiguration(java.lang.CharSequence value) { 169 validate(fields()[1], value); 170 this.serializedConfiguration = value; 171 fieldSetFlags()[1] = true; 172 return this; 173 } 174 175 /** Checks whether the 'serializedConfiguration' field has been set */ 176 public boolean hasSerializedConfiguration() { 177 return fieldSetFlags()[1]; 178 } 179 180 /** Clears the value of the 'serializedConfiguration' field */ 181 public org.apache.reef.runtime.multi.utils.avro.AvroRuntimeDefinition.Builder clearSerializedConfiguration() { 182 serializedConfiguration = null; 183 fieldSetFlags()[1] = false; 184 return this; 185 } 186 187 @Override 188 public AvroRuntimeDefinition build() { 189 try { 190 AvroRuntimeDefinition record = new AvroRuntimeDefinition(); 191 record.runtimeName = fieldSetFlags()[0] ? this.runtimeName : (java.lang.CharSequence) defaultValue(fields()[0]); 192 record.serializedConfiguration = fieldSetFlags()[1] ? this.serializedConfiguration : (java.lang.CharSequence) defaultValue(fields()[1]); 193 return record; 194 } catch (Exception e) { 195 throw new org.apache.avro.AvroRuntimeException(e); 196 } 197 } 198 } 199}