/** * Copyright (C) 2014 - present by OpenGamma Inc. and the OpenGamma group of companies * * Please see distribution for license. */ package com.opengamma.core.legalentity; import java.util.Map; import java.util.Set; 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.DirectMetaBean; import org.joda.beans.impl.direct.DirectMetaProperty; import org.joda.beans.impl.direct.DirectMetaPropertyMap; import com.opengamma.id.ExternalIdBundle; /** * Obligation of a legal entity. */ @BeanDefinition public class Obligation implements Bean { @PropertyDefinition private String _name; @PropertyDefinition private ExternalIdBundle _security; //TODO refactor <ExternalIdBundle> to <SecurityLink> when SecurityLink is ready. //------------------------- AUTOGENERATED START ------------------------- ///CLOVER:OFF /** * The meta-bean for {@code Obligation}. * @return the meta-bean, not null */ public static Obligation.Meta meta() { return Obligation.Meta.INSTANCE; } static { JodaBeanUtils.registerMetaBean(Obligation.Meta.INSTANCE); } @Override public Obligation.Meta metaBean() { return Obligation.Meta.INSTANCE; } @Override public <R> Property<R> property(String propertyName) { return metaBean().<R>metaProperty(propertyName).createProperty(this); } @Override public Set<String> propertyNames() { return metaBean().metaPropertyMap().keySet(); } //----------------------------------------------------------------------- /** * Gets the name. * @return the value of the property */ public String getName() { return _name; } /** * Sets the name. * @param name the new value of the property */ public void setName(String name) { this._name = name; } /** * Gets the the {@code name} property. * @return the property, not null */ public final Property<String> name() { return metaBean().name().createProperty(this); } //----------------------------------------------------------------------- /** * Gets the security. * @return the value of the property */ public ExternalIdBundle getSecurity() { return _security; } /** * Sets the security. * @param security the new value of the property */ public void setSecurity(ExternalIdBundle security) { this._security = security; } /** * Gets the the {@code security} property. * @return the property, not null */ public final Property<ExternalIdBundle> security() { return metaBean().security().createProperty(this); } //----------------------------------------------------------------------- @Override public Obligation clone() { return JodaBeanUtils.cloneAlways(this); } @Override public boolean equals(Object obj) { if (obj == this) { return true; } if (obj != null && obj.getClass() == this.getClass()) { Obligation other = (Obligation) obj; return JodaBeanUtils.equal(getName(), other.getName()) && JodaBeanUtils.equal(getSecurity(), other.getSecurity()); } return false; } @Override public int hashCode() { int hash = getClass().hashCode(); hash = hash * 31 + JodaBeanUtils.hashCode(getName()); hash = hash * 31 + JodaBeanUtils.hashCode(getSecurity()); return hash; } @Override public String toString() { StringBuilder buf = new StringBuilder(96); buf.append("Obligation{"); int len = buf.length(); toString(buf); if (buf.length() > len) { buf.setLength(buf.length() - 2); } buf.append('}'); return buf.toString(); } protected void toString(StringBuilder buf) { buf.append("name").append('=').append(JodaBeanUtils.toString(getName())).append(',').append(' '); buf.append("security").append('=').append(JodaBeanUtils.toString(getSecurity())).append(',').append(' '); } //----------------------------------------------------------------------- /** * The meta-bean for {@code Obligation}. */ public static class Meta extends DirectMetaBean { /** * The singleton instance of the meta-bean. */ static final Meta INSTANCE = new Meta(); /** * The meta-property for the {@code name} property. */ private final MetaProperty<String> _name = DirectMetaProperty.ofReadWrite( this, "name", Obligation.class, String.class); /** * The meta-property for the {@code security} property. */ private final MetaProperty<ExternalIdBundle> _security = DirectMetaProperty.ofReadWrite( this, "security", Obligation.class, ExternalIdBundle.class); /** * The meta-properties. */ private final Map<String, MetaProperty<?>> _metaPropertyMap$ = new DirectMetaPropertyMap( this, null, "name", "security"); /** * Restricted constructor. */ protected Meta() { } @Override protected MetaProperty<?> metaPropertyGet(String propertyName) { switch (propertyName.hashCode()) { case 3373707: // name return _name; case 949122880: // security return _security; } return super.metaPropertyGet(propertyName); } @Override public BeanBuilder<? extends Obligation> builder() { return new DirectBeanBuilder<Obligation>(new Obligation()); } @Override public Class<? extends Obligation> beanType() { return Obligation.class; } @Override public Map<String, MetaProperty<?>> metaPropertyMap() { return _metaPropertyMap$; } //----------------------------------------------------------------------- /** * The meta-property for the {@code name} property. * @return the meta-property, not null */ public final MetaProperty<String> name() { return _name; } /** * The meta-property for the {@code security} property. * @return the meta-property, not null */ public final MetaProperty<ExternalIdBundle> security() { return _security; } //----------------------------------------------------------------------- @Override protected Object propertyGet(Bean bean, String propertyName, boolean quiet) { switch (propertyName.hashCode()) { case 3373707: // name return ((Obligation) bean).getName(); case 949122880: // security return ((Obligation) bean).getSecurity(); } return super.propertyGet(bean, propertyName, quiet); } @Override protected void propertySet(Bean bean, String propertyName, Object newValue, boolean quiet) { switch (propertyName.hashCode()) { case 3373707: // name ((Obligation) bean).setName((String) newValue); return; case 949122880: // security ((Obligation) bean).setSecurity((ExternalIdBundle) newValue); return; } super.propertySet(bean, propertyName, newValue, quiet); } } ///CLOVER:ON //-------------------------- AUTOGENERATED END -------------------------- }