|
| 1 | +package org.apache.cayenne.testdo.meaningful_pk.auto; |
| 2 | + |
| 3 | +import java.io.IOException; |
| 4 | +import java.io.ObjectInputStream; |
| 5 | +import java.io.ObjectOutputStream; |
| 6 | +import java.math.BigInteger; |
| 7 | + |
| 8 | +import org.apache.cayenne.BaseDataObject; |
| 9 | +import org.apache.cayenne.exp.property.NumericProperty; |
| 10 | +import org.apache.cayenne.exp.property.PropertyFactory; |
| 11 | +import org.apache.cayenne.exp.property.StringProperty; |
| 12 | + |
| 13 | +/** |
| 14 | + * Class _MeaningfulPkBigintGenerated was generated by Cayenne. |
| 15 | + * It is probably a good idea to avoid changing this class manually, |
| 16 | + * since it may be overwritten next time code is regenerated. |
| 17 | + * If you need to make any customizations, please use subclass. |
| 18 | + */ |
| 19 | +public abstract class _MeaningfulPkBigintGenerated extends BaseDataObject { |
| 20 | + |
| 21 | + private static final long serialVersionUID = 1L; |
| 22 | + |
| 23 | + public static final String PK_PK_COLUMN = "PK"; |
| 24 | + |
| 25 | + public static final NumericProperty<BigInteger> PK = PropertyFactory.createNumeric("pk", BigInteger.class); |
| 26 | + public static final StringProperty<String> TEST_ATTR = PropertyFactory.createString("testAttr", String.class); |
| 27 | + |
| 28 | + protected BigInteger pk; |
| 29 | + protected String testAttr; |
| 30 | + |
| 31 | + |
| 32 | + public void setPk(BigInteger pk) { |
| 33 | + beforePropertyWrite("pk", this.pk, pk); |
| 34 | + this.pk = pk; |
| 35 | + } |
| 36 | + |
| 37 | + public BigInteger getPk() { |
| 38 | + beforePropertyRead("pk"); |
| 39 | + return this.pk; |
| 40 | + } |
| 41 | + |
| 42 | + public void setTestAttr(String testAttr) { |
| 43 | + beforePropertyWrite("testAttr", this.testAttr, testAttr); |
| 44 | + this.testAttr = testAttr; |
| 45 | + } |
| 46 | + |
| 47 | + public String getTestAttr() { |
| 48 | + beforePropertyRead("testAttr"); |
| 49 | + return this.testAttr; |
| 50 | + } |
| 51 | + |
| 52 | + @Override |
| 53 | + public Object readPropertyDirectly(String propName) { |
| 54 | + if(propName == null) { |
| 55 | + throw new IllegalArgumentException(); |
| 56 | + } |
| 57 | + |
| 58 | + switch(propName) { |
| 59 | + case "pk": |
| 60 | + return this.pk; |
| 61 | + case "testAttr": |
| 62 | + return this.testAttr; |
| 63 | + default: |
| 64 | + return super.readPropertyDirectly(propName); |
| 65 | + } |
| 66 | + } |
| 67 | + |
| 68 | + @Override |
| 69 | + public void writePropertyDirectly(String propName, Object val) { |
| 70 | + if(propName == null) { |
| 71 | + throw new IllegalArgumentException(); |
| 72 | + } |
| 73 | + |
| 74 | + switch (propName) { |
| 75 | + case "pk": |
| 76 | + this.pk = (BigInteger)val; |
| 77 | + break; |
| 78 | + case "testAttr": |
| 79 | + this.testAttr = (String)val; |
| 80 | + break; |
| 81 | + default: |
| 82 | + super.writePropertyDirectly(propName, val); |
| 83 | + } |
| 84 | + } |
| 85 | + |
| 86 | + private void writeObject(ObjectOutputStream out) throws IOException { |
| 87 | + writeSerialized(out); |
| 88 | + } |
| 89 | + |
| 90 | + private void readObject(ObjectInputStream in) throws IOException, ClassNotFoundException { |
| 91 | + readSerialized(in); |
| 92 | + } |
| 93 | + |
| 94 | + @Override |
| 95 | + protected void writeState(ObjectOutputStream out) throws IOException { |
| 96 | + super.writeState(out); |
| 97 | + out.writeObject(this.pk); |
| 98 | + out.writeObject(this.testAttr); |
| 99 | + } |
| 100 | + |
| 101 | + @Override |
| 102 | + protected void readState(ObjectInputStream in) throws IOException, ClassNotFoundException { |
| 103 | + super.readState(in); |
| 104 | + this.pk = (BigInteger)in.readObject(); |
| 105 | + this.testAttr = (String)in.readObject(); |
| 106 | + } |
| 107 | + |
| 108 | +} |
0 commit comments