/** * Copyright (C) 2011 - present by OpenGamma Inc. and the OpenGamma group of companies * * Please see distribution for license. */ package com.opengamma.master.convention; import java.util.List; 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.DirectBeanBuilder; import org.joda.beans.impl.direct.DirectMetaProperty; import org.joda.beans.impl.direct.DirectMetaPropertyMap; import com.google.common.collect.Lists; import com.opengamma.core.convention.ConventionType; import com.opengamma.master.AbstractMetaDataResult; import com.opengamma.util.PublicSPI; /** * Result from obtaining meta-data for the convention master. * <p> * Meta-data is only returned if requested. */ @PublicSPI @BeanDefinition public class ConventionMetaDataResult extends AbstractMetaDataResult { /** * The list of valid convention types. * This is only populated if requested. */ @PropertyDefinition private final List<ConventionType> _conventionTypes = Lists.newArrayList(); /** * The database schema version. * This is only populated if requested. */ @PropertyDefinition private String _schemaVersion; /** * Creates an instance. */ public ConventionMetaDataResult() { } //------------------------- AUTOGENERATED START ------------------------- ///CLOVER:OFF /** * The meta-bean for {@code ConventionMetaDataResult}. * @return the meta-bean, not null */ public static ConventionMetaDataResult.Meta meta() { return ConventionMetaDataResult.Meta.INSTANCE; } static { JodaBeanUtils.registerMetaBean(ConventionMetaDataResult.Meta.INSTANCE); } @Override public ConventionMetaDataResult.Meta metaBean() { return ConventionMetaDataResult.Meta.INSTANCE; } //----------------------------------------------------------------------- /** * Gets the list of valid convention types. * This is only populated if requested. * @return the value of the property, not null */ public List<ConventionType> getConventionTypes() { return _conventionTypes; } /** * Sets the list of valid convention types. * This is only populated if requested. * @param conventionTypes the new value of the property, not null */ public void setConventionTypes(List<ConventionType> conventionTypes) { JodaBeanUtils.notNull(conventionTypes, "conventionTypes"); this._conventionTypes.clear(); this._conventionTypes.addAll(conventionTypes); } /** * Gets the the {@code conventionTypes} property. * This is only populated if requested. * @return the property, not null */ public final Property<List<ConventionType>> conventionTypes() { return metaBean().conventionTypes().createProperty(this); } //----------------------------------------------------------------------- /** * Gets the database schema version. * This is only populated if requested. * @return the value of the property */ public String getSchemaVersion() { return _schemaVersion; } /** * Sets the database schema version. * This is only populated if requested. * @param schemaVersion the new value of the property */ public void setSchemaVersion(String schemaVersion) { this._schemaVersion = schemaVersion; } /** * Gets the the {@code schemaVersion} property. * This is only populated if requested. * @return the property, not null */ public final Property<String> schemaVersion() { return metaBean().schemaVersion().createProperty(this); } //----------------------------------------------------------------------- @Override public ConventionMetaDataResult clone() { return JodaBeanUtils.cloneAlways(this); } @Override public boolean equals(Object obj) { if (obj == this) { return true; } if (obj != null && obj.getClass() == this.getClass()) { ConventionMetaDataResult other = (ConventionMetaDataResult) obj; return JodaBeanUtils.equal(getConventionTypes(), other.getConventionTypes()) && JodaBeanUtils.equal(getSchemaVersion(), other.getSchemaVersion()) && super.equals(obj); } return false; } @Override public int hashCode() { int hash = 7; hash = hash * 31 + JodaBeanUtils.hashCode(getConventionTypes()); hash = hash * 31 + JodaBeanUtils.hashCode(getSchemaVersion()); return hash ^ super.hashCode(); } @Override public String toString() { StringBuilder buf = new StringBuilder(96); buf.append("ConventionMetaDataResult{"); 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("conventionTypes").append('=').append(JodaBeanUtils.toString(getConventionTypes())).append(',').append(' '); buf.append("schemaVersion").append('=').append(JodaBeanUtils.toString(getSchemaVersion())).append(',').append(' '); } //----------------------------------------------------------------------- /** * The meta-bean for {@code ConventionMetaDataResult}. */ public static class Meta extends AbstractMetaDataResult.Meta { /** * The singleton instance of the meta-bean. */ static final Meta INSTANCE = new Meta(); /** * The meta-property for the {@code conventionTypes} property. */ @SuppressWarnings({"unchecked", "rawtypes" }) private final MetaProperty<List<ConventionType>> _conventionTypes = DirectMetaProperty.ofReadWrite( this, "conventionTypes", ConventionMetaDataResult.class, (Class) List.class); /** * The meta-property for the {@code schemaVersion} property. */ private final MetaProperty<String> _schemaVersion = DirectMetaProperty.ofReadWrite( this, "schemaVersion", ConventionMetaDataResult.class, String.class); /** * The meta-properties. */ private final Map<String, MetaProperty<?>> _metaPropertyMap$ = new DirectMetaPropertyMap( this, (DirectMetaPropertyMap) super.metaPropertyMap(), "conventionTypes", "schemaVersion"); /** * Restricted constructor. */ protected Meta() { } @Override protected MetaProperty<?> metaPropertyGet(String propertyName) { switch (propertyName.hashCode()) { case -407139448: // conventionTypes return _conventionTypes; case -233564169: // schemaVersion return _schemaVersion; } return super.metaPropertyGet(propertyName); } @Override public BeanBuilder<? extends ConventionMetaDataResult> builder() { return new DirectBeanBuilder<ConventionMetaDataResult>(new ConventionMetaDataResult()); } @Override public Class<? extends ConventionMetaDataResult> beanType() { return ConventionMetaDataResult.class; } @Override public Map<String, MetaProperty<?>> metaPropertyMap() { return _metaPropertyMap$; } //----------------------------------------------------------------------- /** * The meta-property for the {@code conventionTypes} property. * @return the meta-property, not null */ public final MetaProperty<List<ConventionType>> conventionTypes() { return _conventionTypes; } /** * The meta-property for the {@code schemaVersion} property. * @return the meta-property, not null */ public final MetaProperty<String> schemaVersion() { return _schemaVersion; } //----------------------------------------------------------------------- @Override protected Object propertyGet(Bean bean, String propertyName, boolean quiet) { switch (propertyName.hashCode()) { case -407139448: // conventionTypes return ((ConventionMetaDataResult) bean).getConventionTypes(); case -233564169: // schemaVersion return ((ConventionMetaDataResult) bean).getSchemaVersion(); } return super.propertyGet(bean, propertyName, quiet); } @SuppressWarnings("unchecked") @Override protected void propertySet(Bean bean, String propertyName, Object newValue, boolean quiet) { switch (propertyName.hashCode()) { case -407139448: // conventionTypes ((ConventionMetaDataResult) bean).setConventionTypes((List<ConventionType>) newValue); return; case -233564169: // schemaVersion ((ConventionMetaDataResult) bean).setSchemaVersion((String) newValue); return; } super.propertySet(bean, propertyName, newValue, quiet); } @Override protected void validate(Bean bean) { JodaBeanUtils.notNull(((ConventionMetaDataResult) bean)._conventionTypes, "conventionTypes"); super.validate(bean); } } ///CLOVER:ON //-------------------------- AUTOGENERATED END -------------------------- }