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