
nz.co.senanque.pizzaorder.Bread Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of madura-rules Show documentation
Show all versions of madura-rules Show documentation
This is a plugin to Madura Objects. It provides a rules/constraint engine to assist with validation,
deriving new values from user inputs (eg total of invoices entered on this customer) an manipulating metadata
(eg because the amount is above X we make some field readonly). Note that the Java that is using the
monitored objects is quite unaware of the rules layer implemented here. That means you can change rules
without having to go back to your Java code, and it also means you don't have to wonder if everything
implemented the same rules. Anything using that Java object has the rules (unless you turn them all off).
//
// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.4
// See http://java.sun.com/xml/jaxb
// Any modifications to this file will be lost upon recompilation of the source schema.
// Generated on: 2016.03.24 at 09:48:53 PM NZDT
//
package nz.co.senanque.pizzaorder;
import java.io.Serializable;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Table;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlTransient;
import javax.xml.bind.annotation.XmlType;
import nz.co.senanque.validationengine.ValidationObject;
import nz.co.senanque.validationengine.annotations.ChoiceList;
import nz.co.senanque.validationengine.annotations.Label;
import nz.co.senanque.validationengine.annotations.Length;
import org.jvnet.jaxb2_commons.lang.Equals;
import org.jvnet.jaxb2_commons.lang.EqualsStrategy;
import org.jvnet.jaxb2_commons.lang.HashCode;
import org.jvnet.jaxb2_commons.lang.HashCodeStrategy;
import org.jvnet.jaxb2_commons.lang.JAXBEqualsStrategy;
import org.jvnet.jaxb2_commons.lang.JAXBHashCodeStrategy;
import org.jvnet.jaxb2_commons.lang.JAXBToStringStrategy;
import org.jvnet.jaxb2_commons.lang.ToString;
import org.jvnet.jaxb2_commons.lang.ToStringStrategy;
import org.jvnet.jaxb2_commons.locator.ObjectLocator;
import org.jvnet.jaxb2_commons.locator.util.LocatorUtils;
/**
* Java class for Bread complex type.
*
*
The following schema fragment specifies the expected content contained within this class.
*
*
* <complexType name="Bread">
* <complexContent>
* <extension base="{http://www.senanque.co.nz/pizzaorder}OrderItem">
* <sequence>
* <element name="grain">
* <simpleType>
* <restriction base="{http://www.w3.org/2001/XMLSchema}string">
* <maxLength value="20"/>
* </restriction>
* </simpleType>
* </element>
* </sequence>
* </extension>
* </complexContent>
* </complexType>
*
*
*
*/
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(name = "Bread", propOrder = {
"grain"
})
@Entity(name = "Bread")
@Table(name = "BREAD")
public class Bread
extends OrderItem
implements Serializable, ValidationObject, Equals, HashCode, ToString
{
@XmlElement(required = true)
protected String grain;
@XmlTransient
public final static String GRAIN = "grain";
/**
* Gets the value of the grain property.
*
* @return
* possible object is
* {@link String }
*
*/
@Label(labelName = "Grain")
@ChoiceList(name = "Grains")
@Basic
@Column(name = "GRAIN", length = 20)
@Length(minLength = "0", maxLength = "20")
public String getGrain() {
if (m_validationSession!= null) {
m_validationSession.clean(this);
}
return grain;
}
/**
* Sets the value of the grain property.
*
* @param value
* allowed object is
* {@link String }
*
*/
public void setGrain(String value) {
getMetadata().removeUnknown("grain");
if (m_validationSession!= null) {
m_validationSession.set(this, "grain", value, grain);
}
this.grain = value;
if (m_validationSession!= null) {
m_validationSession.invokeListeners(this, "grain", value, grain);
}
}
public boolean equals(ObjectLocator thisLocator, ObjectLocator thatLocator, Object object, EqualsStrategy strategy) {
if (!(object instanceof Bread)) {
return false;
}
if (this == object) {
return true;
}
if (!super.equals(thisLocator, thatLocator, object, strategy)) {
return false;
}
final Bread that = ((Bread) object);
{
String lhsGrain;
lhsGrain = this.getGrain();
String rhsGrain;
rhsGrain = that.getGrain();
if (!strategy.equals(LocatorUtils.property(thisLocator, "grain", lhsGrain), LocatorUtils.property(thatLocator, "grain", rhsGrain), lhsGrain, rhsGrain)) {
return false;
}
}
return true;
}
public boolean equals(Object object) {
final EqualsStrategy strategy = JAXBEqualsStrategy.INSTANCE;
return equals(null, null, object, strategy);
}
public String toString() {
final ToStringStrategy strategy = JAXBToStringStrategy.INSTANCE;
final StringBuilder buffer = new StringBuilder();
append(null, buffer, strategy);
return buffer.toString();
}
public StringBuilder append(ObjectLocator locator, StringBuilder buffer, ToStringStrategy strategy) {
strategy.appendStart(locator, this, buffer);
appendFields(locator, buffer, strategy);
strategy.appendEnd(locator, this, buffer);
return buffer;
}
public StringBuilder appendFields(ObjectLocator locator, StringBuilder buffer, ToStringStrategy strategy) {
super.appendFields(locator, buffer, strategy);
{
String theGrain;
theGrain = this.getGrain();
strategy.appendField(locator, this, "grain", buffer, theGrain);
}
return buffer;
}
public int hashCode(ObjectLocator locator, HashCodeStrategy strategy) {
int currentHashCode = super.hashCode(locator, strategy);
{
String theGrain;
theGrain = this.getGrain();
currentHashCode = strategy.hashCode(LocatorUtils.property(locator, "grain", theGrain), currentHashCode, theGrain);
}
return currentHashCode;
}
public int hashCode() {
final HashCodeStrategy strategy = JAXBHashCodeStrategy.INSTANCE;
return this.hashCode(null, strategy);
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy