/** * Copyright (C) 2009 - present by OpenGamma Inc. and the OpenGamma group of companies * * Please see distribution for license. */ package com.opengamma.financial.security; import java.util.Map; import org.joda.beans.BeanBuilder; import org.joda.beans.BeanDefinition; import org.joda.beans.JodaBeanUtils; import org.joda.beans.MetaProperty; import org.joda.beans.impl.direct.DirectMetaPropertyMap; import com.opengamma.id.ExternalIdBundle; import com.opengamma.id.UniqueId; import com.opengamma.master.security.ManageableSecurity; import com.opengamma.master.security.RawSecurity; import com.opengamma.util.PublicSPI; /** * An abstract base class for all securities defined within the financial package. * <p> * These securities work with the functions also defined in this project. * Applications can choose to use these {@code FinancialSecurity} classes, * extend {@link ManageableSecurity} directly or use {@link RawSecurity}. */ @PublicSPI @BeanDefinition public abstract class FinancialSecurity extends ManageableSecurity { /** Serialization version. */ private static final long serialVersionUID = 1L; /** * Creates an instance with a security type. * * @param securityType the security type, not null */ protected FinancialSecurity(String securityType) { super(securityType); } /** * Creates a fully populated instance. * * @param uniqueId the security unique identifier, may be null * @param name the display name, not null * @param securityType the security type, not null * @param bundle the security external identifier bundle, not null */ protected FinancialSecurity(UniqueId uniqueId, String name, String securityType, ExternalIdBundle bundle) { super(uniqueId, name, securityType, bundle); } //------------------------------------------------------------------------- /** * Accepts a visitor to manage traversal of the hierarchy. * * @param <T> the result type of the visitor * @param visitor the visitor, not null * @return the result */ public abstract <T> T accept(FinancialSecurityVisitor<T> visitor); //------------------------- AUTOGENERATED START ------------------------- ///CLOVER:OFF /** * The meta-bean for {@code FinancialSecurity}. * @return the meta-bean, not null */ public static FinancialSecurity.Meta meta() { return FinancialSecurity.Meta.INSTANCE; } static { JodaBeanUtils.registerMetaBean(FinancialSecurity.Meta.INSTANCE); } @Override public FinancialSecurity.Meta metaBean() { return FinancialSecurity.Meta.INSTANCE; } //----------------------------------------------------------------------- @Override public boolean equals(Object obj) { if (obj == this) { return true; } if (obj != null && obj.getClass() == this.getClass()) { return super.equals(obj); } return false; } @Override public int hashCode() { int hash = 7; return hash ^ super.hashCode(); } @Override public String toString() { StringBuilder buf = new StringBuilder(32); buf.append("FinancialSecurity{"); 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); } //----------------------------------------------------------------------- /** * The meta-bean for {@code FinancialSecurity}. */ public static class Meta extends ManageableSecurity.Meta { /** * The singleton instance of the meta-bean. */ static final Meta INSTANCE = new Meta(); /** * The meta-properties. */ private final Map<String, MetaProperty<?>> _metaPropertyMap$ = new DirectMetaPropertyMap( this, (DirectMetaPropertyMap) super.metaPropertyMap()); /** * Restricted constructor. */ protected Meta() { } @Override public BeanBuilder<? extends FinancialSecurity> builder() { throw new UnsupportedOperationException("FinancialSecurity is an abstract class"); } @Override public Class<? extends FinancialSecurity> beanType() { return FinancialSecurity.class; } @Override public Map<String, MetaProperty<?>> metaPropertyMap() { return _metaPropertyMap$; } //----------------------------------------------------------------------- } ///CLOVER:ON //-------------------------- AUTOGENERATED END -------------------------- }