alshabib | 86ac11c | 2014-08-14 16:14:41 -0700 | [diff] [blame] | 1 | // Copyright (c) 2008 The Board of Trustees of The Leland Stanford Junior University |
| 2 | // Copyright (c) 2011, 2012 Open Networking Foundation |
| 3 | // Copyright (c) 2012, 2013 Big Switch Networks, Inc. |
| 4 | // This library was generated by the LoxiGen Compiler. |
| 5 | // See the file LICENSE.txt which should have been included in the source distribution |
| 6 | |
| 7 | // Automatically generated by LOXI from template of_class.java |
| 8 | // Do not modify |
| 9 | |
| 10 | package org.projectfloodlight.openflow.protocol.ver13; |
| 11 | |
| 12 | import org.projectfloodlight.openflow.protocol.*; |
| 13 | import org.projectfloodlight.openflow.protocol.action.*; |
| 14 | import org.projectfloodlight.openflow.protocol.actionid.*; |
| 15 | import org.projectfloodlight.openflow.protocol.bsntlv.*; |
| 16 | import org.projectfloodlight.openflow.protocol.errormsg.*; |
| 17 | import org.projectfloodlight.openflow.protocol.meterband.*; |
| 18 | import org.projectfloodlight.openflow.protocol.instruction.*; |
| 19 | import org.projectfloodlight.openflow.protocol.instructionid.*; |
| 20 | import org.projectfloodlight.openflow.protocol.match.*; |
| 21 | import org.projectfloodlight.openflow.protocol.oxm.*; |
| 22 | import org.projectfloodlight.openflow.protocol.queueprop.*; |
| 23 | import org.projectfloodlight.openflow.types.*; |
| 24 | import org.projectfloodlight.openflow.util.*; |
| 25 | import org.projectfloodlight.openflow.exceptions.*; |
| 26 | import org.slf4j.Logger; |
| 27 | import org.slf4j.LoggerFactory; |
| 28 | import java.util.Set; |
| 29 | import org.jboss.netty.buffer.ChannelBuffer; |
| 30 | import com.google.common.hash.PrimitiveSink; |
| 31 | import com.google.common.hash.Funnel; |
| 32 | |
| 33 | class OFBsnDebugCounterDescStatsEntryVer13 implements OFBsnDebugCounterDescStatsEntry { |
| 34 | private static final Logger logger = LoggerFactory.getLogger(OFBsnDebugCounterDescStatsEntryVer13.class); |
| 35 | // version: 1.3 |
| 36 | final static byte WIRE_VERSION = 4; |
| 37 | final static int LENGTH = 328; |
| 38 | |
| 39 | private final static U64 DEFAULT_COUNTER_ID = U64.ZERO; |
| 40 | private final static String DEFAULT_NAME = ""; |
| 41 | private final static String DEFAULT_DESCRIPTION = ""; |
| 42 | |
| 43 | // OF message fields |
| 44 | private final U64 counterId; |
| 45 | private final String name; |
| 46 | private final String description; |
| 47 | // |
| 48 | // Immutable default instance |
| 49 | final static OFBsnDebugCounterDescStatsEntryVer13 DEFAULT = new OFBsnDebugCounterDescStatsEntryVer13( |
| 50 | DEFAULT_COUNTER_ID, DEFAULT_NAME, DEFAULT_DESCRIPTION |
| 51 | ); |
| 52 | |
| 53 | // package private constructor - used by readers, builders, and factory |
| 54 | OFBsnDebugCounterDescStatsEntryVer13(U64 counterId, String name, String description) { |
| 55 | this.counterId = counterId; |
| 56 | this.name = name; |
| 57 | this.description = description; |
| 58 | } |
| 59 | |
| 60 | // Accessors for OF message fields |
| 61 | @Override |
| 62 | public U64 getCounterId() { |
| 63 | return counterId; |
| 64 | } |
| 65 | |
| 66 | @Override |
| 67 | public String getName() { |
| 68 | return name; |
| 69 | } |
| 70 | |
| 71 | @Override |
| 72 | public String getDescription() { |
| 73 | return description; |
| 74 | } |
| 75 | |
| 76 | @Override |
| 77 | public OFVersion getVersion() { |
| 78 | return OFVersion.OF_13; |
| 79 | } |
| 80 | |
| 81 | |
| 82 | |
| 83 | public OFBsnDebugCounterDescStatsEntry.Builder createBuilder() { |
| 84 | return new BuilderWithParent(this); |
| 85 | } |
| 86 | |
| 87 | static class BuilderWithParent implements OFBsnDebugCounterDescStatsEntry.Builder { |
| 88 | final OFBsnDebugCounterDescStatsEntryVer13 parentMessage; |
| 89 | |
| 90 | // OF message fields |
| 91 | private boolean counterIdSet; |
| 92 | private U64 counterId; |
| 93 | private boolean nameSet; |
| 94 | private String name; |
| 95 | private boolean descriptionSet; |
| 96 | private String description; |
| 97 | |
| 98 | BuilderWithParent(OFBsnDebugCounterDescStatsEntryVer13 parentMessage) { |
| 99 | this.parentMessage = parentMessage; |
| 100 | } |
| 101 | |
| 102 | @Override |
| 103 | public U64 getCounterId() { |
| 104 | return counterId; |
| 105 | } |
| 106 | |
| 107 | @Override |
| 108 | public OFBsnDebugCounterDescStatsEntry.Builder setCounterId(U64 counterId) { |
| 109 | this.counterId = counterId; |
| 110 | this.counterIdSet = true; |
| 111 | return this; |
| 112 | } |
| 113 | @Override |
| 114 | public String getName() { |
| 115 | return name; |
| 116 | } |
| 117 | |
| 118 | @Override |
| 119 | public OFBsnDebugCounterDescStatsEntry.Builder setName(String name) { |
| 120 | this.name = name; |
| 121 | this.nameSet = true; |
| 122 | return this; |
| 123 | } |
| 124 | @Override |
| 125 | public String getDescription() { |
| 126 | return description; |
| 127 | } |
| 128 | |
| 129 | @Override |
| 130 | public OFBsnDebugCounterDescStatsEntry.Builder setDescription(String description) { |
| 131 | this.description = description; |
| 132 | this.descriptionSet = true; |
| 133 | return this; |
| 134 | } |
| 135 | @Override |
| 136 | public OFVersion getVersion() { |
| 137 | return OFVersion.OF_13; |
| 138 | } |
| 139 | |
| 140 | |
| 141 | |
| 142 | @Override |
| 143 | public OFBsnDebugCounterDescStatsEntry build() { |
| 144 | U64 counterId = this.counterIdSet ? this.counterId : parentMessage.counterId; |
| 145 | if(counterId == null) |
| 146 | throw new NullPointerException("Property counterId must not be null"); |
| 147 | String name = this.nameSet ? this.name : parentMessage.name; |
| 148 | if(name == null) |
| 149 | throw new NullPointerException("Property name must not be null"); |
| 150 | String description = this.descriptionSet ? this.description : parentMessage.description; |
| 151 | if(description == null) |
| 152 | throw new NullPointerException("Property description must not be null"); |
| 153 | |
| 154 | // |
| 155 | return new OFBsnDebugCounterDescStatsEntryVer13( |
| 156 | counterId, |
| 157 | name, |
| 158 | description |
| 159 | ); |
| 160 | } |
| 161 | |
| 162 | } |
| 163 | |
| 164 | static class Builder implements OFBsnDebugCounterDescStatsEntry.Builder { |
| 165 | // OF message fields |
| 166 | private boolean counterIdSet; |
| 167 | private U64 counterId; |
| 168 | private boolean nameSet; |
| 169 | private String name; |
| 170 | private boolean descriptionSet; |
| 171 | private String description; |
| 172 | |
| 173 | @Override |
| 174 | public U64 getCounterId() { |
| 175 | return counterId; |
| 176 | } |
| 177 | |
| 178 | @Override |
| 179 | public OFBsnDebugCounterDescStatsEntry.Builder setCounterId(U64 counterId) { |
| 180 | this.counterId = counterId; |
| 181 | this.counterIdSet = true; |
| 182 | return this; |
| 183 | } |
| 184 | @Override |
| 185 | public String getName() { |
| 186 | return name; |
| 187 | } |
| 188 | |
| 189 | @Override |
| 190 | public OFBsnDebugCounterDescStatsEntry.Builder setName(String name) { |
| 191 | this.name = name; |
| 192 | this.nameSet = true; |
| 193 | return this; |
| 194 | } |
| 195 | @Override |
| 196 | public String getDescription() { |
| 197 | return description; |
| 198 | } |
| 199 | |
| 200 | @Override |
| 201 | public OFBsnDebugCounterDescStatsEntry.Builder setDescription(String description) { |
| 202 | this.description = description; |
| 203 | this.descriptionSet = true; |
| 204 | return this; |
| 205 | } |
| 206 | @Override |
| 207 | public OFVersion getVersion() { |
| 208 | return OFVersion.OF_13; |
| 209 | } |
| 210 | |
| 211 | // |
| 212 | @Override |
| 213 | public OFBsnDebugCounterDescStatsEntry build() { |
| 214 | U64 counterId = this.counterIdSet ? this.counterId : DEFAULT_COUNTER_ID; |
| 215 | if(counterId == null) |
| 216 | throw new NullPointerException("Property counterId must not be null"); |
| 217 | String name = this.nameSet ? this.name : DEFAULT_NAME; |
| 218 | if(name == null) |
| 219 | throw new NullPointerException("Property name must not be null"); |
| 220 | String description = this.descriptionSet ? this.description : DEFAULT_DESCRIPTION; |
| 221 | if(description == null) |
| 222 | throw new NullPointerException("Property description must not be null"); |
| 223 | |
| 224 | |
| 225 | return new OFBsnDebugCounterDescStatsEntryVer13( |
| 226 | counterId, |
| 227 | name, |
| 228 | description |
| 229 | ); |
| 230 | } |
| 231 | |
| 232 | } |
| 233 | |
| 234 | |
| 235 | final static Reader READER = new Reader(); |
| 236 | static class Reader implements OFMessageReader<OFBsnDebugCounterDescStatsEntry> { |
| 237 | @Override |
| 238 | public OFBsnDebugCounterDescStatsEntry readFrom(ChannelBuffer bb) throws OFParseError { |
| 239 | U64 counterId = U64.ofRaw(bb.readLong()); |
| 240 | String name = ChannelUtils.readFixedLengthString(bb, 64); |
| 241 | String description = ChannelUtils.readFixedLengthString(bb, 256); |
| 242 | |
| 243 | OFBsnDebugCounterDescStatsEntryVer13 bsnDebugCounterDescStatsEntryVer13 = new OFBsnDebugCounterDescStatsEntryVer13( |
| 244 | counterId, |
| 245 | name, |
| 246 | description |
| 247 | ); |
| 248 | if(logger.isTraceEnabled()) |
| 249 | logger.trace("readFrom - read={}", bsnDebugCounterDescStatsEntryVer13); |
| 250 | return bsnDebugCounterDescStatsEntryVer13; |
| 251 | } |
| 252 | } |
| 253 | |
| 254 | public void putTo(PrimitiveSink sink) { |
| 255 | FUNNEL.funnel(this, sink); |
| 256 | } |
| 257 | |
| 258 | final static OFBsnDebugCounterDescStatsEntryVer13Funnel FUNNEL = new OFBsnDebugCounterDescStatsEntryVer13Funnel(); |
| 259 | static class OFBsnDebugCounterDescStatsEntryVer13Funnel implements Funnel<OFBsnDebugCounterDescStatsEntryVer13> { |
| 260 | private static final long serialVersionUID = 1L; |
| 261 | @Override |
| 262 | public void funnel(OFBsnDebugCounterDescStatsEntryVer13 message, PrimitiveSink sink) { |
| 263 | message.counterId.putTo(sink); |
| 264 | sink.putUnencodedChars(message.name); |
| 265 | sink.putUnencodedChars(message.description); |
| 266 | } |
| 267 | } |
| 268 | |
| 269 | |
| 270 | public void writeTo(ChannelBuffer bb) { |
| 271 | WRITER.write(bb, this); |
| 272 | } |
| 273 | |
| 274 | final static Writer WRITER = new Writer(); |
| 275 | static class Writer implements OFMessageWriter<OFBsnDebugCounterDescStatsEntryVer13> { |
| 276 | @Override |
| 277 | public void write(ChannelBuffer bb, OFBsnDebugCounterDescStatsEntryVer13 message) { |
| 278 | bb.writeLong(message.counterId.getValue()); |
| 279 | ChannelUtils.writeFixedLengthString(bb, message.name, 64); |
| 280 | ChannelUtils.writeFixedLengthString(bb, message.description, 256); |
| 281 | |
| 282 | |
| 283 | } |
| 284 | } |
| 285 | |
| 286 | @Override |
| 287 | public String toString() { |
| 288 | StringBuilder b = new StringBuilder("OFBsnDebugCounterDescStatsEntryVer13("); |
| 289 | b.append("counterId=").append(counterId); |
| 290 | b.append(", "); |
| 291 | b.append("name=").append(name); |
| 292 | b.append(", "); |
| 293 | b.append("description=").append(description); |
| 294 | b.append(")"); |
| 295 | return b.toString(); |
| 296 | } |
| 297 | |
| 298 | @Override |
| 299 | public boolean equals(Object obj) { |
| 300 | if (this == obj) |
| 301 | return true; |
| 302 | if (obj == null) |
| 303 | return false; |
| 304 | if (getClass() != obj.getClass()) |
| 305 | return false; |
| 306 | OFBsnDebugCounterDescStatsEntryVer13 other = (OFBsnDebugCounterDescStatsEntryVer13) obj; |
| 307 | |
| 308 | if (counterId == null) { |
| 309 | if (other.counterId != null) |
| 310 | return false; |
| 311 | } else if (!counterId.equals(other.counterId)) |
| 312 | return false; |
| 313 | if (name == null) { |
| 314 | if (other.name != null) |
| 315 | return false; |
| 316 | } else if (!name.equals(other.name)) |
| 317 | return false; |
| 318 | if (description == null) { |
| 319 | if (other.description != null) |
| 320 | return false; |
| 321 | } else if (!description.equals(other.description)) |
| 322 | return false; |
| 323 | return true; |
| 324 | } |
| 325 | |
| 326 | @Override |
| 327 | public int hashCode() { |
| 328 | final int prime = 31; |
| 329 | int result = 1; |
| 330 | |
| 331 | result = prime * result + ((counterId == null) ? 0 : counterId.hashCode()); |
| 332 | result = prime * result + ((name == null) ? 0 : name.hashCode()); |
| 333 | result = prime * result + ((description == null) ? 0 : description.hashCode()); |
| 334 | return result; |
| 335 | } |
| 336 | |
| 337 | } |