com.ursaj.hfs.message.HfsUploadInfo Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of hfs-messages Show documentation
Show all versions of hfs-messages Show documentation
HFS communication messages.
// Generated by http://code.google.com/p/protostuff/ ... DO NOT EDIT!
// Generated from messages.proto
package com.ursaj.hfs.message;
import java.io.Externalizable;
import java.io.IOException;
import java.io.ObjectInput;
import java.io.ObjectOutput;
import java.util.ArrayList;
import java.util.List;
import com.dyuproject.protostuff.GraphIOUtil;
import com.dyuproject.protostuff.Input;
import com.dyuproject.protostuff.Message;
import com.dyuproject.protostuff.Output;
import com.dyuproject.protostuff.Schema;
import com.dyuproject.protostuff.UninitializedMessageException;
public final class HfsUploadInfo implements Externalizable, Message
{
public static Schema getSchema()
{
return SCHEMA;
}
public static HfsUploadInfo getDefaultInstance()
{
return DEFAULT_INSTANCE;
}
static final HfsUploadInfo DEFAULT_INSTANCE = new HfsUploadInfo();
// non-private fields
// see http://developer.android.com/guide/practices/design/performance.html#package_inner
HfsUploadStatus status;
HfsLocation location;
List files;
public HfsUploadInfo()
{
}
public HfsUploadInfo(
HfsUploadStatus status
)
{
this.status = status;
}
// getters and setters
// status
public HfsUploadStatus getStatus()
{
return status;
}
public HfsUploadInfo setStatus(HfsUploadStatus status)
{
this.status = status;
return this;
}
// location
public HfsLocation getLocation()
{
return location;
}
public HfsUploadInfo setLocation(HfsLocation location)
{
this.location = location;
return this;
}
// files
public List getFilesList()
{
return files;
}
public HfsUploadInfo setFilesList(List files)
{
this.files = files;
return this;
}
public HfsFileInfo getFiles(int index)
{
return files == null ? null : files.get(index);
}
public int getFilesCount()
{
return files == null ? 0 : files.size();
}
public HfsUploadInfo addFiles(HfsFileInfo files)
{
if(this.files == null)
this.files = new ArrayList();
this.files.add(files);
return this;
}
// java serialization
public void readExternal(ObjectInput in) throws IOException
{
GraphIOUtil.mergeDelimitedFrom(in, this, SCHEMA);
}
public void writeExternal(ObjectOutput out) throws IOException
{
GraphIOUtil.writeDelimitedTo(out, this, SCHEMA);
}
// message method
public Schema cachedSchema()
{
return SCHEMA;
}
static final Schema SCHEMA = new Schema()
{
// schema methods
public HfsUploadInfo newMessage()
{
return new HfsUploadInfo();
}
public Class typeClass()
{
return HfsUploadInfo.class;
}
public String messageName()
{
return HfsUploadInfo.class.getSimpleName();
}
public String messageFullName()
{
return HfsUploadInfo.class.getName();
}
public boolean isInitialized(HfsUploadInfo message)
{
return
message.status != null;
}
public void mergeFrom(Input input, HfsUploadInfo message) throws IOException
{
for(int number = input.readFieldNumber(this);; number = input.readFieldNumber(this))
{
switch(number)
{
case 0:
return;
case 1:
message.status = input.mergeObject(message.status, HfsUploadStatus.getSchema());
break;
case 2:
message.location = input.mergeObject(message.location, HfsLocation.getSchema());
break;
case 3:
if(message.files == null)
message.files = new ArrayList();
message.files.add(input.mergeObject(null, HfsFileInfo.getSchema()));
break;
default:
input.handleUnknownField(number, this);
}
}
}
public void writeTo(Output output, HfsUploadInfo message) throws IOException
{
if(message.status == null)
throw new UninitializedMessageException(message);
output.writeObject(1, message.status, HfsUploadStatus.getSchema(), false);
if(message.location != null)
output.writeObject(2, message.location, HfsLocation.getSchema(), false);
if(message.files != null)
{
for(HfsFileInfo files : message.files)
{
if(files != null)
output.writeObject(3, files, HfsFileInfo.getSchema(), true);
}
}
}
public String getFieldName(int number)
{
switch(number)
{
case 1: return "status";
case 2: return "location";
case 3: return "files";
default: return null;
}
}
public int getFieldNumber(String name)
{
final Integer number = fieldMap.get(name);
return number == null ? 0 : number.intValue();
}
final java.util.HashMap fieldMap = new java.util.HashMap();
{
fieldMap.put("status", 1);
fieldMap.put("location", 2);
fieldMap.put("files", 3);
}
};
}