Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // Generated by http://code.google.com/p/protostuff/ ... DO NOT EDIT!
- // Generated from proto
- /*
- message Image {
- required string uri = 1; //url to the thumbnail
- optional string title = 2; //used in the html ALT
- required int32 width = 3; // of the image
- required int32 height = 4; // of the image
- enum Size {
- SMALL = 0;
- LARGE = 1;
- }
- required Size size = 5; // of the image (in relative terms, provided by cnbc for example)
- }
- */
- package serializers.protobuf.media;
- import javax.annotation.Generated;
- import java.io.Externalizable;
- import java.io.IOException;
- import java.io.ObjectInput;
- import java.io.ObjectOutput;
- import java.util.Objects;
- import io.protostuff.GraphIOUtil;
- import io.protostuff.Input;
- import io.protostuff.Message;
- import io.protostuff.Output;
- import io.protostuff.Schema;
- import io.protostuff.UninitializedMessageException;
- @Generated("java_bean")
- public final class Image implements Externalizable, Message<Image>, Schema<Image>
- {
- @Generated("java_bean")
- public enum Size implements io.protostuff.EnumLite<Size>
- {
- SMALL(0),
- LARGE(1);
- public final int number;
- private Size (int number)
- {
- this.number = number;
- }
- public int getNumber()
- {
- return number;
- }
- public static Size valueOf(int number)
- {
- switch(number)
- {
- case 0: return SMALL;
- case 1: return LARGE;
- default: return null;
- }
- }
- }
- public static Schema<Image> getSchema()
- {
- return DEFAULT_INSTANCE;
- }
- public static Image getDefaultInstance()
- {
- return DEFAULT_INSTANCE;
- }
- static final Image DEFAULT_INSTANCE = new Image();
- private String uri;
- private String title;
- private Integer width;
- private Integer height;
- private Size size;
- public Image()
- {
- }
- public Image(
- String uri,
- Integer width,
- Integer height,
- Size size
- )
- {
- this.uri = uri;
- this.width = width;
- this.height = height;
- this.size = size;
- }
- // getters and setters
- // uri
- public String getUri()
- {
- return uri;
- }
- public Image setUri(String uri)
- {
- this.uri = uri;
- return this;
- }
- // title
- public String getTitle()
- {
- return title;
- }
- public Image setTitle(String title)
- {
- this.title = title;
- return this;
- }
- // width
- public Integer getWidth()
- {
- return width;
- }
- public Image setWidth(Integer width)
- {
- this.width = width;
- return this;
- }
- // height
- public Integer getHeight()
- {
- return height;
- }
- public Image setHeight(Integer height)
- {
- this.height = height;
- return this;
- }
- // size
- public Size getSize()
- {
- return size;
- }
- public Image setSize(Size size)
- {
- this.size = size;
- return this;
- }
- @Override
- public boolean equals(Object obj) {
- if (this == obj) {
- return true;
- }
- if (obj == null || this.getClass() != obj.getClass()) {
- return false;
- }
- final Image that = (Image) obj;
- return
- Objects.equals(this.uri, that.uri) &&
- Objects.equals(this.title, that.title) &&
- Objects.equals(this.width, that.width) &&
- Objects.equals(this.height, that.height) &&
- Objects.equals(this.size, that.size);
- }
- @Override
- public int hashCode() {
- return Objects.hash(uri, title, width, height, size);
- }
- @Override
- public String toString() {
- return "Image{" +
- "uri=" + uri +
- ", title=" + title +
- ", width=" + width +
- ", height=" + height +
- ", size=" + size +
- '}';
- }
- // java serialization
- public void readExternal(ObjectInput in) throws IOException
- {
- GraphIOUtil.mergeDelimitedFrom(in, this, this);
- }
- public void writeExternal(ObjectOutput out) throws IOException
- {
- GraphIOUtil.writeDelimitedTo(out, this, this);
- }
- // message method
- public Schema<Image> cachedSchema()
- {
- return DEFAULT_INSTANCE;
- }
- // schema methods
- public Image newMessage()
- {
- return new Image();
- }
- public Class<Image> typeClass()
- {
- return Image.class;
- }
- public String messageName()
- {
- return Image.class.getSimpleName();
- }
- public String messageFullName()
- {
- return Image.class.getName();
- }
- public boolean isInitialized(Image message)
- {
- return
- message.uri != null
- && message.width != null
- && message.height != null
- && message.size != null;
- }
- public void mergeFrom(Input input, Image message) throws IOException
- {
- for(int number = input.readFieldNumber(this);; number = input.readFieldNumber(this))
- {
- switch(number)
- {
- case 0:
- return;
- case 1:
- message.uri = input.readString();
- break;
- case 2:
- message.title = input.readString();
- break;
- case 3:
- message.width = input.readInt32();
- break;
- case 4:
- message.height = input.readInt32();
- break;
- case 5:
- message.size = Size.valueOf(input.readEnum());
- break;
- default:
- input.handleUnknownField(number, this);
- }
- }
- }
- public void writeTo(Output output, Image message) throws IOException
- {
- if(message.uri == null)
- throw new UninitializedMessageException(message);
- output.writeString(1, message.uri, false);
- if(message.title != null)
- output.writeString(2, message.title, false);
- if(message.width == null)
- throw new UninitializedMessageException(message);
- output.writeInt32(3, message.width, false);
- if(message.height == null)
- throw new UninitializedMessageException(message);
- output.writeInt32(4, message.height, false);
- if(message.size == null)
- throw new UninitializedMessageException(message);
- output.writeEnum(5, message.size.number, false);
- }
- public String getFieldName(int number)
- {
- switch(number)
- {
- case 1: return "uri";
- case 2: return "title";
- case 3: return "width";
- case 4: return "height";
- case 5: return "size";
- default: return null;
- }
- }
- public int getFieldNumber(String name)
- {
- final Integer number = __fieldMap.get(name);
- return number == null ? 0 : number.intValue();
- }
- private static final java.util.HashMap<String,Integer> __fieldMap = new java.util.HashMap<String,Integer>();
- static
- {
- __fieldMap.put("uri", 1);
- __fieldMap.put("title", 2);
- __fieldMap.put("width", 3);
- __fieldMap.put("height", 4);
- __fieldMap.put("size", 5);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement