/** * Copyright (C) 2009 - present by OpenGamma Inc. and the OpenGamma group of companies * * Please see distribution for license. */ package com.opengamma.web.function; import java.util.Map; import javax.ws.rs.core.UriInfo; 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.engine.function.config.FunctionConfiguration; import com.opengamma.engine.function.config.FunctionConfigurationSource; import com.opengamma.web.WebPerRequestData; /** * Data class for web-based functions. */ @BeanDefinition public class WebFunctionData extends WebPerRequestData { /** * The function master. */ @PropertyDefinition private FunctionConfigurationSource _functionSource; /** * The function id from the input URI. */ @PropertyDefinition private String _uriFunctionName; /** * The function. */ @PropertyDefinition private FunctionConfiguration _functionConfiguration; /** * Creates an instance. */ public WebFunctionData() { } /** * Creates an instance. * @param uriInfo the URI information */ public WebFunctionData(final UriInfo uriInfo) { setUriInfo(uriInfo); } //------------------------- AUTOGENERATED START ------------------------- ///CLOVER:OFF /** * The meta-bean for {@code WebFunctionData}. * @return the meta-bean, not null */ public static WebFunctionData.Meta meta() { return WebFunctionData.Meta.INSTANCE; } static { JodaBeanUtils.registerMetaBean(WebFunctionData.Meta.INSTANCE); } @Override public WebFunctionData.Meta metaBean() { return WebFunctionData.Meta.INSTANCE; } //----------------------------------------------------------------------- /** * Gets the function master. * @return the value of the property */ public FunctionConfigurationSource getFunctionSource() { return _functionSource; } /** * Sets the function master. * @param functionSource the new value of the property */ public void setFunctionSource(FunctionConfigurationSource functionSource) { this._functionSource = functionSource; } /** * Gets the the {@code functionSource} property. * @return the property, not null */ public final Property<FunctionConfigurationSource> functionSource() { return metaBean().functionSource().createProperty(this); } //----------------------------------------------------------------------- /** * Gets the function id from the input URI. * @return the value of the property */ public String getUriFunctionName() { return _uriFunctionName; } /** * Sets the function id from the input URI. * @param uriFunctionName the new value of the property */ public void setUriFunctionName(String uriFunctionName) { this._uriFunctionName = uriFunctionName; } /** * Gets the the {@code uriFunctionName} property. * @return the property, not null */ public final Property<String> uriFunctionName() { return metaBean().uriFunctionName().createProperty(this); } //----------------------------------------------------------------------- /** * Gets the function. * @return the value of the property */ public FunctionConfiguration getFunctionConfiguration() { return _functionConfiguration; } /** * Sets the function. * @param functionConfiguration the new value of the property */ public void setFunctionConfiguration(FunctionConfiguration functionConfiguration) { this._functionConfiguration = functionConfiguration; } /** * Gets the the {@code functionConfiguration} property. * @return the property, not null */ public final Property<FunctionConfiguration> functionConfiguration() { return metaBean().functionConfiguration().createProperty(this); } //----------------------------------------------------------------------- @Override public WebFunctionData clone() { return JodaBeanUtils.cloneAlways(this); } @Override public boolean equals(Object obj) { if (obj == this) { return true; } if (obj != null && obj.getClass() == this.getClass()) { WebFunctionData other = (WebFunctionData) obj; return JodaBeanUtils.equal(getFunctionSource(), other.getFunctionSource()) && JodaBeanUtils.equal(getUriFunctionName(), other.getUriFunctionName()) && JodaBeanUtils.equal(getFunctionConfiguration(), other.getFunctionConfiguration()) && super.equals(obj); } return false; } @Override public int hashCode() { int hash = 7; hash = hash * 31 + JodaBeanUtils.hashCode(getFunctionSource()); hash = hash * 31 + JodaBeanUtils.hashCode(getUriFunctionName()); hash = hash * 31 + JodaBeanUtils.hashCode(getFunctionConfiguration()); return hash ^ super.hashCode(); } @Override public String toString() { StringBuilder buf = new StringBuilder(128); buf.append("WebFunctionData{"); 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("functionSource").append('=').append(JodaBeanUtils.toString(getFunctionSource())).append(',').append(' '); buf.append("uriFunctionName").append('=').append(JodaBeanUtils.toString(getUriFunctionName())).append(',').append(' '); buf.append("functionConfiguration").append('=').append(JodaBeanUtils.toString(getFunctionConfiguration())).append(',').append(' '); } //----------------------------------------------------------------------- /** * The meta-bean for {@code WebFunctionData}. */ public static class Meta extends WebPerRequestData.Meta { /** * The singleton instance of the meta-bean. */ static final Meta INSTANCE = new Meta(); /** * The meta-property for the {@code functionSource} property. */ private final MetaProperty<FunctionConfigurationSource> _functionSource = DirectMetaProperty.ofReadWrite( this, "functionSource", WebFunctionData.class, FunctionConfigurationSource.class); /** * The meta-property for the {@code uriFunctionName} property. */ private final MetaProperty<String> _uriFunctionName = DirectMetaProperty.ofReadWrite( this, "uriFunctionName", WebFunctionData.class, String.class); /** * The meta-property for the {@code functionConfiguration} property. */ private final MetaProperty<FunctionConfiguration> _functionConfiguration = DirectMetaProperty.ofReadWrite( this, "functionConfiguration", WebFunctionData.class, FunctionConfiguration.class); /** * The meta-properties. */ private final Map<String, MetaProperty<?>> _metaPropertyMap$ = new DirectMetaPropertyMap( this, (DirectMetaPropertyMap) super.metaPropertyMap(), "functionSource", "uriFunctionName", "functionConfiguration"); /** * Restricted constructor. */ protected Meta() { } @Override protected MetaProperty<?> metaPropertyGet(String propertyName) { switch (propertyName.hashCode()) { case -1109096941: // functionSource return _functionSource; case 1996164623: // uriFunctionName return _uriFunctionName; case -40357890: // functionConfiguration return _functionConfiguration; } return super.metaPropertyGet(propertyName); } @Override public BeanBuilder<? extends WebFunctionData> builder() { return new DirectBeanBuilder<WebFunctionData>(new WebFunctionData()); } @Override public Class<? extends WebFunctionData> beanType() { return WebFunctionData.class; } @Override public Map<String, MetaProperty<?>> metaPropertyMap() { return _metaPropertyMap$; } //----------------------------------------------------------------------- /** * The meta-property for the {@code functionSource} property. * @return the meta-property, not null */ public final MetaProperty<FunctionConfigurationSource> functionSource() { return _functionSource; } /** * The meta-property for the {@code uriFunctionName} property. * @return the meta-property, not null */ public final MetaProperty<String> uriFunctionName() { return _uriFunctionName; } /** * The meta-property for the {@code functionConfiguration} property. * @return the meta-property, not null */ public final MetaProperty<FunctionConfiguration> functionConfiguration() { return _functionConfiguration; } //----------------------------------------------------------------------- @Override protected Object propertyGet(Bean bean, String propertyName, boolean quiet) { switch (propertyName.hashCode()) { case -1109096941: // functionSource return ((WebFunctionData) bean).getFunctionSource(); case 1996164623: // uriFunctionName return ((WebFunctionData) bean).getUriFunctionName(); case -40357890: // functionConfiguration return ((WebFunctionData) bean).getFunctionConfiguration(); } return super.propertyGet(bean, propertyName, quiet); } @Override protected void propertySet(Bean bean, String propertyName, Object newValue, boolean quiet) { switch (propertyName.hashCode()) { case -1109096941: // functionSource ((WebFunctionData) bean).setFunctionSource((FunctionConfigurationSource) newValue); return; case 1996164623: // uriFunctionName ((WebFunctionData) bean).setUriFunctionName((String) newValue); return; case -40357890: // functionConfiguration ((WebFunctionData) bean).setFunctionConfiguration((FunctionConfiguration) newValue); return; } super.propertySet(bean, propertyName, newValue, quiet); } } ///CLOVER:ON //-------------------------- AUTOGENERATED END -------------------------- }