/** * Copyright (C) 2012 - present by OpenGamma Inc. and the OpenGamma group of companies * * Please see distribution for license. */ package com.opengamma.master.cache; 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.id.UniqueId; import com.opengamma.id.UniqueIdentifiable; import com.opengamma.master.AbstractDocument; @BeanDefinition class CacheTestDocument extends AbstractDocument { @PropertyDefinition private UniqueId _uniqueId; CacheTestDocument() { } CacheTestDocument(UniqueId uniqueId) { _uniqueId = uniqueId; } @Override public UniqueIdentifiable getValue() { return _uniqueId; } //------------------------- AUTOGENERATED START ------------------------- ///CLOVER:OFF /** * The meta-bean for {@code CacheTestDocument}. * @return the meta-bean, not null */ public static CacheTestDocument.Meta meta() { return CacheTestDocument.Meta.INSTANCE; } static { JodaBeanUtils.registerMetaBean(CacheTestDocument.Meta.INSTANCE); } @Override public CacheTestDocument.Meta metaBean() { return CacheTestDocument.Meta.INSTANCE; } //----------------------------------------------------------------------- /** * Gets the uniqueId. * @return the value of the property */ public UniqueId getUniqueId() { return _uniqueId; } /** * Sets the uniqueId. * @param uniqueId the new value of the property */ public void setUniqueId(UniqueId uniqueId) { this._uniqueId = uniqueId; } /** * Gets the the {@code uniqueId} property. * @return the property, not null */ public final Property<UniqueId> uniqueId() { return metaBean().uniqueId().createProperty(this); } //----------------------------------------------------------------------- @Override public CacheTestDocument clone() { return JodaBeanUtils.cloneAlways(this); } @Override public boolean equals(Object obj) { if (obj == this) { return true; } if (obj != null && obj.getClass() == this.getClass()) { CacheTestDocument other = (CacheTestDocument) obj; return JodaBeanUtils.equal(getUniqueId(), other.getUniqueId()) && super.equals(obj); } return false; } @Override public int hashCode() { int hash = 7; hash = hash * 31 + JodaBeanUtils.hashCode(getUniqueId()); return hash ^ super.hashCode(); } @Override public String toString() { StringBuilder buf = new StringBuilder(64); buf.append("CacheTestDocument{"); 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("uniqueId").append('=').append(JodaBeanUtils.toString(getUniqueId())).append(',').append(' '); } //----------------------------------------------------------------------- /** * The meta-bean for {@code CacheTestDocument}. */ public static class Meta extends AbstractDocument.Meta { /** * The singleton instance of the meta-bean. */ static final Meta INSTANCE = new Meta(); /** * The meta-property for the {@code uniqueId} property. */ private final MetaProperty<UniqueId> _uniqueId = DirectMetaProperty.ofReadWrite( this, "uniqueId", CacheTestDocument.class, UniqueId.class); /** * The meta-properties. */ private final Map<String, MetaProperty<?>> _metaPropertyMap$ = new DirectMetaPropertyMap( this, (DirectMetaPropertyMap) super.metaPropertyMap(), "uniqueId"); /** * Restricted constructor. */ protected Meta() { } @Override protected MetaProperty<?> metaPropertyGet(String propertyName) { switch (propertyName.hashCode()) { case -294460212: // uniqueId return _uniqueId; } return super.metaPropertyGet(propertyName); } @Override public BeanBuilder<? extends CacheTestDocument> builder() { return new DirectBeanBuilder<CacheTestDocument>(new CacheTestDocument()); } @Override public Class<? extends CacheTestDocument> beanType() { return CacheTestDocument.class; } @Override public Map<String, MetaProperty<?>> metaPropertyMap() { return _metaPropertyMap$; } //----------------------------------------------------------------------- /** * The meta-property for the {@code uniqueId} property. * @return the meta-property, not null */ public final MetaProperty<UniqueId> uniqueId() { return _uniqueId; } //----------------------------------------------------------------------- @Override protected Object propertyGet(Bean bean, String propertyName, boolean quiet) { switch (propertyName.hashCode()) { case -294460212: // uniqueId return ((CacheTestDocument) bean).getUniqueId(); } return super.propertyGet(bean, propertyName, quiet); } @Override protected void propertySet(Bean bean, String propertyName, Object newValue, boolean quiet) { switch (propertyName.hashCode()) { case -294460212: // uniqueId ((CacheTestDocument) bean).setUniqueId((UniqueId) newValue); return; } super.propertySet(bean, propertyName, newValue, quiet); } } ///CLOVER:ON //-------------------------- AUTOGENERATED END -------------------------- }