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