/** * Copyright (C) 2012 - present by OpenGamma Inc. and the OpenGamma group of companies * * Please see distribution for license. */ package com.opengamma.livedata.cogda.msg; import java.util.Map; import org.fudgemsg.FudgeMsg; import org.joda.beans.Bean; import org.joda.beans.BeanBuilder; import org.joda.beans.BeanDefinition; import org.joda.beans.JodaBeanUtils; import org.joda.beans.MetaProperty; import org.joda.beans.Property; import org.joda.beans.PropertyDefinition; import org.joda.beans.impl.direct.DirectBean; import org.joda.beans.impl.direct.DirectBeanBuilder; import org.joda.beans.impl.direct.DirectMetaBean; import org.joda.beans.impl.direct.DirectMetaProperty; import org.joda.beans.impl.direct.DirectMetaPropertyMap; import com.opengamma.id.ExternalId; /** * A message sent by the server whenever there is an update from a live data subscription. */ @BeanDefinition public class CogdaLiveDataUpdateMessage extends DirectBean { /** * The item to make a request on. */ @PropertyDefinition(validate = "notNull") private ExternalId _subscriptionId; /** * The optional name of the normalization scheme to request. */ @PropertyDefinition private String _normalizationScheme; /** * The values that have changed. */ @PropertyDefinition(validate = "notNull") private FudgeMsg _values; //------------------------- AUTOGENERATED START ------------------------- ///CLOVER:OFF /** * The meta-bean for {@code CogdaLiveDataUpdateMessage}. * @return the meta-bean, not null */ public static CogdaLiveDataUpdateMessage.Meta meta() { return CogdaLiveDataUpdateMessage.Meta.INSTANCE; } static { JodaBeanUtils.registerMetaBean(CogdaLiveDataUpdateMessage.Meta.INSTANCE); } @Override public CogdaLiveDataUpdateMessage.Meta metaBean() { return CogdaLiveDataUpdateMessage.Meta.INSTANCE; } //----------------------------------------------------------------------- /** * Gets the item to make a request on. * @return the value of the property, not null */ public ExternalId getSubscriptionId() { return _subscriptionId; } /** * Sets the item to make a request on. * @param subscriptionId the new value of the property, not null */ public void setSubscriptionId(ExternalId subscriptionId) { JodaBeanUtils.notNull(subscriptionId, "subscriptionId"); this._subscriptionId = subscriptionId; } /** * Gets the the {@code subscriptionId} property. * @return the property, not null */ public final Property<ExternalId> subscriptionId() { return metaBean().subscriptionId().createProperty(this); } //----------------------------------------------------------------------- /** * Gets the optional name of the normalization scheme to request. * @return the value of the property */ public String getNormalizationScheme() { return _normalizationScheme; } /** * Sets the optional name of the normalization scheme to request. * @param normalizationScheme the new value of the property */ public void setNormalizationScheme(String normalizationScheme) { this._normalizationScheme = normalizationScheme; } /** * Gets the the {@code normalizationScheme} property. * @return the property, not null */ public final Property<String> normalizationScheme() { return metaBean().normalizationScheme().createProperty(this); } //----------------------------------------------------------------------- /** * Gets the values that have changed. * @return the value of the property, not null */ public FudgeMsg getValues() { return _values; } /** * Sets the values that have changed. * @param values the new value of the property, not null */ public void setValues(FudgeMsg values) { JodaBeanUtils.notNull(values, "values"); this._values = values; } /** * Gets the the {@code values} property. * @return the property, not null */ public final Property<FudgeMsg> values() { return metaBean().values().createProperty(this); } //----------------------------------------------------------------------- @Override public CogdaLiveDataUpdateMessage clone() { return JodaBeanUtils.cloneAlways(this); } @Override public boolean equals(Object obj) { if (obj == this) { return true; } if (obj != null && obj.getClass() == this.getClass()) { CogdaLiveDataUpdateMessage other = (CogdaLiveDataUpdateMessage) obj; return JodaBeanUtils.equal(getSubscriptionId(), other.getSubscriptionId()) && JodaBeanUtils.equal(getNormalizationScheme(), other.getNormalizationScheme()) && JodaBeanUtils.equal(getValues(), other.getValues()); } return false; } @Override public int hashCode() { int hash = getClass().hashCode(); hash = hash * 31 + JodaBeanUtils.hashCode(getSubscriptionId()); hash = hash * 31 + JodaBeanUtils.hashCode(getNormalizationScheme()); hash = hash * 31 + JodaBeanUtils.hashCode(getValues()); return hash; } @Override public String toString() { StringBuilder buf = new StringBuilder(128); buf.append("CogdaLiveDataUpdateMessage{"); int len = buf.length(); toString(buf); if (buf.length() > len) { buf.setLength(buf.length() - 2); } buf.append('}'); return buf.toString(); } protected void toString(StringBuilder buf) { buf.append("subscriptionId").append('=').append(JodaBeanUtils.toString(getSubscriptionId())).append(',').append(' '); buf.append("normalizationScheme").append('=').append(JodaBeanUtils.toString(getNormalizationScheme())).append(',').append(' '); buf.append("values").append('=').append(JodaBeanUtils.toString(getValues())).append(',').append(' '); } //----------------------------------------------------------------------- /** * The meta-bean for {@code CogdaLiveDataUpdateMessage}. */ public static class Meta extends DirectMetaBean { /** * The singleton instance of the meta-bean. */ static final Meta INSTANCE = new Meta(); /** * The meta-property for the {@code subscriptionId} property. */ private final MetaProperty<ExternalId> _subscriptionId = DirectMetaProperty.ofReadWrite( this, "subscriptionId", CogdaLiveDataUpdateMessage.class, ExternalId.class); /** * The meta-property for the {@code normalizationScheme} property. */ private final MetaProperty<String> _normalizationScheme = DirectMetaProperty.ofReadWrite( this, "normalizationScheme", CogdaLiveDataUpdateMessage.class, String.class); /** * The meta-property for the {@code values} property. */ private final MetaProperty<FudgeMsg> _values = DirectMetaProperty.ofReadWrite( this, "values", CogdaLiveDataUpdateMessage.class, FudgeMsg.class); /** * The meta-properties. */ private final Map<String, MetaProperty<?>> _metaPropertyMap$ = new DirectMetaPropertyMap( this, null, "subscriptionId", "normalizationScheme", "values"); /** * Restricted constructor. */ protected Meta() { } @Override protected MetaProperty<?> metaPropertyGet(String propertyName) { switch (propertyName.hashCode()) { case 1478790936: // subscriptionId return _subscriptionId; case -1440170590: // normalizationScheme return _normalizationScheme; case -823812830: // values return _values; } return super.metaPropertyGet(propertyName); } @Override public BeanBuilder<? extends CogdaLiveDataUpdateMessage> builder() { return new DirectBeanBuilder<CogdaLiveDataUpdateMessage>(new CogdaLiveDataUpdateMessage()); } @Override public Class<? extends CogdaLiveDataUpdateMessage> beanType() { return CogdaLiveDataUpdateMessage.class; } @Override public Map<String, MetaProperty<?>> metaPropertyMap() { return _metaPropertyMap$; } //----------------------------------------------------------------------- /** * The meta-property for the {@code subscriptionId} property. * @return the meta-property, not null */ public final MetaProperty<ExternalId> subscriptionId() { return _subscriptionId; } /** * The meta-property for the {@code normalizationScheme} property. * @return the meta-property, not null */ public final MetaProperty<String> normalizationScheme() { return _normalizationScheme; } /** * The meta-property for the {@code values} property. * @return the meta-property, not null */ public final MetaProperty<FudgeMsg> values() { return _values; } //----------------------------------------------------------------------- @Override protected Object propertyGet(Bean bean, String propertyName, boolean quiet) { switch (propertyName.hashCode()) { case 1478790936: // subscriptionId return ((CogdaLiveDataUpdateMessage) bean).getSubscriptionId(); case -1440170590: // normalizationScheme return ((CogdaLiveDataUpdateMessage) bean).getNormalizationScheme(); case -823812830: // values return ((CogdaLiveDataUpdateMessage) bean).getValues(); } return super.propertyGet(bean, propertyName, quiet); } @Override protected void propertySet(Bean bean, String propertyName, Object newValue, boolean quiet) { switch (propertyName.hashCode()) { case 1478790936: // subscriptionId ((CogdaLiveDataUpdateMessage) bean).setSubscriptionId((ExternalId) newValue); return; case -1440170590: // normalizationScheme ((CogdaLiveDataUpdateMessage) bean).setNormalizationScheme((String) newValue); return; case -823812830: // values ((CogdaLiveDataUpdateMessage) bean).setValues((FudgeMsg) newValue); return; } super.propertySet(bean, propertyName, newValue, quiet); } @Override protected void validate(Bean bean) { JodaBeanUtils.notNull(((CogdaLiveDataUpdateMessage) bean)._subscriptionId, "subscriptionId"); JodaBeanUtils.notNull(((CogdaLiveDataUpdateMessage) bean)._values, "values"); } } ///CLOVER:ON //-------------------------- AUTOGENERATED END -------------------------- }