/** * 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.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.DirectMetaProperty; import org.joda.beans.impl.direct.DirectMetaPropertyMap; import com.opengamma.id.ExternalId; /** * The base class for all requests relating to an individual live data request. */ @BeanDefinition public abstract class CogdaLiveDataCommandMessage extends CogdaCommandMessage { /** * 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; //------------------------- AUTOGENERATED START ------------------------- ///CLOVER:OFF /** * The meta-bean for {@code CogdaLiveDataCommandMessage}. * @return the meta-bean, not null */ public static CogdaLiveDataCommandMessage.Meta meta() { return CogdaLiveDataCommandMessage.Meta.INSTANCE; } static { JodaBeanUtils.registerMetaBean(CogdaLiveDataCommandMessage.Meta.INSTANCE); } @Override public CogdaLiveDataCommandMessage.Meta metaBean() { return CogdaLiveDataCommandMessage.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); } //----------------------------------------------------------------------- @Override public boolean equals(Object obj) { if (obj == this) { return true; } if (obj != null && obj.getClass() == this.getClass()) { CogdaLiveDataCommandMessage other = (CogdaLiveDataCommandMessage) obj; return JodaBeanUtils.equal(getSubscriptionId(), other.getSubscriptionId()) && JodaBeanUtils.equal(getNormalizationScheme(), other.getNormalizationScheme()) && super.equals(obj); } return false; } @Override public int hashCode() { int hash = 7; hash = hash * 31 + JodaBeanUtils.hashCode(getSubscriptionId()); hash = hash * 31 + JodaBeanUtils.hashCode(getNormalizationScheme()); return hash ^ super.hashCode(); } @Override public String toString() { StringBuilder buf = new StringBuilder(96); buf.append("CogdaLiveDataCommandMessage{"); int len = buf.length(); toString(buf); if (buf.length() > len) { buf.setLength(buf.length() - 2); } buf.append('}'); return buf.toString(); } @Override protected void toString(StringBuilder buf) { super.toString(buf); buf.append("subscriptionId").append('=').append(JodaBeanUtils.toString(getSubscriptionId())).append(',').append(' '); buf.append("normalizationScheme").append('=').append(JodaBeanUtils.toString(getNormalizationScheme())).append(',').append(' '); } //----------------------------------------------------------------------- /** * The meta-bean for {@code CogdaLiveDataCommandMessage}. */ public static class Meta extends CogdaCommandMessage.Meta { /** * 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", CogdaLiveDataCommandMessage.class, ExternalId.class); /** * The meta-property for the {@code normalizationScheme} property. */ private final MetaProperty<String> _normalizationScheme = DirectMetaProperty.ofReadWrite( this, "normalizationScheme", CogdaLiveDataCommandMessage.class, String.class); /** * The meta-properties. */ private final Map<String, MetaProperty<?>> _metaPropertyMap$ = new DirectMetaPropertyMap( this, (DirectMetaPropertyMap) super.metaPropertyMap(), "subscriptionId", "normalizationScheme"); /** * Restricted constructor. */ protected Meta() { } @Override protected MetaProperty<?> metaPropertyGet(String propertyName) { switch (propertyName.hashCode()) { case 1478790936: // subscriptionId return _subscriptionId; case -1440170590: // normalizationScheme return _normalizationScheme; } return super.metaPropertyGet(propertyName); } @Override public BeanBuilder<? extends CogdaLiveDataCommandMessage> builder() { throw new UnsupportedOperationException("CogdaLiveDataCommandMessage is an abstract class"); } @Override public Class<? extends CogdaLiveDataCommandMessage> beanType() { return CogdaLiveDataCommandMessage.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; } //----------------------------------------------------------------------- @Override protected Object propertyGet(Bean bean, String propertyName, boolean quiet) { switch (propertyName.hashCode()) { case 1478790936: // subscriptionId return ((CogdaLiveDataCommandMessage) bean).getSubscriptionId(); case -1440170590: // normalizationScheme return ((CogdaLiveDataCommandMessage) bean).getNormalizationScheme(); } return super.propertyGet(bean, propertyName, quiet); } @Override protected void propertySet(Bean bean, String propertyName, Object newValue, boolean quiet) { switch (propertyName.hashCode()) { case 1478790936: // subscriptionId ((CogdaLiveDataCommandMessage) bean).setSubscriptionId((ExternalId) newValue); return; case -1440170590: // normalizationScheme ((CogdaLiveDataCommandMessage) bean).setNormalizationScheme((String) newValue); return; } super.propertySet(bean, propertyName, newValue, quiet); } @Override protected void validate(Bean bean) { JodaBeanUtils.notNull(((CogdaLiveDataCommandMessage) bean)._subscriptionId, "subscriptionId"); super.validate(bean); } } ///CLOVER:ON //-------------------------- AUTOGENERATED END -------------------------- }