/**
* 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.core.obligor.CreditRating;
/**
* Legal Entity Rating
*/
@BeanDefinition
public class Rating implements Bean {
@PropertyDefinition
private String _rater;
@PropertyDefinition
private CreditRating _score;
@PropertyDefinition
private SeniorityLevel _seniorityLevel;
public Rating() {
}
public Rating(String rater, CreditRating score, SeniorityLevel seniorityLevel) {
_rater = rater;
_score = score;
_seniorityLevel = seniorityLevel;
}
//------------------------- AUTOGENERATED START -------------------------
///CLOVER:OFF
/**
* The meta-bean for {@code Rating}.
* @return the meta-bean, not null
*/
public static Rating.Meta meta() {
return Rating.Meta.INSTANCE;
}
static {
JodaBeanUtils.registerMetaBean(Rating.Meta.INSTANCE);
}
@Override
public Rating.Meta metaBean() {
return Rating.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 rater.
* @return the value of the property
*/
public String getRater() {
return _rater;
}
/**
* Sets the rater.
* @param rater the new value of the property
*/
public void setRater(String rater) {
this._rater = rater;
}
/**
* Gets the the {@code rater} property.
* @return the property, not null
*/
public final Property<String> rater() {
return metaBean().rater().createProperty(this);
}
//-----------------------------------------------------------------------
/**
* Gets the score.
* @return the value of the property
*/
public CreditRating getScore() {
return _score;
}
/**
* Sets the score.
* @param score the new value of the property
*/
public void setScore(CreditRating score) {
this._score = score;
}
/**
* Gets the the {@code score} property.
* @return the property, not null
*/
public final Property<CreditRating> score() {
return metaBean().score().createProperty(this);
}
//-----------------------------------------------------------------------
/**
* Gets the seniorityLevel.
* @return the value of the property
*/
public SeniorityLevel getSeniorityLevel() {
return _seniorityLevel;
}
/**
* Sets the seniorityLevel.
* @param seniorityLevel the new value of the property
*/
public void setSeniorityLevel(SeniorityLevel seniorityLevel) {
this._seniorityLevel = seniorityLevel;
}
/**
* Gets the the {@code seniorityLevel} property.
* @return the property, not null
*/
public final Property<SeniorityLevel> seniorityLevel() {
return metaBean().seniorityLevel().createProperty(this);
}
//-----------------------------------------------------------------------
@Override
public Rating clone() {
return JodaBeanUtils.cloneAlways(this);
}
@Override
public boolean equals(Object obj) {
if (obj == this) {
return true;
}
if (obj != null && obj.getClass() == this.getClass()) {
Rating other = (Rating) obj;
return JodaBeanUtils.equal(getRater(), other.getRater()) &&
JodaBeanUtils.equal(getScore(), other.getScore()) &&
JodaBeanUtils.equal(getSeniorityLevel(), other.getSeniorityLevel());
}
return false;
}
@Override
public int hashCode() {
int hash = getClass().hashCode();
hash = hash * 31 + JodaBeanUtils.hashCode(getRater());
hash = hash * 31 + JodaBeanUtils.hashCode(getScore());
hash = hash * 31 + JodaBeanUtils.hashCode(getSeniorityLevel());
return hash;
}
@Override
public String toString() {
StringBuilder buf = new StringBuilder(128);
buf.append("Rating{");
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("rater").append('=').append(JodaBeanUtils.toString(getRater())).append(',').append(' ');
buf.append("score").append('=').append(JodaBeanUtils.toString(getScore())).append(',').append(' ');
buf.append("seniorityLevel").append('=').append(JodaBeanUtils.toString(getSeniorityLevel())).append(',').append(' ');
}
//-----------------------------------------------------------------------
/**
* The meta-bean for {@code Rating}.
*/
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 rater} property.
*/
private final MetaProperty<String> _rater = DirectMetaProperty.ofReadWrite(
this, "rater", Rating.class, String.class);
/**
* The meta-property for the {@code score} property.
*/
private final MetaProperty<CreditRating> _score = DirectMetaProperty.ofReadWrite(
this, "score", Rating.class, CreditRating.class);
/**
* The meta-property for the {@code seniorityLevel} property.
*/
private final MetaProperty<SeniorityLevel> _seniorityLevel = DirectMetaProperty.ofReadWrite(
this, "seniorityLevel", Rating.class, SeniorityLevel.class);
/**
* The meta-properties.
*/
private final Map<String, MetaProperty<?>> _metaPropertyMap$ = new DirectMetaPropertyMap(
this, null,
"rater",
"score",
"seniorityLevel");
/**
* Restricted constructor.
*/
protected Meta() {
}
@Override
protected MetaProperty<?> metaPropertyGet(String propertyName) {
switch (propertyName.hashCode()) {
case 108285842: // rater
return _rater;
case 109264530: // score
return _score;
case 1229868454: // seniorityLevel
return _seniorityLevel;
}
return super.metaPropertyGet(propertyName);
}
@Override
public BeanBuilder<? extends Rating> builder() {
return new DirectBeanBuilder<Rating>(new Rating());
}
@Override
public Class<? extends Rating> beanType() {
return Rating.class;
}
@Override
public Map<String, MetaProperty<?>> metaPropertyMap() {
return _metaPropertyMap$;
}
//-----------------------------------------------------------------------
/**
* The meta-property for the {@code rater} property.
* @return the meta-property, not null
*/
public final MetaProperty<String> rater() {
return _rater;
}
/**
* The meta-property for the {@code score} property.
* @return the meta-property, not null
*/
public final MetaProperty<CreditRating> score() {
return _score;
}
/**
* The meta-property for the {@code seniorityLevel} property.
* @return the meta-property, not null
*/
public final MetaProperty<SeniorityLevel> seniorityLevel() {
return _seniorityLevel;
}
//-----------------------------------------------------------------------
@Override
protected Object propertyGet(Bean bean, String propertyName, boolean quiet) {
switch (propertyName.hashCode()) {
case 108285842: // rater
return ((Rating) bean).getRater();
case 109264530: // score
return ((Rating) bean).getScore();
case 1229868454: // seniorityLevel
return ((Rating) bean).getSeniorityLevel();
}
return super.propertyGet(bean, propertyName, quiet);
}
@Override
protected void propertySet(Bean bean, String propertyName, Object newValue, boolean quiet) {
switch (propertyName.hashCode()) {
case 108285842: // rater
((Rating) bean).setRater((String) newValue);
return;
case 109264530: // score
((Rating) bean).setScore((CreditRating) newValue);
return;
case 1229868454: // seniorityLevel
((Rating) bean).setSeniorityLevel((SeniorityLevel) newValue);
return;
}
super.propertySet(bean, propertyName, newValue, quiet);
}
}
///CLOVER:ON
//-------------------------- AUTOGENERATED END --------------------------
}