Package com.opengamma.examples.bloomberg.component

Source Code of com.opengamma.examples.bloomberg.component.ExampleSecurityLoaderComponentFactory$Meta

/**
* Copyright (C) 2009 - present by OpenGamma Inc. and the OpenGamma group of companies
*
* Please see distribution for license.
*/
package com.opengamma.examples.bloomberg.component;

import java.util.LinkedHashMap;
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.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.component.ComponentInfo;
import com.opengamma.component.ComponentRepository;
import com.opengamma.component.factory.AbstractComponentFactory;
import com.opengamma.financial.security.DefaultSecurityLoader;
import com.opengamma.master.security.SecurityLoader;
import com.opengamma.master.security.SecurityMaster;
import com.opengamma.provider.security.SecurityProvider;

/**
* Component factory that instantiates the security loader.
*/
@BeanDefinition
public class ExampleSecurityLoaderComponentFactory extends AbstractComponentFactory {

  /**
   * The configuration URI.
   */
  @PropertyDefinition(validate = "notNull")
  private String _classifier;

  /**
   * The security provider.
   */
  @PropertyDefinition(validate = "notNull")
  private SecurityProvider _securityProvider;
  /**
   * The security master.
   */
  @PropertyDefinition
  private SecurityMaster _securityMaster;

  //-------------------------------------------------------------------------
  @Override
  public void init(ComponentRepository repo, LinkedHashMap<String, String> configuration) throws Exception {
    SecurityLoader securityLoader = new DefaultSecurityLoader(getSecurityMaster(), getSecurityProvider());
   
    ComponentInfo info = new ComponentInfo(SecurityLoader.class, getClassifier());
    repo.registerComponent(info, securityLoader);
  }

  //------------------------- AUTOGENERATED START -------------------------
  ///CLOVER:OFF
  /**
   * The meta-bean for {@code ExampleSecurityLoaderComponentFactory}.
   * @return the meta-bean, not null
   */
  public static ExampleSecurityLoaderComponentFactory.Meta meta() {
    return ExampleSecurityLoaderComponentFactory.Meta.INSTANCE;
  }

  static {
    JodaBeanUtils.registerMetaBean(ExampleSecurityLoaderComponentFactory.Meta.INSTANCE);
  }

  @Override
  public ExampleSecurityLoaderComponentFactory.Meta metaBean() {
    return ExampleSecurityLoaderComponentFactory.Meta.INSTANCE;
  }

  @Override
  protected Object propertyGet(String propertyName, boolean quiet) {
    switch (propertyName.hashCode()) {
      case -281470431// classifier
        return getClassifier();
      case 809869649// securityProvider
        return getSecurityProvider();
      case -887218750// securityMaster
        return getSecurityMaster();
    }
    return super.propertyGet(propertyName, quiet);
  }

  @Override
  protected void propertySet(String propertyName, Object newValue, boolean quiet) {
    switch (propertyName.hashCode()) {
      case -281470431// classifier
        setClassifier((String) newValue);
        return;
      case 809869649// securityProvider
        setSecurityProvider((SecurityProvider) newValue);
        return;
      case -887218750// securityMaster
        setSecurityMaster((SecurityMaster) newValue);
        return;
    }
    super.propertySet(propertyName, newValue, quiet);
  }

  @Override
  protected void validate() {
    JodaBeanUtils.notNull(_classifier, "classifier");
    JodaBeanUtils.notNull(_securityProvider, "securityProvider");
    super.validate();
  }

  @Override
  public boolean equals(Object obj) {
    if (obj == this) {
      return true;
    }
    if (obj != null && obj.getClass() == this.getClass()) {
      ExampleSecurityLoaderComponentFactory other = (ExampleSecurityLoaderComponentFactory) obj;
      return JodaBeanUtils.equal(getClassifier(), other.getClassifier()) &&
          JodaBeanUtils.equal(getSecurityProvider(), other.getSecurityProvider()) &&
          JodaBeanUtils.equal(getSecurityMaster(), other.getSecurityMaster()) &&
          super.equals(obj);
    }
    return false;
  }

  @Override
  public int hashCode() {
    int hash = 7;
    hash += hash * 31 + JodaBeanUtils.hashCode(getClassifier());
    hash += hash * 31 + JodaBeanUtils.hashCode(getSecurityProvider());
    hash += hash * 31 + JodaBeanUtils.hashCode(getSecurityMaster());
    return hash ^ super.hashCode();
  }

  //-----------------------------------------------------------------------
  /**
   * Gets the configuration URI.
   * @return the value of the property, not null
   */
  public String getClassifier() {
    return _classifier;
  }

  /**
   * Sets the configuration URI.
   * @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 the security provider.
   * @return the value of the property, not null
   */
  public SecurityProvider getSecurityProvider() {
    return _securityProvider;
  }

  /**
   * Sets the security provider.
   * @param securityProvider  the new value of the property, not null
   */
  public void setSecurityProvider(SecurityProvider securityProvider) {
    JodaBeanUtils.notNull(securityProvider, "securityProvider");
    this._securityProvider = securityProvider;
  }

  /**
   * Gets the the {@code securityProvider} property.
   * @return the property, not null
   */
  public final Property<SecurityProvider> securityProvider() {
    return metaBean().securityProvider().createProperty(this);
  }

  //-----------------------------------------------------------------------
  /**
   * Gets the security master.
   * @return the value of the property
   */
  public SecurityMaster getSecurityMaster() {
    return _securityMaster;
  }

  /**
   * Sets the security master.
   * @param securityMaster  the new value of the property
   */
  public void setSecurityMaster(SecurityMaster securityMaster) {
    this._securityMaster = securityMaster;
  }

  /**
   * Gets the the {@code securityMaster} property.
   * @return the property, not null
   */
  public final Property<SecurityMaster> securityMaster() {
    return metaBean().securityMaster().createProperty(this);
  }

  //-----------------------------------------------------------------------
  /**
   * The meta-bean for {@code ExampleSecurityLoaderComponentFactory}.
   */
  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", ExampleSecurityLoaderComponentFactory.class, String.class);
    /**
     * The meta-property for the {@code securityProvider} property.
     */
    private final MetaProperty<SecurityProvider> _securityProvider = DirectMetaProperty.ofReadWrite(
        this, "securityProvider", ExampleSecurityLoaderComponentFactory.class, SecurityProvider.class);
    /**
     * The meta-property for the {@code securityMaster} property.
     */
    private final MetaProperty<SecurityMaster> _securityMaster = DirectMetaProperty.ofReadWrite(
        this, "securityMaster", ExampleSecurityLoaderComponentFactory.class, SecurityMaster.class);
    /**
     * The meta-properties.
     */
    private final Map<String, MetaProperty<?>> _metaPropertyMap$ = new DirectMetaPropertyMap(
        this, (DirectMetaPropertyMap) super.metaPropertyMap(),
        "classifier",
        "securityProvider",
        "securityMaster");

    /**
     * Restricted constructor.
     */
    protected Meta() {
    }

    @Override
    protected MetaProperty<?> metaPropertyGet(String propertyName) {
      switch (propertyName.hashCode()) {
        case -281470431// classifier
          return _classifier;
        case 809869649// securityProvider
          return _securityProvider;
        case -887218750// securityMaster
          return _securityMaster;
      }
      return super.metaPropertyGet(propertyName);
    }

    @Override
    public BeanBuilder<? extends ExampleSecurityLoaderComponentFactory> builder() {
      return new DirectBeanBuilder<ExampleSecurityLoaderComponentFactory>(new ExampleSecurityLoaderComponentFactory());
    }

    @Override
    public Class<? extends ExampleSecurityLoaderComponentFactory> beanType() {
      return ExampleSecurityLoaderComponentFactory.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 securityProvider} property.
     * @return the meta-property, not null
     */
    public final MetaProperty<SecurityProvider> securityProvider() {
      return _securityProvider;
    }

    /**
     * The meta-property for the {@code securityMaster} property.
     * @return the meta-property, not null
     */
    public final MetaProperty<SecurityMaster> securityMaster() {
      return _securityMaster;
    }

  }

  ///CLOVER:ON
  //-------------------------- AUTOGENERATED END --------------------------
}
TOP

Related Classes of com.opengamma.examples.bloomberg.component.ExampleSecurityLoaderComponentFactory$Meta

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.