/**
* Copyright (C) 2013 - present by OpenGamma Inc. and the OpenGamma group of companies
*
* Please see distribution for license.
*/
package com.opengamma.component.factory.source;
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.component.factory.AbstractComponentFactory;
import com.opengamma.util.redis.RedisConnector;
/**
*
*/
@BeanDefinition
public abstract class AbstractNonVersionedRedisSourceComponentFactory extends AbstractComponentFactory {
/**
* The classifier that the factory should publish under.
*/
@PropertyDefinition(validate = "notNull")
private String _classifier;
/**
* Connector to the underlying Redis instance to use.
*/
@PropertyDefinition(validate = "notNull")
private RedisConnector _redisConnector;
/**
* If set (optional) prefixes all Redis keys with the specified value.
*/
@PropertyDefinition(validate = "notNull")
private String _redisPrefix = "";
/**
* The flag determining whether the component should be published by REST (default true).
*/
@PropertyDefinition
private boolean _publishRest = true;
/**
* If defined create a resolver for this source with the given name
*/
@PropertyDefinition
private String _resolverClassifier;
//------------------------- AUTOGENERATED START -------------------------
///CLOVER:OFF
/**
* The meta-bean for {@code AbstractNonVersionedRedisSourceComponentFactory}.
* @return the meta-bean, not null
*/
public static AbstractNonVersionedRedisSourceComponentFactory.Meta meta() {
return AbstractNonVersionedRedisSourceComponentFactory.Meta.INSTANCE;
}
static {
JodaBeanUtils.registerMetaBean(AbstractNonVersionedRedisSourceComponentFactory.Meta.INSTANCE);
}
@Override
public AbstractNonVersionedRedisSourceComponentFactory.Meta metaBean() {
return AbstractNonVersionedRedisSourceComponentFactory.Meta.INSTANCE;
}
//-----------------------------------------------------------------------
/**
* Gets the classifier that the factory should publish under.
* @return the value of the property, not null
*/
public String getClassifier() {
return _classifier;
}
/**
* Sets the classifier that the factory should publish under.
* @param classifier the new value of the property, not null
*/
public void setClassifier(String classifier) {
JodaBeanUtils.notNull(classifier, "classifier");
this._classifier = classifier;
}
/**
* Gets the the {@code classifier} property.
* @return the property, not null
*/
public final Property<String> classifier() {
return metaBean().classifier().createProperty(this);
}
//-----------------------------------------------------------------------
/**
* Gets connector to the underlying Redis instance to use.
* @return the value of the property, not null
*/
public RedisConnector getRedisConnector() {
return _redisConnector;
}
/**
* Sets connector to the underlying Redis instance to use.
* @param redisConnector the new value of the property, not null
*/
public void setRedisConnector(RedisConnector redisConnector) {
JodaBeanUtils.notNull(redisConnector, "redisConnector");
this._redisConnector = redisConnector;
}
/**
* Gets the the {@code redisConnector} property.
* @return the property, not null
*/
public final Property<RedisConnector> redisConnector() {
return metaBean().redisConnector().createProperty(this);
}
//-----------------------------------------------------------------------
/**
* Gets if set (optional) prefixes all Redis keys with the specified value.
* @return the value of the property, not null
*/
public String getRedisPrefix() {
return _redisPrefix;
}
/**
* Sets if set (optional) prefixes all Redis keys with the specified value.
* @param redisPrefix the new value of the property, not null
*/
public void setRedisPrefix(String redisPrefix) {
JodaBeanUtils.notNull(redisPrefix, "redisPrefix");
this._redisPrefix = redisPrefix;
}
/**
* Gets the the {@code redisPrefix} property.
* @return the property, not null
*/
public final Property<String> redisPrefix() {
return metaBean().redisPrefix().createProperty(this);
}
//-----------------------------------------------------------------------
/**
* Gets the flag determining whether the component should be published by REST (default true).
* @return the value of the property
*/
public boolean isPublishRest() {
return _publishRest;
}
/**
* Sets the flag determining whether the component should be published by REST (default true).
* @param publishRest the new value of the property
*/
public void setPublishRest(boolean publishRest) {
this._publishRest = publishRest;
}
/**
* Gets the the {@code publishRest} property.
* @return the property, not null
*/
public final Property<Boolean> publishRest() {
return metaBean().publishRest().createProperty(this);
}
//-----------------------------------------------------------------------
/**
* Gets if defined create a resolver for this source with the given name
* @return the value of the property
*/
public String getResolverClassifier() {
return _resolverClassifier;
}
/**
* Sets if defined create a resolver for this source with the given name
* @param resolverClassifier the new value of the property
*/
public void setResolverClassifier(String resolverClassifier) {
this._resolverClassifier = resolverClassifier;
}
/**
* Gets the the {@code resolverClassifier} property.
* @return the property, not null
*/
public final Property<String> resolverClassifier() {
return metaBean().resolverClassifier().createProperty(this);
}
//-----------------------------------------------------------------------
@Override
public boolean equals(Object obj) {
if (obj == this) {
return true;
}
if (obj != null && obj.getClass() == this.getClass()) {
AbstractNonVersionedRedisSourceComponentFactory other = (AbstractNonVersionedRedisSourceComponentFactory) obj;
return JodaBeanUtils.equal(getClassifier(), other.getClassifier()) &&
JodaBeanUtils.equal(getRedisConnector(), other.getRedisConnector()) &&
JodaBeanUtils.equal(getRedisPrefix(), other.getRedisPrefix()) &&
(isPublishRest() == other.isPublishRest()) &&
JodaBeanUtils.equal(getResolverClassifier(), other.getResolverClassifier()) &&
super.equals(obj);
}
return false;
}
@Override
public int hashCode() {
int hash = 7;
hash = hash * 31 + JodaBeanUtils.hashCode(getClassifier());
hash = hash * 31 + JodaBeanUtils.hashCode(getRedisConnector());
hash = hash * 31 + JodaBeanUtils.hashCode(getRedisPrefix());
hash = hash * 31 + JodaBeanUtils.hashCode(isPublishRest());
hash = hash * 31 + JodaBeanUtils.hashCode(getResolverClassifier());
return hash ^ super.hashCode();
}
@Override
public String toString() {
StringBuilder buf = new StringBuilder(192);
buf.append("AbstractNonVersionedRedisSourceComponentFactory{");
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("classifier").append('=').append(JodaBeanUtils.toString(getClassifier())).append(',').append(' ');
buf.append("redisConnector").append('=').append(JodaBeanUtils.toString(getRedisConnector())).append(',').append(' ');
buf.append("redisPrefix").append('=').append(JodaBeanUtils.toString(getRedisPrefix())).append(',').append(' ');
buf.append("publishRest").append('=').append(JodaBeanUtils.toString(isPublishRest())).append(',').append(' ');
buf.append("resolverClassifier").append('=').append(JodaBeanUtils.toString(getResolverClassifier())).append(',').append(' ');
}
//-----------------------------------------------------------------------
/**
* The meta-bean for {@code AbstractNonVersionedRedisSourceComponentFactory}.
*/
public static class Meta extends AbstractComponentFactory.Meta {
/**
* The singleton instance of the meta-bean.
*/
static final Meta INSTANCE = new Meta();
/**
* The meta-property for the {@code classifier} property.
*/
private final MetaProperty<String> _classifier = DirectMetaProperty.ofReadWrite(
this, "classifier", AbstractNonVersionedRedisSourceComponentFactory.class, String.class);
/**
* The meta-property for the {@code redisConnector} property.
*/
private final MetaProperty<RedisConnector> _redisConnector = DirectMetaProperty.ofReadWrite(
this, "redisConnector", AbstractNonVersionedRedisSourceComponentFactory.class, RedisConnector.class);
/**
* The meta-property for the {@code redisPrefix} property.
*/
private final MetaProperty<String> _redisPrefix = DirectMetaProperty.ofReadWrite(
this, "redisPrefix", AbstractNonVersionedRedisSourceComponentFactory.class, String.class);
/**
* The meta-property for the {@code publishRest} property.
*/
private final MetaProperty<Boolean> _publishRest = DirectMetaProperty.ofReadWrite(
this, "publishRest", AbstractNonVersionedRedisSourceComponentFactory.class, Boolean.TYPE);
/**
* The meta-property for the {@code resolverClassifier} property.
*/
private final MetaProperty<String> _resolverClassifier = DirectMetaProperty.ofReadWrite(
this, "resolverClassifier", AbstractNonVersionedRedisSourceComponentFactory.class, String.class);
/**
* The meta-properties.
*/
private final Map<String, MetaProperty<?>> _metaPropertyMap$ = new DirectMetaPropertyMap(
this, (DirectMetaPropertyMap) super.metaPropertyMap(),
"classifier",
"redisConnector",
"redisPrefix",
"publishRest",
"resolverClassifier");
/**
* Restricted constructor.
*/
protected Meta() {
}
@Override
protected MetaProperty<?> metaPropertyGet(String propertyName) {
switch (propertyName.hashCode()) {
case -281470431: // classifier
return _classifier;
case -745461486: // redisConnector
return _redisConnector;
case -2024915987: // redisPrefix
return _redisPrefix;
case -614707837: // publishRest
return _publishRest;
case -1651252537: // resolverClassifier
return _resolverClassifier;
}
return super.metaPropertyGet(propertyName);
}
@Override
public BeanBuilder<? extends AbstractNonVersionedRedisSourceComponentFactory> builder() {
throw new UnsupportedOperationException("AbstractNonVersionedRedisSourceComponentFactory is an abstract class");
}
@Override
public Class<? extends AbstractNonVersionedRedisSourceComponentFactory> beanType() {
return AbstractNonVersionedRedisSourceComponentFactory.class;
}
@Override
public Map<String, MetaProperty<?>> metaPropertyMap() {
return _metaPropertyMap$;
}
//-----------------------------------------------------------------------
/**
* The meta-property for the {@code classifier} property.
* @return the meta-property, not null
*/
public final MetaProperty<String> classifier() {
return _classifier;
}
/**
* The meta-property for the {@code redisConnector} property.
* @return the meta-property, not null
*/
public final MetaProperty<RedisConnector> redisConnector() {
return _redisConnector;
}
/**
* The meta-property for the {@code redisPrefix} property.
* @return the meta-property, not null
*/
public final MetaProperty<String> redisPrefix() {
return _redisPrefix;
}
/**
* The meta-property for the {@code publishRest} property.
* @return the meta-property, not null
*/
public final MetaProperty<Boolean> publishRest() {
return _publishRest;
}
/**
* The meta-property for the {@code resolverClassifier} property.
* @return the meta-property, not null
*/
public final MetaProperty<String> resolverClassifier() {
return _resolverClassifier;
}
//-----------------------------------------------------------------------
@Override
protected Object propertyGet(Bean bean, String propertyName, boolean quiet) {
switch (propertyName.hashCode()) {
case -281470431: // classifier
return ((AbstractNonVersionedRedisSourceComponentFactory) bean).getClassifier();
case -745461486: // redisConnector
return ((AbstractNonVersionedRedisSourceComponentFactory) bean).getRedisConnector();
case -2024915987: // redisPrefix
return ((AbstractNonVersionedRedisSourceComponentFactory) bean).getRedisPrefix();
case -614707837: // publishRest
return ((AbstractNonVersionedRedisSourceComponentFactory) bean).isPublishRest();
case -1651252537: // resolverClassifier
return ((AbstractNonVersionedRedisSourceComponentFactory) bean).getResolverClassifier();
}
return super.propertyGet(bean, propertyName, quiet);
}
@Override
protected void propertySet(Bean bean, String propertyName, Object newValue, boolean quiet) {
switch (propertyName.hashCode()) {
case -281470431: // classifier
((AbstractNonVersionedRedisSourceComponentFactory) bean).setClassifier((String) newValue);
return;
case -745461486: // redisConnector
((AbstractNonVersionedRedisSourceComponentFactory) bean).setRedisConnector((RedisConnector) newValue);
return;
case -2024915987: // redisPrefix
((AbstractNonVersionedRedisSourceComponentFactory) bean).setRedisPrefix((String) newValue);
return;
case -614707837: // publishRest
((AbstractNonVersionedRedisSourceComponentFactory) bean).setPublishRest((Boolean) newValue);
return;
case -1651252537: // resolverClassifier
((AbstractNonVersionedRedisSourceComponentFactory) bean).setResolverClassifier((String) newValue);
return;
}
super.propertySet(bean, propertyName, newValue, quiet);
}
@Override
protected void validate(Bean bean) {
JodaBeanUtils.notNull(((AbstractNonVersionedRedisSourceComponentFactory) bean)._classifier, "classifier");
JodaBeanUtils.notNull(((AbstractNonVersionedRedisSourceComponentFactory) bean)._redisConnector, "redisConnector");
JodaBeanUtils.notNull(((AbstractNonVersionedRedisSourceComponentFactory) bean)._redisPrefix, "redisPrefix");
super.validate(bean);
}
}
///CLOVER:ON
//-------------------------- AUTOGENERATED END --------------------------
}