/**
* Copyright (C) 2009 - present by OpenGamma Inc. and the OpenGamma group of companies
*
* Please see distribution for license.
*/
package com.opengamma.masterdb.security.hibernate;
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.DirectBean;
import org.joda.beans.impl.direct.DirectMetaBean;
import org.joda.beans.impl.direct.DirectMetaProperty;
import org.joda.beans.impl.direct.DirectMetaPropertyMap;
/**
* Hibernate bean for a security.
*/
@BeanDefinition
public abstract class SecurityBean extends DirectBean {
/**
* The detail id.
*/
@PropertyDefinition
private Long _id;
/**
* The security id.
*/
@PropertyDefinition
private Long _securityId;
//------------------------- AUTOGENERATED START -------------------------
///CLOVER:OFF
/**
* The meta-bean for {@code SecurityBean}.
* @return the meta-bean, not null
*/
public static SecurityBean.Meta meta() {
return SecurityBean.Meta.INSTANCE;
}
static {
JodaBeanUtils.registerMetaBean(SecurityBean.Meta.INSTANCE);
}
@Override
public SecurityBean.Meta metaBean() {
return SecurityBean.Meta.INSTANCE;
}
//-----------------------------------------------------------------------
/**
* Gets the detail id.
* @return the value of the property
*/
public Long getId() {
return _id;
}
/**
* Sets the detail id.
* @param id the new value of the property
*/
public void setId(Long id) {
this._id = id;
}
/**
* Gets the the {@code id} property.
* @return the property, not null
*/
public final Property<Long> id() {
return metaBean().id().createProperty(this);
}
//-----------------------------------------------------------------------
/**
* Gets the security id.
* @return the value of the property
*/
public Long getSecurityId() {
return _securityId;
}
/**
* Sets the security id.
* @param securityId the new value of the property
*/
public void setSecurityId(Long securityId) {
this._securityId = securityId;
}
/**
* Gets the the {@code securityId} property.
* @return the property, not null
*/
public final Property<Long> securityId() {
return metaBean().securityId().createProperty(this);
}
//-----------------------------------------------------------------------
@Override
public SecurityBean clone() {
return JodaBeanUtils.cloneAlways(this);
}
@Override
public boolean equals(Object obj) {
if (obj == this) {
return true;
}
if (obj != null && obj.getClass() == this.getClass()) {
SecurityBean other = (SecurityBean) obj;
return JodaBeanUtils.equal(getId(), other.getId()) &&
JodaBeanUtils.equal(getSecurityId(), other.getSecurityId());
}
return false;
}
@Override
public int hashCode() {
int hash = getClass().hashCode();
hash = hash * 31 + JodaBeanUtils.hashCode(getId());
hash = hash * 31 + JodaBeanUtils.hashCode(getSecurityId());
return hash;
}
@Override
public String toString() {
StringBuilder buf = new StringBuilder(96);
buf.append("SecurityBean{");
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("id").append('=').append(JodaBeanUtils.toString(getId())).append(',').append(' ');
buf.append("securityId").append('=').append(JodaBeanUtils.toString(getSecurityId())).append(',').append(' ');
}
//-----------------------------------------------------------------------
/**
* The meta-bean for {@code SecurityBean}.
*/
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 id} property.
*/
private final MetaProperty<Long> _id = DirectMetaProperty.ofReadWrite(
this, "id", SecurityBean.class, Long.class);
/**
* The meta-property for the {@code securityId} property.
*/
private final MetaProperty<Long> _securityId = DirectMetaProperty.ofReadWrite(
this, "securityId", SecurityBean.class, Long.class);
/**
* The meta-properties.
*/
private final Map<String, MetaProperty<?>> _metaPropertyMap$ = new DirectMetaPropertyMap(
this, null,
"id",
"securityId");
/**
* Restricted constructor.
*/
protected Meta() {
}
@Override
protected MetaProperty<?> metaPropertyGet(String propertyName) {
switch (propertyName.hashCode()) {
case 3355: // id
return _id;
case 1574023291: // securityId
return _securityId;
}
return super.metaPropertyGet(propertyName);
}
@Override
public BeanBuilder<? extends SecurityBean> builder() {
throw new UnsupportedOperationException("SecurityBean is an abstract class");
}
@Override
public Class<? extends SecurityBean> beanType() {
return SecurityBean.class;
}
@Override
public Map<String, MetaProperty<?>> metaPropertyMap() {
return _metaPropertyMap$;
}
//-----------------------------------------------------------------------
/**
* The meta-property for the {@code id} property.
* @return the meta-property, not null
*/
public final MetaProperty<Long> id() {
return _id;
}
/**
* The meta-property for the {@code securityId} property.
* @return the meta-property, not null
*/
public final MetaProperty<Long> securityId() {
return _securityId;
}
//-----------------------------------------------------------------------
@Override
protected Object propertyGet(Bean bean, String propertyName, boolean quiet) {
switch (propertyName.hashCode()) {
case 3355: // id
return ((SecurityBean) bean).getId();
case 1574023291: // securityId
return ((SecurityBean) bean).getSecurityId();
}
return super.propertyGet(bean, propertyName, quiet);
}
@Override
protected void propertySet(Bean bean, String propertyName, Object newValue, boolean quiet) {
switch (propertyName.hashCode()) {
case 3355: // id
((SecurityBean) bean).setId((Long) newValue);
return;
case 1574023291: // securityId
((SecurityBean) bean).setSecurityId((Long) newValue);
return;
}
super.propertySet(bean, propertyName, newValue, quiet);
}
}
///CLOVER:ON
//-------------------------- AUTOGENERATED END --------------------------
}