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 multi runtime definition. This avro object is used to pass multi runtime definition to the runtimes host */ 009@org.apache.avro.specific.AvroGenerated 010public class AvroMultiRuntimeDefinition 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\":\"AvroMultiRuntimeDefinition\",\"namespace\":\"org.apache.reef.runtime.multi.utils.avro\",\"doc\":\"Defines the schema for multi runtime definition. This avro object is used to pass multi runtime definition to the runtimes host\",\"fields\":[{\"name\":\"defaultRuntimeName\",\"type\":\"string\",\"doc\":\"The name of the default runtime\"},{\"name\":\"runtimes\",\"type\":{\"type\":\"array\",\"items\":{\"type\":\"record\",\"name\":\"AvroRuntimeDefinition\",\"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\"}]}},\"doc\":\"defined runtimes\"}]}"); 012 public static org.apache.avro.Schema getClassSchema() { return SCHEMA$; } 013 /** The name of the default runtime */ 014 @Deprecated public java.lang.CharSequence defaultRuntimeName; 015 /** defined runtimes */ 016 @Deprecated public java.util.List<org.apache.reef.runtime.multi.utils.avro.AvroRuntimeDefinition> runtimes; 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 AvroMultiRuntimeDefinition() {} 024 025 /** 026 * All-args constructor. 027 */ 028 public AvroMultiRuntimeDefinition(java.lang.CharSequence defaultRuntimeName, java.util.List<org.apache.reef.runtime.multi.utils.avro.AvroRuntimeDefinition> runtimes) { 029 this.defaultRuntimeName = defaultRuntimeName; 030 this.runtimes = runtimes; 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 defaultRuntimeName; 038 case 1: return runtimes; 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: defaultRuntimeName = (java.lang.CharSequence)value$; break; 047 case 1: runtimes = (java.util.List<org.apache.reef.runtime.multi.utils.avro.AvroRuntimeDefinition>)value$; break; 048 default: throw new org.apache.avro.AvroRuntimeException("Bad index"); 049 } 050 } 051 052 /** 053 * Gets the value of the 'defaultRuntimeName' field. 054 * The name of the default runtime */ 055 public java.lang.CharSequence getDefaultRuntimeName() { 056 return defaultRuntimeName; 057 } 058 059 /** 060 * Sets the value of the 'defaultRuntimeName' field. 061 * The name of the default runtime * @param value the value to set. 062 */ 063 public void setDefaultRuntimeName(java.lang.CharSequence value) { 064 this.defaultRuntimeName = value; 065 } 066 067 /** 068 * Gets the value of the 'runtimes' field. 069 * defined runtimes */ 070 public java.util.List<org.apache.reef.runtime.multi.utils.avro.AvroRuntimeDefinition> getRuntimes() { 071 return runtimes; 072 } 073 074 /** 075 * Sets the value of the 'runtimes' field. 076 * defined runtimes * @param value the value to set. 077 */ 078 public void setRuntimes(java.util.List<org.apache.reef.runtime.multi.utils.avro.AvroRuntimeDefinition> value) { 079 this.runtimes = value; 080 } 081 082 /** Creates a new AvroMultiRuntimeDefinition RecordBuilder */ 083 public static org.apache.reef.runtime.multi.utils.avro.AvroMultiRuntimeDefinition.Builder newBuilder() { 084 return new org.apache.reef.runtime.multi.utils.avro.AvroMultiRuntimeDefinition.Builder(); 085 } 086 087 /** Creates a new AvroMultiRuntimeDefinition RecordBuilder by copying an existing Builder */ 088 public static org.apache.reef.runtime.multi.utils.avro.AvroMultiRuntimeDefinition.Builder newBuilder(org.apache.reef.runtime.multi.utils.avro.AvroMultiRuntimeDefinition.Builder other) { 089 return new org.apache.reef.runtime.multi.utils.avro.AvroMultiRuntimeDefinition.Builder(other); 090 } 091 092 /** Creates a new AvroMultiRuntimeDefinition RecordBuilder by copying an existing AvroMultiRuntimeDefinition instance */ 093 public static org.apache.reef.runtime.multi.utils.avro.AvroMultiRuntimeDefinition.Builder newBuilder(org.apache.reef.runtime.multi.utils.avro.AvroMultiRuntimeDefinition other) { 094 return new org.apache.reef.runtime.multi.utils.avro.AvroMultiRuntimeDefinition.Builder(other); 095 } 096 097 /** 098 * RecordBuilder for AvroMultiRuntimeDefinition instances. 099 */ 100 public static class Builder extends org.apache.avro.specific.SpecificRecordBuilderBase<AvroMultiRuntimeDefinition> 101 implements org.apache.avro.data.RecordBuilder<AvroMultiRuntimeDefinition> { 102 103 private java.lang.CharSequence defaultRuntimeName; 104 private java.util.List<org.apache.reef.runtime.multi.utils.avro.AvroRuntimeDefinition> runtimes; 105 106 /** Creates a new Builder */ 107 private Builder() { 108 super(org.apache.reef.runtime.multi.utils.avro.AvroMultiRuntimeDefinition.SCHEMA$); 109 } 110 111 /** Creates a Builder by copying an existing Builder */ 112 private Builder(org.apache.reef.runtime.multi.utils.avro.AvroMultiRuntimeDefinition.Builder other) { 113 super(other); 114 if (isValidValue(fields()[0], other.defaultRuntimeName)) { 115 this.defaultRuntimeName = data().deepCopy(fields()[0].schema(), other.defaultRuntimeName); 116 fieldSetFlags()[0] = true; 117 } 118 if (isValidValue(fields()[1], other.runtimes)) { 119 this.runtimes = data().deepCopy(fields()[1].schema(), other.runtimes); 120 fieldSetFlags()[1] = true; 121 } 122 } 123 124 /** Creates a Builder by copying an existing AvroMultiRuntimeDefinition instance */ 125 private Builder(org.apache.reef.runtime.multi.utils.avro.AvroMultiRuntimeDefinition other) { 126 super(org.apache.reef.runtime.multi.utils.avro.AvroMultiRuntimeDefinition.SCHEMA$); 127 if (isValidValue(fields()[0], other.defaultRuntimeName)) { 128 this.defaultRuntimeName = data().deepCopy(fields()[0].schema(), other.defaultRuntimeName); 129 fieldSetFlags()[0] = true; 130 } 131 if (isValidValue(fields()[1], other.runtimes)) { 132 this.runtimes = data().deepCopy(fields()[1].schema(), other.runtimes); 133 fieldSetFlags()[1] = true; 134 } 135 } 136 137 /** Gets the value of the 'defaultRuntimeName' field */ 138 public java.lang.CharSequence getDefaultRuntimeName() { 139 return defaultRuntimeName; 140 } 141 142 /** Sets the value of the 'defaultRuntimeName' field */ 143 public org.apache.reef.runtime.multi.utils.avro.AvroMultiRuntimeDefinition.Builder setDefaultRuntimeName(java.lang.CharSequence value) { 144 validate(fields()[0], value); 145 this.defaultRuntimeName = value; 146 fieldSetFlags()[0] = true; 147 return this; 148 } 149 150 /** Checks whether the 'defaultRuntimeName' field has been set */ 151 public boolean hasDefaultRuntimeName() { 152 return fieldSetFlags()[0]; 153 } 154 155 /** Clears the value of the 'defaultRuntimeName' field */ 156 public org.apache.reef.runtime.multi.utils.avro.AvroMultiRuntimeDefinition.Builder clearDefaultRuntimeName() { 157 defaultRuntimeName = null; 158 fieldSetFlags()[0] = false; 159 return this; 160 } 161 162 /** Gets the value of the 'runtimes' field */ 163 public java.util.List<org.apache.reef.runtime.multi.utils.avro.AvroRuntimeDefinition> getRuntimes() { 164 return runtimes; 165 } 166 167 /** Sets the value of the 'runtimes' field */ 168 public org.apache.reef.runtime.multi.utils.avro.AvroMultiRuntimeDefinition.Builder setRuntimes(java.util.List<org.apache.reef.runtime.multi.utils.avro.AvroRuntimeDefinition> value) { 169 validate(fields()[1], value); 170 this.runtimes = value; 171 fieldSetFlags()[1] = true; 172 return this; 173 } 174 175 /** Checks whether the 'runtimes' field has been set */ 176 public boolean hasRuntimes() { 177 return fieldSetFlags()[1]; 178 } 179 180 /** Clears the value of the 'runtimes' field */ 181 public org.apache.reef.runtime.multi.utils.avro.AvroMultiRuntimeDefinition.Builder clearRuntimes() { 182 runtimes = null; 183 fieldSetFlags()[1] = false; 184 return this; 185 } 186 187 @Override 188 public AvroMultiRuntimeDefinition build() { 189 try { 190 AvroMultiRuntimeDefinition record = new AvroMultiRuntimeDefinition(); 191 record.defaultRuntimeName = fieldSetFlags()[0] ? this.defaultRuntimeName : (java.lang.CharSequence) defaultValue(fields()[0]); 192 record.runtimes = fieldSetFlags()[1] ? this.runtimes : (java.util.List<org.apache.reef.runtime.multi.utils.avro.AvroRuntimeDefinition>) defaultValue(fields()[1]); 193 return record; 194 } catch (Exception e) { 195 throw new org.apache.avro.AvroRuntimeException(e); 196 } 197 } 198 } 199}