blob: ca90620484245c579a752aae6676ef8a7b97918a [file] [log] [blame]
package org.apache.cayenne.demo.model.auto;
import java.io.IOException;
import java.io.ObjectInputStream;
import java.io.ObjectOutputStream;
import java.math.BigDecimal;
import java.util.List;
import org.apache.cayenne.BaseDataObject;
import org.apache.cayenne.demo.model.Artist;
import org.apache.cayenne.demo.model.Exhibit;
import org.apache.cayenne.demo.model.PaintingInfo;
import org.apache.cayenne.exp.Property;
/**
* Class _Painting was generated by Cayenne.
* It is probably a good idea to avoid changing this class manually,
* since it may be overwritten next time code is regenerated.
* If you need to make any customizations, please use subclass.
*/
public abstract class _Painting extends BaseDataObject {
private static final long serialVersionUID = 1L;
public static final String PAINTING_ID_PK_COLUMN = "painting_id";
public static final Property<BigDecimal> ESTIMATED_PRICE = Property.create("estimatedPrice", BigDecimal.class);
public static final Property<String> DESCRIPTION = Property.create("description", String.class);
public static final Property<String> TITLE = Property.create("title", String.class);
public static final Property<PaintingInfo> PAINTING = Property.create("painting", PaintingInfo.class);
public static final Property<Artist> ARTIST = Property.create("artist", Artist.class);
public static final Property<List<Exhibit>> EXHIBITS = Property.create("exhibits", List.class);
protected BigDecimal estimatedPrice;
protected String description;
protected String title;
protected Object painting;
protected Object artist;
protected Object exhibits;
public void setEstimatedPrice(BigDecimal estimatedPrice) {
beforePropertyWrite("estimatedPrice", this.estimatedPrice, estimatedPrice);
this.estimatedPrice = estimatedPrice;
}
public BigDecimal getEstimatedPrice() {
beforePropertyRead("estimatedPrice");
return this.estimatedPrice;
}
public void setDescription(String description) {
beforePropertyWrite("description", this.description, description);
this.description = description;
}
public String getDescription() {
beforePropertyRead("description");
return this.description;
}
public void setTitle(String title) {
beforePropertyWrite("title", this.title, title);
this.title = title;
}
public String getTitle() {
beforePropertyRead("title");
return this.title;
}
public void setPainting(PaintingInfo painting) {
setToOneTarget("painting", painting, true);
}
public PaintingInfo getPainting() {
return (PaintingInfo)readProperty("painting");
}
public void setArtist(Artist artist) {
setToOneTarget("artist", artist, true);
}
public Artist getArtist() {
return (Artist)readProperty("artist");
}
public void addToExhibits(Exhibit obj) {
addToManyTarget("exhibits", obj, true);
}
public void removeFromExhibits(Exhibit obj) {
removeToManyTarget("exhibits", obj, true);
}
@SuppressWarnings("unchecked")
public List<Exhibit> getExhibits() {
return (List<Exhibit>)readProperty("exhibits");
}
@Override
public Object readPropertyDirectly(String propName) {
if(propName == null) {
throw new IllegalArgumentException();
}
switch(propName) {
case "estimatedPrice":
return this.estimatedPrice;
case "description":
return this.description;
case "title":
return this.title;
case "painting":
return this.painting;
case "artist":
return this.artist;
case "exhibits":
return this.exhibits;
default:
return super.readPropertyDirectly(propName);
}
}
@Override
public void writePropertyDirectly(String propName, Object val) {
if(propName == null) {
throw new IllegalArgumentException();
}
switch (propName) {
case "estimatedPrice":
this.estimatedPrice = (BigDecimal)val;
break;
case "description":
this.description = (String)val;
break;
case "title":
this.title = (String)val;
break;
case "painting":
this.painting = val;
break;
case "artist":
this.artist = val;
break;
case "exhibits":
this.exhibits = val;
break;
default:
super.writePropertyDirectly(propName, val);
}
}
private void writeObject(ObjectOutputStream out) throws IOException {
writeSerialized(out);
}
private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException {
readSerialized(in);
}
@Override
protected void writeState(ObjectOutputStream out) throws IOException {
super.writeState(out);
out.writeObject(this.estimatedPrice);
out.writeObject(this.description);
out.writeObject(this.title);
out.writeObject(this.painting);
out.writeObject(this.artist);
out.writeObject(this.exhibits);
}
@Override
protected void readState(ObjectInputStream in) throws IOException, ClassNotFoundException {
super.readState(in);
this.estimatedPrice = (BigDecimal)in.readObject();
this.description = (String)in.readObject();
this.title = (String)in.readObject();
this.painting = in.readObject();
this.artist = in.readObject();
this.exhibits = in.readObject();
}
}