// Automatically created - do not modify - CSOFF
///CLOVER:OFF
package com.opengamma.engine.cache.msg;
public class GetRequest extends com.opengamma.engine.cache.msg.CacheMessage implements java.io.Serializable {
public CacheMessage accept (CacheMessageVisitor visitor) { return visitor.visitGetRequest (this); }
private static final long serialVersionUID = 33807717922395858l;
private com.opengamma.id.UniqueId _viewCycleId;
public static final String VIEW_CYCLE_ID_KEY = "viewCycleId";
private String _calculationConfigurationName;
public static final String CALCULATION_CONFIGURATION_NAME_KEY = "calculationConfigurationName";
private java.util.List<Long> _identifier;
public static final String IDENTIFIER_KEY = "identifier";
public GetRequest (com.opengamma.id.UniqueId viewCycleId, String calculationConfigurationName, java.util.Collection<? extends Long> identifier) {
if (viewCycleId == null) throw new NullPointerException ("'viewCycleId' cannot be null");
else {
_viewCycleId = viewCycleId;
}
if (calculationConfigurationName == null) throw new NullPointerException ("calculationConfigurationName' cannot be null");
_calculationConfigurationName = calculationConfigurationName;
if (identifier == null) throw new NullPointerException ("'identifier' cannot be null");
else {
final java.util.List<Long> fudge0 = new java.util.ArrayList<Long> (identifier);
if (identifier.size () == 0) throw new IllegalArgumentException ("'identifier' cannot be an empty list");
for (java.util.ListIterator<Long> fudge1 = fudge0.listIterator (); fudge1.hasNext (); ) {
Long fudge2 = fudge1.next ();
if (fudge2 == null) throw new NullPointerException ("List element of 'identifier' cannot be null");
}
_identifier = fudge0;
}
}
protected GetRequest (final org.fudgemsg.mapping.FudgeDeserializer deserializer, final org.fudgemsg.FudgeMsg fudgeMsg) {
super (deserializer, fudgeMsg);
org.fudgemsg.FudgeField fudgeField;
java.util.List<org.fudgemsg.FudgeField> fudgeFields;
fudgeField = fudgeMsg.getByName (VIEW_CYCLE_ID_KEY);
if (fudgeField == null) throw new IllegalArgumentException ("Fudge message is not a GetRequest - field 'viewCycleId' is not present");
try {
_viewCycleId = com.opengamma.id.UniqueId.fromFudgeMsg (deserializer, fudgeMsg.getFieldValue (org.fudgemsg.FudgeMsg.class, fudgeField));
}
catch (IllegalArgumentException e) {
throw new IllegalArgumentException ("Fudge message is not a GetRequest - field 'viewCycleId' is not UniqueId message", e);
}
fudgeField = fudgeMsg.getByName (CALCULATION_CONFIGURATION_NAME_KEY);
if (fudgeField == null) throw new IllegalArgumentException ("Fudge message is not a GetRequest - field 'calculationConfigurationName' is not present");
try {
_calculationConfigurationName = fudgeField.getValue ().toString ();
}
catch (IllegalArgumentException e) {
throw new IllegalArgumentException ("Fudge message is not a GetRequest - field 'calculationConfigurationName' is not string", e);
}
fudgeFields = fudgeMsg.getAllByName (IDENTIFIER_KEY);
if (fudgeFields.size () == 0) throw new IllegalArgumentException ("Fudge message is not a GetRequest - field 'identifier' is not present");
_identifier = new java.util.ArrayList<Long> (fudgeFields.size ());
for (org.fudgemsg.FudgeField fudge1 : fudgeFields) {
try {
_identifier.add (fudgeMsg.getFieldValue (Long.class, fudge1));
}
catch (IllegalArgumentException e) {
throw new IllegalArgumentException ("Fudge message is not a GetRequest - field 'identifier' is not long", e);
}
}
}
public GetRequest (Long correlationId, com.opengamma.id.UniqueId viewCycleId, String calculationConfigurationName, java.util.Collection<? extends Long> identifier) {
super (correlationId);
if (viewCycleId == null) throw new NullPointerException ("'viewCycleId' cannot be null");
else {
_viewCycleId = viewCycleId;
}
if (calculationConfigurationName == null) throw new NullPointerException ("calculationConfigurationName' cannot be null");
_calculationConfigurationName = calculationConfigurationName;
if (identifier == null) throw new NullPointerException ("'identifier' cannot be null");
else {
final java.util.List<Long> fudge0 = new java.util.ArrayList<Long> (identifier);
if (identifier.size () == 0) throw new IllegalArgumentException ("'identifier' cannot be an empty list");
for (java.util.ListIterator<Long> fudge1 = fudge0.listIterator (); fudge1.hasNext (); ) {
Long fudge2 = fudge1.next ();
if (fudge2 == null) throw new NullPointerException ("List element of 'identifier' cannot be null");
}
_identifier = fudge0;
}
}
protected GetRequest (final GetRequest source) {
super (source);
if (source == null) throw new NullPointerException ("'source' must not be null");
if (source._viewCycleId == null) _viewCycleId = null;
else {
_viewCycleId = source._viewCycleId;
}
_calculationConfigurationName = source._calculationConfigurationName;
if (source._identifier == null) _identifier = null;
else {
_identifier = new java.util.ArrayList<Long> (source._identifier);
}
}
public GetRequest clone () {
return new GetRequest (this);
}
public org.fudgemsg.FudgeMsg toFudgeMsg (final org.fudgemsg.mapping.FudgeSerializer serializer) {
if (serializer == null) throw new NullPointerException ("serializer must not be null");
final org.fudgemsg.MutableFudgeMsg msg = serializer.newMessage ();
toFudgeMsg (serializer, msg);
return msg;
}
public void toFudgeMsg (final org.fudgemsg.mapping.FudgeSerializer serializer, final org.fudgemsg.MutableFudgeMsg msg) {
super.toFudgeMsg (serializer, msg);
if (_viewCycleId != null) {
final org.fudgemsg.MutableFudgeMsg fudge1 = org.fudgemsg.mapping.FudgeSerializer.addClassHeader (serializer.newMessage (), _viewCycleId.getClass (), com.opengamma.id.UniqueId.class);
_viewCycleId.toFudgeMsg (serializer, fudge1);
msg.add (VIEW_CYCLE_ID_KEY, null, fudge1);
}
if (_calculationConfigurationName != null) {
msg.add (CALCULATION_CONFIGURATION_NAME_KEY, null, _calculationConfigurationName);
}
if (_identifier != null) {
for (Long fudge1 : _identifier) {
msg.add (IDENTIFIER_KEY, null, fudge1);
}
}
}
public static GetRequest fromFudgeMsg (final org.fudgemsg.mapping.FudgeDeserializer deserializer, final org.fudgemsg.FudgeMsg fudgeMsg) {
final java.util.List<org.fudgemsg.FudgeField> types = fudgeMsg.getAllByOrdinal (0);
for (org.fudgemsg.FudgeField field : types) {
final String className = (String)field.getValue ();
if ("com.opengamma.engine.cache.msg.GetRequest".equals (className)) break;
try {
return (com.opengamma.engine.cache.msg.GetRequest)Class.forName (className).getDeclaredMethod ("fromFudgeMsg", org.fudgemsg.mapping.FudgeDeserializer.class, org.fudgemsg.FudgeMsg.class).invoke (null, deserializer, fudgeMsg);
}
catch (Throwable t) {
// no-action
}
}
return new GetRequest (deserializer, fudgeMsg);
}
public com.opengamma.id.UniqueId getViewCycleId () {
return _viewCycleId;
}
public void setViewCycleId (com.opengamma.id.UniqueId viewCycleId) {
if (viewCycleId == null) throw new NullPointerException ("'viewCycleId' cannot be null");
else {
_viewCycleId = viewCycleId;
}
}
public String getCalculationConfigurationName () {
return _calculationConfigurationName;
}
public void setCalculationConfigurationName (String calculationConfigurationName) {
if (calculationConfigurationName == null) throw new NullPointerException ("calculationConfigurationName' cannot be null");
_calculationConfigurationName = calculationConfigurationName;
}
public java.util.List<Long> getIdentifier () {
return java.util.Collections.unmodifiableList (_identifier);
}
public void setIdentifier (Long identifier) {
if (identifier == null) throw new NullPointerException ("'identifier' cannot be null");
else {
_identifier = new java.util.ArrayList<Long> (1);
addIdentifier (identifier);
}
}
public void setIdentifier (java.util.Collection<? extends Long> identifier) {
if (identifier == null) throw new NullPointerException ("'identifier' cannot be null");
else {
final java.util.List<Long> fudge0 = new java.util.ArrayList<Long> (identifier);
if (identifier.size () == 0) throw new IllegalArgumentException ("'identifier' cannot be an empty list");
for (java.util.ListIterator<Long> fudge1 = fudge0.listIterator (); fudge1.hasNext (); ) {
Long fudge2 = fudge1.next ();
if (fudge2 == null) throw new NullPointerException ("List element of 'identifier' cannot be null");
}
_identifier = fudge0;
}
}
public void addIdentifier (Long identifier) {
if (identifier == null) throw new NullPointerException ("'identifier' cannot be null");
if (_identifier == null) _identifier = new java.util.ArrayList<Long> ();
_identifier.add (identifier);
}
public String toString () {
return org.apache.commons.lang.builder.ToStringBuilder.reflectionToString(this, org.apache.commons.lang.builder.ToStringStyle.SHORT_PREFIX_STYLE);
}
}
///CLOVER:ON - CSON