/** * Copyright (C) 2011 - present by OpenGamma Inc. and the OpenGamma group of companies * * Please see distribution for license. */ package com.opengamma.engine.view.cycle; import java.util.Collection; import java.util.Map; import java.util.Set; 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 org.threeten.bp.Instant; import com.opengamma.engine.ComputationTargetSpecification; import com.opengamma.engine.value.ValueRequirement; import com.opengamma.engine.value.ValueSpecification; import com.opengamma.id.UniqueId; import com.opengamma.id.VersionCorrection; /** * Class encapsulating information available on cycle initialisation */ @BeanDefinition public class DefaultViewCycleMetadata extends DirectBean implements ViewCycleMetadata { @PropertyDefinition private UniqueId _viewCycleId; @PropertyDefinition private UniqueId _marketDataSnapshotId; @PropertyDefinition private UniqueId _viewDefinitionId; @PropertyDefinition private VersionCorrection _versionCorrection; @PropertyDefinition private Instant _valuationTime; @PropertyDefinition private Collection<String> _allCalculationConfigurationNames; @PropertyDefinition private Map<String, Collection<ComputationTargetSpecification>> _computationTargetsByCalcConfig; @PropertyDefinition private Map<String, Map<ValueSpecification, Set<ValueRequirement>>> _terminalOutputsByCalcConfig; @PropertyDefinition private String _name; public DefaultViewCycleMetadata() { } public DefaultViewCycleMetadata(UniqueId viewCycleId, UniqueId marketDataSnapshotUniqueId, UniqueId viewDefinitionId, VersionCorrection versionCorrection, Instant valuationTime, Collection<String> allCalculationConfigurationNames, Map<String, Collection<ComputationTargetSpecification>> computationTargetsByConfigName, Map<String, Map<ValueSpecification, Set<ValueRequirement>>> terminalOutputsByConfigName, String name) { _viewCycleId = viewCycleId; _marketDataSnapshotId = marketDataSnapshotUniqueId; _viewDefinitionId = viewDefinitionId; _versionCorrection = versionCorrection; _valuationTime = valuationTime; _allCalculationConfigurationNames = allCalculationConfigurationNames; _computationTargetsByCalcConfig = computationTargetsByConfigName; _terminalOutputsByCalcConfig = terminalOutputsByConfigName; _name = name; } @Override public Collection<ComputationTargetSpecification> getComputationTargets(String configurationName) { return getComputationTargetsByCalcConfig().get(configurationName); } @Override public Map<ValueSpecification, Set<ValueRequirement>> getTerminalOutputs(String configurationName) { return getTerminalOutputsByCalcConfig().get(configurationName); } //------------------------- AUTOGENERATED START ------------------------- ///CLOVER:OFF /** * The meta-bean for {@code DefaultViewCycleMetadata}. * @return the meta-bean, not null */ public static DefaultViewCycleMetadata.Meta meta() { return DefaultViewCycleMetadata.Meta.INSTANCE; } static { JodaBeanUtils.registerMetaBean(DefaultViewCycleMetadata.Meta.INSTANCE); } @Override public DefaultViewCycleMetadata.Meta metaBean() { return DefaultViewCycleMetadata.Meta.INSTANCE; } //----------------------------------------------------------------------- /** * Gets the viewCycleId. * @return the value of the property */ public UniqueId getViewCycleId() { return _viewCycleId; } /** * Sets the viewCycleId. * @param viewCycleId the new value of the property */ public void setViewCycleId(UniqueId viewCycleId) { this._viewCycleId = viewCycleId; } /** * Gets the the {@code viewCycleId} property. * @return the property, not null */ public final Property<UniqueId> viewCycleId() { return metaBean().viewCycleId().createProperty(this); } //----------------------------------------------------------------------- /** * Gets the marketDataSnapshotId. * @return the value of the property */ public UniqueId getMarketDataSnapshotId() { return _marketDataSnapshotId; } /** * Sets the marketDataSnapshotId. * @param marketDataSnapshotId the new value of the property */ public void setMarketDataSnapshotId(UniqueId marketDataSnapshotId) { this._marketDataSnapshotId = marketDataSnapshotId; } /** * Gets the the {@code marketDataSnapshotId} property. * @return the property, not null */ public final Property<UniqueId> marketDataSnapshotId() { return metaBean().marketDataSnapshotId().createProperty(this); } //----------------------------------------------------------------------- /** * Gets the viewDefinitionId. * @return the value of the property */ public UniqueId getViewDefinitionId() { return _viewDefinitionId; } /** * Sets the viewDefinitionId. * @param viewDefinitionId the new value of the property */ public void setViewDefinitionId(UniqueId viewDefinitionId) { this._viewDefinitionId = viewDefinitionId; } /** * Gets the the {@code viewDefinitionId} property. * @return the property, not null */ public final Property<UniqueId> viewDefinitionId() { return metaBean().viewDefinitionId().createProperty(this); } //----------------------------------------------------------------------- /** * Gets the versionCorrection. * @return the value of the property */ public VersionCorrection getVersionCorrection() { return _versionCorrection; } /** * Sets the versionCorrection. * @param versionCorrection the new value of the property */ public void setVersionCorrection(VersionCorrection versionCorrection) { this._versionCorrection = versionCorrection; } /** * Gets the the {@code versionCorrection} property. * @return the property, not null */ public final Property<VersionCorrection> versionCorrection() { return metaBean().versionCorrection().createProperty(this); } //----------------------------------------------------------------------- /** * Gets the valuationTime. * @return the value of the property */ public Instant getValuationTime() { return _valuationTime; } /** * Sets the valuationTime. * @param valuationTime the new value of the property */ public void setValuationTime(Instant valuationTime) { this._valuationTime = valuationTime; } /** * Gets the the {@code valuationTime} property. * @return the property, not null */ public final Property<Instant> valuationTime() { return metaBean().valuationTime().createProperty(this); } //----------------------------------------------------------------------- /** * Gets the allCalculationConfigurationNames. * @return the value of the property */ public Collection<String> getAllCalculationConfigurationNames() { return _allCalculationConfigurationNames; } /** * Sets the allCalculationConfigurationNames. * @param allCalculationConfigurationNames the new value of the property */ public void setAllCalculationConfigurationNames(Collection<String> allCalculationConfigurationNames) { this._allCalculationConfigurationNames = allCalculationConfigurationNames; } /** * Gets the the {@code allCalculationConfigurationNames} property. * @return the property, not null */ public final Property<Collection<String>> allCalculationConfigurationNames() { return metaBean().allCalculationConfigurationNames().createProperty(this); } //----------------------------------------------------------------------- /** * Gets the computationTargetsByCalcConfig. * @return the value of the property */ public Map<String, Collection<ComputationTargetSpecification>> getComputationTargetsByCalcConfig() { return _computationTargetsByCalcConfig; } /** * Sets the computationTargetsByCalcConfig. * @param computationTargetsByCalcConfig the new value of the property */ public void setComputationTargetsByCalcConfig(Map<String, Collection<ComputationTargetSpecification>> computationTargetsByCalcConfig) { this._computationTargetsByCalcConfig = computationTargetsByCalcConfig; } /** * Gets the the {@code computationTargetsByCalcConfig} property. * @return the property, not null */ public final Property<Map<String, Collection<ComputationTargetSpecification>>> computationTargetsByCalcConfig() { return metaBean().computationTargetsByCalcConfig().createProperty(this); } //----------------------------------------------------------------------- /** * Gets the terminalOutputsByCalcConfig. * @return the value of the property */ public Map<String, Map<ValueSpecification, Set<ValueRequirement>>> getTerminalOutputsByCalcConfig() { return _terminalOutputsByCalcConfig; } /** * Sets the terminalOutputsByCalcConfig. * @param terminalOutputsByCalcConfig the new value of the property */ public void setTerminalOutputsByCalcConfig(Map<String, Map<ValueSpecification, Set<ValueRequirement>>> terminalOutputsByCalcConfig) { this._terminalOutputsByCalcConfig = terminalOutputsByCalcConfig; } /** * Gets the the {@code terminalOutputsByCalcConfig} property. * @return the property, not null */ public final Property<Map<String, Map<ValueSpecification, Set<ValueRequirement>>>> terminalOutputsByCalcConfig() { return metaBean().terminalOutputsByCalcConfig().createProperty(this); } //----------------------------------------------------------------------- /** * Gets the name. * @return the value of the property */ public String getName() { return _name; } /** * Sets the name. * @param name the new value of the property */ public void setName(String name) { this._name = name; } /** * Gets the the {@code name} property. * @return the property, not null */ public final Property<String> name() { return metaBean().name().createProperty(this); } //----------------------------------------------------------------------- @Override public DefaultViewCycleMetadata clone() { return JodaBeanUtils.cloneAlways(this); } @Override public boolean equals(Object obj) { if (obj == this) { return true; } if (obj != null && obj.getClass() == this.getClass()) { DefaultViewCycleMetadata other = (DefaultViewCycleMetadata) obj; return JodaBeanUtils.equal(getViewCycleId(), other.getViewCycleId()) && JodaBeanUtils.equal(getMarketDataSnapshotId(), other.getMarketDataSnapshotId()) && JodaBeanUtils.equal(getViewDefinitionId(), other.getViewDefinitionId()) && JodaBeanUtils.equal(getVersionCorrection(), other.getVersionCorrection()) && JodaBeanUtils.equal(getValuationTime(), other.getValuationTime()) && JodaBeanUtils.equal(getAllCalculationConfigurationNames(), other.getAllCalculationConfigurationNames()) && JodaBeanUtils.equal(getComputationTargetsByCalcConfig(), other.getComputationTargetsByCalcConfig()) && JodaBeanUtils.equal(getTerminalOutputsByCalcConfig(), other.getTerminalOutputsByCalcConfig()) && JodaBeanUtils.equal(getName(), other.getName()); } return false; } @Override public int hashCode() { int hash = getClass().hashCode(); hash = hash * 31 + JodaBeanUtils.hashCode(getViewCycleId()); hash = hash * 31 + JodaBeanUtils.hashCode(getMarketDataSnapshotId()); hash = hash * 31 + JodaBeanUtils.hashCode(getViewDefinitionId()); hash = hash * 31 + JodaBeanUtils.hashCode(getVersionCorrection()); hash = hash * 31 + JodaBeanUtils.hashCode(getValuationTime()); hash = hash * 31 + JodaBeanUtils.hashCode(getAllCalculationConfigurationNames()); hash = hash * 31 + JodaBeanUtils.hashCode(getComputationTargetsByCalcConfig()); hash = hash * 31 + JodaBeanUtils.hashCode(getTerminalOutputsByCalcConfig()); hash = hash * 31 + JodaBeanUtils.hashCode(getName()); return hash; } @Override public String toString() { StringBuilder buf = new StringBuilder(320); buf.append("DefaultViewCycleMetadata{"); 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("viewCycleId").append('=').append(JodaBeanUtils.toString(getViewCycleId())).append(',').append(' '); buf.append("marketDataSnapshotId").append('=').append(JodaBeanUtils.toString(getMarketDataSnapshotId())).append(',').append(' '); buf.append("viewDefinitionId").append('=').append(JodaBeanUtils.toString(getViewDefinitionId())).append(',').append(' '); buf.append("versionCorrection").append('=').append(JodaBeanUtils.toString(getVersionCorrection())).append(',').append(' '); buf.append("valuationTime").append('=').append(JodaBeanUtils.toString(getValuationTime())).append(',').append(' '); buf.append("allCalculationConfigurationNames").append('=').append(JodaBeanUtils.toString(getAllCalculationConfigurationNames())).append(',').append(' '); buf.append("computationTargetsByCalcConfig").append('=').append(JodaBeanUtils.toString(getComputationTargetsByCalcConfig())).append(',').append(' '); buf.append("terminalOutputsByCalcConfig").append('=').append(JodaBeanUtils.toString(getTerminalOutputsByCalcConfig())).append(',').append(' '); buf.append("name").append('=').append(JodaBeanUtils.toString(getName())).append(',').append(' '); } //----------------------------------------------------------------------- /** * The meta-bean for {@code DefaultViewCycleMetadata}. */ 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 viewCycleId} property. */ private final MetaProperty<UniqueId> _viewCycleId = DirectMetaProperty.ofReadWrite( this, "viewCycleId", DefaultViewCycleMetadata.class, UniqueId.class); /** * The meta-property for the {@code marketDataSnapshotId} property. */ private final MetaProperty<UniqueId> _marketDataSnapshotId = DirectMetaProperty.ofReadWrite( this, "marketDataSnapshotId", DefaultViewCycleMetadata.class, UniqueId.class); /** * The meta-property for the {@code viewDefinitionId} property. */ private final MetaProperty<UniqueId> _viewDefinitionId = DirectMetaProperty.ofReadWrite( this, "viewDefinitionId", DefaultViewCycleMetadata.class, UniqueId.class); /** * The meta-property for the {@code versionCorrection} property. */ private final MetaProperty<VersionCorrection> _versionCorrection = DirectMetaProperty.ofReadWrite( this, "versionCorrection", DefaultViewCycleMetadata.class, VersionCorrection.class); /** * The meta-property for the {@code valuationTime} property. */ private final MetaProperty<Instant> _valuationTime = DirectMetaProperty.ofReadWrite( this, "valuationTime", DefaultViewCycleMetadata.class, Instant.class); /** * The meta-property for the {@code allCalculationConfigurationNames} property. */ @SuppressWarnings({"unchecked", "rawtypes" }) private final MetaProperty<Collection<String>> _allCalculationConfigurationNames = DirectMetaProperty.ofReadWrite( this, "allCalculationConfigurationNames", DefaultViewCycleMetadata.class, (Class) Collection.class); /** * The meta-property for the {@code computationTargetsByCalcConfig} property. */ @SuppressWarnings({"unchecked", "rawtypes" }) private final MetaProperty<Map<String, Collection<ComputationTargetSpecification>>> _computationTargetsByCalcConfig = DirectMetaProperty.ofReadWrite( this, "computationTargetsByCalcConfig", DefaultViewCycleMetadata.class, (Class) Map.class); /** * The meta-property for the {@code terminalOutputsByCalcConfig} property. */ @SuppressWarnings({"unchecked", "rawtypes" }) private final MetaProperty<Map<String, Map<ValueSpecification, Set<ValueRequirement>>>> _terminalOutputsByCalcConfig = DirectMetaProperty.ofReadWrite( this, "terminalOutputsByCalcConfig", DefaultViewCycleMetadata.class, (Class) Map.class); /** * The meta-property for the {@code name} property. */ private final MetaProperty<String> _name = DirectMetaProperty.ofReadWrite( this, "name", DefaultViewCycleMetadata.class, String.class); /** * The meta-properties. */ private final Map<String, MetaProperty<?>> _metaPropertyMap$ = new DirectMetaPropertyMap( this, null, "viewCycleId", "marketDataSnapshotId", "viewDefinitionId", "versionCorrection", "valuationTime", "allCalculationConfigurationNames", "computationTargetsByCalcConfig", "terminalOutputsByCalcConfig", "name"); /** * Restricted constructor. */ protected Meta() { } @Override protected MetaProperty<?> metaPropertyGet(String propertyName) { switch (propertyName.hashCode()) { case 1217858108: // viewCycleId return _viewCycleId; case -41253723: // marketDataSnapshotId return _marketDataSnapshotId; case -545262317: // viewDefinitionId return _viewDefinitionId; case -2031293866: // versionCorrection return _versionCorrection; case 113591406: // valuationTime return _valuationTime; case 197622906: // allCalculationConfigurationNames return _allCalculationConfigurationNames; case -1677286775: // computationTargetsByCalcConfig return _computationTargetsByCalcConfig; case -351004092: // terminalOutputsByCalcConfig return _terminalOutputsByCalcConfig; case 3373707: // name return _name; } return super.metaPropertyGet(propertyName); } @Override public BeanBuilder<? extends DefaultViewCycleMetadata> builder() { return new DirectBeanBuilder<DefaultViewCycleMetadata>(new DefaultViewCycleMetadata()); } @Override public Class<? extends DefaultViewCycleMetadata> beanType() { return DefaultViewCycleMetadata.class; } @Override public Map<String, MetaProperty<?>> metaPropertyMap() { return _metaPropertyMap$; } //----------------------------------------------------------------------- /** * The meta-property for the {@code viewCycleId} property. * @return the meta-property, not null */ public final MetaProperty<UniqueId> viewCycleId() { return _viewCycleId; } /** * The meta-property for the {@code marketDataSnapshotId} property. * @return the meta-property, not null */ public final MetaProperty<UniqueId> marketDataSnapshotId() { return _marketDataSnapshotId; } /** * The meta-property for the {@code viewDefinitionId} property. * @return the meta-property, not null */ public final MetaProperty<UniqueId> viewDefinitionId() { return _viewDefinitionId; } /** * The meta-property for the {@code versionCorrection} property. * @return the meta-property, not null */ public final MetaProperty<VersionCorrection> versionCorrection() { return _versionCorrection; } /** * The meta-property for the {@code valuationTime} property. * @return the meta-property, not null */ public final MetaProperty<Instant> valuationTime() { return _valuationTime; } /** * The meta-property for the {@code allCalculationConfigurationNames} property. * @return the meta-property, not null */ public final MetaProperty<Collection<String>> allCalculationConfigurationNames() { return _allCalculationConfigurationNames; } /** * The meta-property for the {@code computationTargetsByCalcConfig} property. * @return the meta-property, not null */ public final MetaProperty<Map<String, Collection<ComputationTargetSpecification>>> computationTargetsByCalcConfig() { return _computationTargetsByCalcConfig; } /** * The meta-property for the {@code terminalOutputsByCalcConfig} property. * @return the meta-property, not null */ public final MetaProperty<Map<String, Map<ValueSpecification, Set<ValueRequirement>>>> terminalOutputsByCalcConfig() { return _terminalOutputsByCalcConfig; } /** * The meta-property for the {@code name} property. * @return the meta-property, not null */ public final MetaProperty<String> name() { return _name; } //----------------------------------------------------------------------- @Override protected Object propertyGet(Bean bean, String propertyName, boolean quiet) { switch (propertyName.hashCode()) { case 1217858108: // viewCycleId return ((DefaultViewCycleMetadata) bean).getViewCycleId(); case -41253723: // marketDataSnapshotId return ((DefaultViewCycleMetadata) bean).getMarketDataSnapshotId(); case -545262317: // viewDefinitionId return ((DefaultViewCycleMetadata) bean).getViewDefinitionId(); case -2031293866: // versionCorrection return ((DefaultViewCycleMetadata) bean).getVersionCorrection(); case 113591406: // valuationTime return ((DefaultViewCycleMetadata) bean).getValuationTime(); case 197622906: // allCalculationConfigurationNames return ((DefaultViewCycleMetadata) bean).getAllCalculationConfigurationNames(); case -1677286775: // computationTargetsByCalcConfig return ((DefaultViewCycleMetadata) bean).getComputationTargetsByCalcConfig(); case -351004092: // terminalOutputsByCalcConfig return ((DefaultViewCycleMetadata) bean).getTerminalOutputsByCalcConfig(); case 3373707: // name return ((DefaultViewCycleMetadata) bean).getName(); } return super.propertyGet(bean, propertyName, quiet); } @SuppressWarnings("unchecked") @Override protected void propertySet(Bean bean, String propertyName, Object newValue, boolean quiet) { switch (propertyName.hashCode()) { case 1217858108: // viewCycleId ((DefaultViewCycleMetadata) bean).setViewCycleId((UniqueId) newValue); return; case -41253723: // marketDataSnapshotId ((DefaultViewCycleMetadata) bean).setMarketDataSnapshotId((UniqueId) newValue); return; case -545262317: // viewDefinitionId ((DefaultViewCycleMetadata) bean).setViewDefinitionId((UniqueId) newValue); return; case -2031293866: // versionCorrection ((DefaultViewCycleMetadata) bean).setVersionCorrection((VersionCorrection) newValue); return; case 113591406: // valuationTime ((DefaultViewCycleMetadata) bean).setValuationTime((Instant) newValue); return; case 197622906: // allCalculationConfigurationNames ((DefaultViewCycleMetadata) bean).setAllCalculationConfigurationNames((Collection<String>) newValue); return; case -1677286775: // computationTargetsByCalcConfig ((DefaultViewCycleMetadata) bean).setComputationTargetsByCalcConfig((Map<String, Collection<ComputationTargetSpecification>>) newValue); return; case -351004092: // terminalOutputsByCalcConfig ((DefaultViewCycleMetadata) bean).setTerminalOutputsByCalcConfig((Map<String, Map<ValueSpecification, Set<ValueRequirement>>>) newValue); return; case 3373707: // name ((DefaultViewCycleMetadata) bean).setName((String) newValue); return; } super.propertySet(bean, propertyName, newValue, quiet); } } ///CLOVER:ON //-------------------------- AUTOGENERATED END -------------------------- }