mirror of
https://github.com/ebean-orm/ebean.git
synced 2024-04-21 10:51:47 +00:00
No effective change - change Line endings to CR (from CRLF)
This commit is contained in:
@@ -1,55 +1,55 @@
|
||||
package com.avaje.tests.model.basic;
|
||||
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.ManyToOne;
|
||||
|
||||
@Entity
|
||||
public class CKeyDetail {
|
||||
|
||||
@Id
|
||||
Integer id;
|
||||
|
||||
String something;
|
||||
|
||||
@ManyToOne
|
||||
// @JoinColumns({
|
||||
// @JoinColumn(name="parent_one_key", referencedColumnName="one_key"),
|
||||
// @JoinColumn(name="parent_two_key", referencedColumnName="two_key")
|
||||
// })
|
||||
CKeyParent parent;
|
||||
|
||||
public CKeyDetail() {
|
||||
|
||||
}
|
||||
|
||||
public CKeyDetail(String something) {
|
||||
this.something = something;
|
||||
}
|
||||
|
||||
public Integer getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Integer id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getSomething() {
|
||||
return something;
|
||||
}
|
||||
|
||||
public void setSomething(String something) {
|
||||
this.something = something;
|
||||
}
|
||||
|
||||
public CKeyParent getParent() {
|
||||
return parent;
|
||||
}
|
||||
|
||||
public void setParent(CKeyParent parent) {
|
||||
this.parent = parent;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
package com.avaje.tests.model.basic;
|
||||
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.ManyToOne;
|
||||
|
||||
@Entity
|
||||
public class CKeyDetail {
|
||||
|
||||
@Id
|
||||
Integer id;
|
||||
|
||||
String something;
|
||||
|
||||
@ManyToOne
|
||||
// @JoinColumns({
|
||||
// @JoinColumn(name="parent_one_key", referencedColumnName="one_key"),
|
||||
// @JoinColumn(name="parent_two_key", referencedColumnName="two_key")
|
||||
// })
|
||||
CKeyParent parent;
|
||||
|
||||
public CKeyDetail() {
|
||||
|
||||
}
|
||||
|
||||
public CKeyDetail(String something) {
|
||||
this.something = something;
|
||||
}
|
||||
|
||||
public Integer getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Integer id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getSomething() {
|
||||
return something;
|
||||
}
|
||||
|
||||
public void setSomething(String something) {
|
||||
this.something = something;
|
||||
}
|
||||
|
||||
public CKeyParent getParent() {
|
||||
return parent;
|
||||
}
|
||||
|
||||
public void setParent(CKeyParent parent) {
|
||||
this.parent = parent;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,76 +1,76 @@
|
||||
package com.avaje.tests.model.basic;
|
||||
|
||||
import javax.persistence.CascadeType;
|
||||
import javax.persistence.EmbeddedId;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.ManyToOne;
|
||||
import javax.persistence.OneToMany;
|
||||
import javax.persistence.Version;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@Entity
|
||||
public class CKeyParent {
|
||||
|
||||
@EmbeddedId
|
||||
CKeyParentId id;
|
||||
|
||||
String name;
|
||||
|
||||
@Version
|
||||
int version;
|
||||
|
||||
@ManyToOne(cascade = CascadeType.PERSIST)
|
||||
CKeyAssoc assoc;
|
||||
|
||||
@OneToMany(cascade = CascadeType.PERSIST, mappedBy = "parent")
|
||||
List<CKeyDetail> details;
|
||||
|
||||
public CKeyParentId getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(CKeyParentId id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public int getVersion() {
|
||||
return version;
|
||||
}
|
||||
|
||||
public void setVersion(int version) {
|
||||
this.version = version;
|
||||
}
|
||||
|
||||
public CKeyAssoc getAssoc() {
|
||||
return assoc;
|
||||
}
|
||||
|
||||
public void setAssoc(CKeyAssoc assoc) {
|
||||
this.assoc = assoc;
|
||||
}
|
||||
|
||||
public List<CKeyDetail> getDetails() {
|
||||
return details;
|
||||
}
|
||||
|
||||
public void setDetails(List<CKeyDetail> details) {
|
||||
this.details = details;
|
||||
}
|
||||
|
||||
public void add(CKeyDetail detail) {
|
||||
if (details == null) {
|
||||
details = new ArrayList<CKeyDetail>();
|
||||
}
|
||||
details.add(detail);
|
||||
}
|
||||
|
||||
}
|
||||
package com.avaje.tests.model.basic;
|
||||
|
||||
import javax.persistence.CascadeType;
|
||||
import javax.persistence.EmbeddedId;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.ManyToOne;
|
||||
import javax.persistence.OneToMany;
|
||||
import javax.persistence.Version;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@Entity
|
||||
public class CKeyParent {
|
||||
|
||||
@EmbeddedId
|
||||
CKeyParentId id;
|
||||
|
||||
String name;
|
||||
|
||||
@Version
|
||||
int version;
|
||||
|
||||
@ManyToOne(cascade = CascadeType.PERSIST)
|
||||
CKeyAssoc assoc;
|
||||
|
||||
@OneToMany(cascade = CascadeType.PERSIST, mappedBy = "parent")
|
||||
List<CKeyDetail> details;
|
||||
|
||||
public CKeyParentId getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(CKeyParentId id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public int getVersion() {
|
||||
return version;
|
||||
}
|
||||
|
||||
public void setVersion(int version) {
|
||||
this.version = version;
|
||||
}
|
||||
|
||||
public CKeyAssoc getAssoc() {
|
||||
return assoc;
|
||||
}
|
||||
|
||||
public void setAssoc(CKeyAssoc assoc) {
|
||||
this.assoc = assoc;
|
||||
}
|
||||
|
||||
public List<CKeyDetail> getDetails() {
|
||||
return details;
|
||||
}
|
||||
|
||||
public void setDetails(List<CKeyDetail> details) {
|
||||
this.details = details;
|
||||
}
|
||||
|
||||
public void add(CKeyDetail detail) {
|
||||
if (details == null) {
|
||||
details = new ArrayList<CKeyDetail>();
|
||||
}
|
||||
details.add(detail);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,56 +1,56 @@
|
||||
package com.avaje.tests.model.basic;
|
||||
|
||||
import javax.persistence.Embeddable;
|
||||
|
||||
@Embeddable
|
||||
public class CKeyParentId {
|
||||
|
||||
Integer oneKey;
|
||||
String twoKey;
|
||||
|
||||
public CKeyParentId() {
|
||||
|
||||
}
|
||||
|
||||
public CKeyParentId(Integer oneKey, String twoKey) {
|
||||
this.oneKey = oneKey;
|
||||
this.twoKey = twoKey;
|
||||
}
|
||||
|
||||
public Integer getOneKey() {
|
||||
return oneKey;
|
||||
}
|
||||
|
||||
public void setOneKey(Integer oneKey) {
|
||||
this.oneKey = oneKey;
|
||||
}
|
||||
|
||||
public String getTwoKey() {
|
||||
return twoKey;
|
||||
}
|
||||
|
||||
public void setTwoKey(String twoKey) {
|
||||
this.twoKey = twoKey;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) {
|
||||
return true;
|
||||
}
|
||||
if (!(o instanceof CKeyParentId)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
CKeyParentId otherKey = (CKeyParentId) o;
|
||||
return otherKey.hashCode() == hashCode();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int hc = getClass().getName().hashCode();
|
||||
hc = 31 * hc + oneKey;
|
||||
hc = 31 * hc + twoKey.hashCode();
|
||||
return hc;
|
||||
}
|
||||
}
|
||||
package com.avaje.tests.model.basic;
|
||||
|
||||
import javax.persistence.Embeddable;
|
||||
|
||||
@Embeddable
|
||||
public class CKeyParentId {
|
||||
|
||||
Integer oneKey;
|
||||
String twoKey;
|
||||
|
||||
public CKeyParentId() {
|
||||
|
||||
}
|
||||
|
||||
public CKeyParentId(Integer oneKey, String twoKey) {
|
||||
this.oneKey = oneKey;
|
||||
this.twoKey = twoKey;
|
||||
}
|
||||
|
||||
public Integer getOneKey() {
|
||||
return oneKey;
|
||||
}
|
||||
|
||||
public void setOneKey(Integer oneKey) {
|
||||
this.oneKey = oneKey;
|
||||
}
|
||||
|
||||
public String getTwoKey() {
|
||||
return twoKey;
|
||||
}
|
||||
|
||||
public void setTwoKey(String twoKey) {
|
||||
this.twoKey = twoKey;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) {
|
||||
return true;
|
||||
}
|
||||
if (!(o instanceof CKeyParentId)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
CKeyParentId otherKey = (CKeyParentId) o;
|
||||
return otherKey.hashCode() == hashCode();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int hc = getClass().getName().hashCode();
|
||||
hc = 31 * hc + oneKey;
|
||||
hc = 31 * hc + twoKey.hashCode();
|
||||
return hc;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,49 +1,49 @@
|
||||
package com.avaje.tests.model.basic;
|
||||
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.Lob;
|
||||
import javax.persistence.ManyToOne;
|
||||
|
||||
@Entity
|
||||
public class ContactNote extends BasicDomain {
|
||||
|
||||
private static final long serialVersionUID = 7949702621226333278L;
|
||||
|
||||
@ManyToOne
|
||||
Contact contact;
|
||||
|
||||
String title;
|
||||
|
||||
@Lob
|
||||
String note;
|
||||
|
||||
public ContactNote(String title, String note) {
|
||||
this.title = title;
|
||||
this.note = note;
|
||||
}
|
||||
|
||||
public String getTitle() {
|
||||
return title;
|
||||
}
|
||||
|
||||
public void setTitle(String title) {
|
||||
this.title = title;
|
||||
}
|
||||
|
||||
public String getNote() {
|
||||
return note;
|
||||
}
|
||||
|
||||
public void setNote(String note) {
|
||||
this.note = note;
|
||||
}
|
||||
|
||||
public Contact getContact() {
|
||||
return contact;
|
||||
}
|
||||
|
||||
public void setContact(Contact contact) {
|
||||
this.contact = contact;
|
||||
}
|
||||
|
||||
}
|
||||
package com.avaje.tests.model.basic;
|
||||
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.Lob;
|
||||
import javax.persistence.ManyToOne;
|
||||
|
||||
@Entity
|
||||
public class ContactNote extends BasicDomain {
|
||||
|
||||
private static final long serialVersionUID = 7949702621226333278L;
|
||||
|
||||
@ManyToOne
|
||||
Contact contact;
|
||||
|
||||
String title;
|
||||
|
||||
@Lob
|
||||
String note;
|
||||
|
||||
public ContactNote(String title, String note) {
|
||||
this.title = title;
|
||||
this.note = note;
|
||||
}
|
||||
|
||||
public String getTitle() {
|
||||
return title;
|
||||
}
|
||||
|
||||
public void setTitle(String title) {
|
||||
this.title = title;
|
||||
}
|
||||
|
||||
public String getNote() {
|
||||
return note;
|
||||
}
|
||||
|
||||
public void setNote(String note) {
|
||||
this.note = note;
|
||||
}
|
||||
|
||||
public Contact getContact() {
|
||||
return contact;
|
||||
}
|
||||
|
||||
public void setContact(Contact contact) {
|
||||
this.contact = contact;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,32 +1,32 @@
|
||||
package com.avaje.tests.model.basic;
|
||||
|
||||
import org.joda.time.LocalTime;
|
||||
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.Id;
|
||||
|
||||
@Entity
|
||||
public class TJodaEntity {
|
||||
|
||||
@Id
|
||||
Integer id;
|
||||
|
||||
LocalTime localTime;
|
||||
|
||||
public Integer getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Integer id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public LocalTime getLocalTime() {
|
||||
return localTime;
|
||||
}
|
||||
|
||||
public void setLocalTime(LocalTime localTime) {
|
||||
this.localTime = localTime;
|
||||
}
|
||||
|
||||
}
|
||||
package com.avaje.tests.model.basic;
|
||||
|
||||
import org.joda.time.LocalTime;
|
||||
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.Id;
|
||||
|
||||
@Entity
|
||||
public class TJodaEntity {
|
||||
|
||||
@Id
|
||||
Integer id;
|
||||
|
||||
LocalTime localTime;
|
||||
|
||||
public Integer getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Integer id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public LocalTime getLocalTime() {
|
||||
return localTime;
|
||||
}
|
||||
|
||||
public void setLocalTime(LocalTime localTime) {
|
||||
this.localTime = localTime;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,30 +1,30 @@
|
||||
package com.avaje.tests.model.basic;
|
||||
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.Id;
|
||||
|
||||
@Entity
|
||||
public class TruckRef {
|
||||
|
||||
@Id
|
||||
Integer id;
|
||||
|
||||
String something;
|
||||
|
||||
public Integer getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Integer id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getSomething() {
|
||||
return something;
|
||||
}
|
||||
|
||||
public void setSomething(String something) {
|
||||
this.something = something;
|
||||
}
|
||||
|
||||
}
|
||||
package com.avaje.tests.model.basic;
|
||||
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.Id;
|
||||
|
||||
@Entity
|
||||
public class TruckRef {
|
||||
|
||||
@Id
|
||||
Integer id;
|
||||
|
||||
String something;
|
||||
|
||||
public Integer getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Integer id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getSomething() {
|
||||
return something;
|
||||
}
|
||||
|
||||
public void setSomething(String something) {
|
||||
this.something = something;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,58 +1,58 @@
|
||||
package com.avaje.tests.model.basic.xtra;
|
||||
|
||||
|
||||
import javax.persistence.CascadeType;
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.DiscriminatorColumn;
|
||||
import javax.persistence.DiscriminatorType;
|
||||
import javax.persistence.DiscriminatorValue;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.FetchType;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.Inheritance;
|
||||
import javax.persistence.InheritanceType;
|
||||
import javax.persistence.OneToMany;
|
||||
import javax.persistence.Table;
|
||||
import java.util.List;
|
||||
|
||||
@Entity
|
||||
@Inheritance(strategy = InheritanceType.SINGLE_TABLE)
|
||||
@DiscriminatorColumn(discriminatorType = DiscriminatorType.STRING, name = "parent_type")
|
||||
@DiscriminatorValue("BASIC")
|
||||
@Table(name = "td_parent")
|
||||
public class EdParent {
|
||||
@Id
|
||||
@Column(name = "parent_id")
|
||||
private int id;
|
||||
|
||||
@Column(name = "parent_name")
|
||||
private String name;
|
||||
|
||||
@OneToMany(fetch = FetchType.EAGER, mappedBy = "parent", cascade = CascadeType.ALL)
|
||||
List<EdChild> children;
|
||||
|
||||
public List<EdChild> getChildren() {
|
||||
return children;
|
||||
}
|
||||
|
||||
public void setChildren(List<EdChild> children) {
|
||||
this.children = children;
|
||||
}
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(int id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
}
|
||||
|
||||
package com.avaje.tests.model.basic.xtra;
|
||||
|
||||
|
||||
import javax.persistence.CascadeType;
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.DiscriminatorColumn;
|
||||
import javax.persistence.DiscriminatorType;
|
||||
import javax.persistence.DiscriminatorValue;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.FetchType;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.Inheritance;
|
||||
import javax.persistence.InheritanceType;
|
||||
import javax.persistence.OneToMany;
|
||||
import javax.persistence.Table;
|
||||
import java.util.List;
|
||||
|
||||
@Entity
|
||||
@Inheritance(strategy = InheritanceType.SINGLE_TABLE)
|
||||
@DiscriminatorColumn(discriminatorType = DiscriminatorType.STRING, name = "parent_type")
|
||||
@DiscriminatorValue("BASIC")
|
||||
@Table(name = "td_parent")
|
||||
public class EdParent {
|
||||
@Id
|
||||
@Column(name = "parent_id")
|
||||
private int id;
|
||||
|
||||
@Column(name = "parent_name")
|
||||
private String name;
|
||||
|
||||
@OneToMany(fetch = FetchType.EAGER, mappedBy = "parent", cascade = CascadeType.ALL)
|
||||
List<EdChild> children;
|
||||
|
||||
public List<EdChild> getChildren() {
|
||||
return children;
|
||||
}
|
||||
|
||||
public void setChildren(List<EdChild> children) {
|
||||
this.children = children;
|
||||
}
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(int id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,47 +1,47 @@
|
||||
package com.avaje.tests.model.ddd;
|
||||
|
||||
import java.sql.Timestamp;
|
||||
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.Version;
|
||||
|
||||
import com.avaje.tests.model.ivo.ExhangeCMoneyRate;
|
||||
import com.avaje.tests.model.ivo.Oid;
|
||||
|
||||
@Entity
|
||||
public class DExhEntity {
|
||||
|
||||
@Id
|
||||
Oid<DExhEntity> oid;
|
||||
|
||||
ExhangeCMoneyRate exhange;
|
||||
|
||||
@Version
|
||||
Timestamp lastUpdated;
|
||||
|
||||
public Oid<DExhEntity> getOid() {
|
||||
return oid;
|
||||
}
|
||||
|
||||
public void setOid(Oid<DExhEntity> oid) {
|
||||
this.oid = oid;
|
||||
}
|
||||
|
||||
public ExhangeCMoneyRate getExhange() {
|
||||
return exhange;
|
||||
}
|
||||
|
||||
public void setExhange(ExhangeCMoneyRate exhange) {
|
||||
this.exhange = exhange;
|
||||
}
|
||||
|
||||
public Timestamp getLastUpdated() {
|
||||
return lastUpdated;
|
||||
}
|
||||
|
||||
public void setLastUpdated(Timestamp lastUpdated) {
|
||||
this.lastUpdated = lastUpdated;
|
||||
}
|
||||
|
||||
}
|
||||
package com.avaje.tests.model.ddd;
|
||||
|
||||
import java.sql.Timestamp;
|
||||
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.Version;
|
||||
|
||||
import com.avaje.tests.model.ivo.ExhangeCMoneyRate;
|
||||
import com.avaje.tests.model.ivo.Oid;
|
||||
|
||||
@Entity
|
||||
public class DExhEntity {
|
||||
|
||||
@Id
|
||||
Oid<DExhEntity> oid;
|
||||
|
||||
ExhangeCMoneyRate exhange;
|
||||
|
||||
@Version
|
||||
Timestamp lastUpdated;
|
||||
|
||||
public Oid<DExhEntity> getOid() {
|
||||
return oid;
|
||||
}
|
||||
|
||||
public void setOid(Oid<DExhEntity> oid) {
|
||||
this.oid = oid;
|
||||
}
|
||||
|
||||
public ExhangeCMoneyRate getExhange() {
|
||||
return exhange;
|
||||
}
|
||||
|
||||
public void setExhange(ExhangeCMoneyRate exhange) {
|
||||
this.exhange = exhange;
|
||||
}
|
||||
|
||||
public Timestamp getLastUpdated() {
|
||||
return lastUpdated;
|
||||
}
|
||||
|
||||
public void setLastUpdated(Timestamp lastUpdated) {
|
||||
this.lastUpdated = lastUpdated;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,30 +1,30 @@
|
||||
package com.avaje.tests.model.ivo;
|
||||
|
||||
import com.avaje.ebeaninternal.server.type.reflect.KnownImmutable;
|
||||
|
||||
public class SimpleKnownImmutable implements KnownImmutable {
|
||||
|
||||
public boolean isKnownImmutable(Class<?> cls) {
|
||||
|
||||
// Check for all allowed property types...
|
||||
if (cls.isPrimitive() || String.class.equals(cls) || Object.class.equals(cls)) {
|
||||
return true;
|
||||
}
|
||||
if (java.util.Date.class.equals(cls) || java.sql.Date.class.equals(cls) || java.sql.Timestamp.class.equals(cls)) {
|
||||
// treat as immutable even through they are not strictly so
|
||||
return true;
|
||||
}
|
||||
if (java.math.BigDecimal.class.equals(cls) || java.math.BigInteger.class.equals(cls)) {
|
||||
// treat as immutable (contain non-final fields)
|
||||
return true;
|
||||
}
|
||||
|
||||
if (Integer.class.equals(cls) || Long.class.equals(cls) || Double.class.equals(cls) || Float.class.equals(cls)
|
||||
|| Short.class.equals(cls) || Byte.class.equals(cls) || Character.class.equals(cls)
|
||||
|| Boolean.class.equals(cls)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
package com.avaje.tests.model.ivo;
|
||||
|
||||
import com.avaje.ebeaninternal.server.type.reflect.KnownImmutable;
|
||||
|
||||
public class SimpleKnownImmutable implements KnownImmutable {
|
||||
|
||||
public boolean isKnownImmutable(Class<?> cls) {
|
||||
|
||||
// Check for all allowed property types...
|
||||
if (cls.isPrimitive() || String.class.equals(cls) || Object.class.equals(cls)) {
|
||||
return true;
|
||||
}
|
||||
if (java.util.Date.class.equals(cls) || java.sql.Date.class.equals(cls) || java.sql.Timestamp.class.equals(cls)) {
|
||||
// treat as immutable even through they are not strictly so
|
||||
return true;
|
||||
}
|
||||
if (java.math.BigDecimal.class.equals(cls) || java.math.BigInteger.class.equals(cls)) {
|
||||
// treat as immutable (contain non-final fields)
|
||||
return true;
|
||||
}
|
||||
|
||||
if (Integer.class.equals(cls) || Long.class.equals(cls) || Double.class.equals(cls) || Float.class.equals(cls)
|
||||
|| Short.class.equals(cls) || Byte.class.equals(cls) || Character.class.equals(cls)
|
||||
|| Boolean.class.equals(cls)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
package com.avaje.tests.model.ivo;
|
||||
|
||||
public class SysTime {
|
||||
|
||||
private final long millis;
|
||||
|
||||
public SysTime(long millis) {
|
||||
this.millis = millis;
|
||||
}
|
||||
|
||||
public long getMillis() {
|
||||
return millis;
|
||||
}
|
||||
|
||||
}
|
||||
package com.avaje.tests.model.ivo;
|
||||
|
||||
public class SysTime {
|
||||
|
||||
private final long millis;
|
||||
|
||||
public SysTime(long millis) {
|
||||
this.millis = millis;
|
||||
}
|
||||
|
||||
public long getMillis() {
|
||||
return millis;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,54 +1,54 @@
|
||||
package com.avaje.tests.model.ivo.converter;
|
||||
|
||||
import com.avaje.ebean.config.CompoundType;
|
||||
import com.avaje.ebean.config.CompoundTypeProperty;
|
||||
import com.avaje.tests.model.ivo.CMoney;
|
||||
import com.avaje.tests.model.ivo.ExhangeCMoneyRate;
|
||||
import com.avaje.tests.model.ivo.Rate;
|
||||
|
||||
public class ExhangeCompoundType implements CompoundType<ExhangeCMoneyRate> {
|
||||
|
||||
public ExhangeCMoneyRate create(Object[] propertyValues) {
|
||||
return new ExhangeCMoneyRate((Rate)propertyValues[0], (CMoney)propertyValues[1]);
|
||||
}
|
||||
|
||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||
public CompoundTypeProperty<ExhangeCMoneyRate, ?>[] getProperties() {
|
||||
|
||||
CompoundTypeProperty[] props = {new RateProp(), new CMoneyProp()};
|
||||
return props;
|
||||
}
|
||||
|
||||
static class RateProp implements CompoundTypeProperty<ExhangeCMoneyRate, Rate> {
|
||||
|
||||
public String getName() {
|
||||
return "rate";
|
||||
}
|
||||
|
||||
public Rate getValue(ExhangeCMoneyRate valueObject) {
|
||||
return valueObject.getRate();
|
||||
}
|
||||
|
||||
public int getDbType() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
static class CMoneyProp implements CompoundTypeProperty<ExhangeCMoneyRate, CMoney> {
|
||||
|
||||
public String getName() {
|
||||
return "cmoney";
|
||||
}
|
||||
|
||||
public CMoney getValue(ExhangeCMoneyRate valueObject) {
|
||||
return valueObject.getCmoney();
|
||||
}
|
||||
|
||||
public int getDbType() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
package com.avaje.tests.model.ivo.converter;
|
||||
|
||||
import com.avaje.ebean.config.CompoundType;
|
||||
import com.avaje.ebean.config.CompoundTypeProperty;
|
||||
import com.avaje.tests.model.ivo.CMoney;
|
||||
import com.avaje.tests.model.ivo.ExhangeCMoneyRate;
|
||||
import com.avaje.tests.model.ivo.Rate;
|
||||
|
||||
public class ExhangeCompoundType implements CompoundType<ExhangeCMoneyRate> {
|
||||
|
||||
public ExhangeCMoneyRate create(Object[] propertyValues) {
|
||||
return new ExhangeCMoneyRate((Rate)propertyValues[0], (CMoney)propertyValues[1]);
|
||||
}
|
||||
|
||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||
public CompoundTypeProperty<ExhangeCMoneyRate, ?>[] getProperties() {
|
||||
|
||||
CompoundTypeProperty[] props = {new RateProp(), new CMoneyProp()};
|
||||
return props;
|
||||
}
|
||||
|
||||
static class RateProp implements CompoundTypeProperty<ExhangeCMoneyRate, Rate> {
|
||||
|
||||
public String getName() {
|
||||
return "rate";
|
||||
}
|
||||
|
||||
public Rate getValue(ExhangeCMoneyRate valueObject) {
|
||||
return valueObject.getRate();
|
||||
}
|
||||
|
||||
public int getDbType() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
static class CMoneyProp implements CompoundTypeProperty<ExhangeCMoneyRate, CMoney> {
|
||||
|
||||
public String getName() {
|
||||
return "cmoney";
|
||||
}
|
||||
|
||||
public CMoney getValue(ExhangeCMoneyRate valueObject) {
|
||||
return valueObject.getCmoney();
|
||||
}
|
||||
|
||||
public int getDbType() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,51 +1,51 @@
|
||||
package com.avaje.tests.model.ivo.converter;
|
||||
|
||||
import org.joda.time.Interval;
|
||||
|
||||
import com.avaje.ebean.config.CompoundType;
|
||||
import com.avaje.ebean.config.CompoundTypeProperty;
|
||||
|
||||
public class JodaIntervalCompoundType implements CompoundType<Interval>{
|
||||
|
||||
public Interval create(Object[] propertyValues) {
|
||||
return new Interval((Long)propertyValues[0], (Long)propertyValues[1]);
|
||||
}
|
||||
|
||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||
public CompoundTypeProperty<Interval, ?>[] getProperties() {
|
||||
CompoundTypeProperty[] props = {new Start(), new End()};
|
||||
return props;
|
||||
}
|
||||
|
||||
static class Start implements CompoundTypeProperty<Interval, Long> {
|
||||
|
||||
public String getName() {
|
||||
return "startMillis";
|
||||
}
|
||||
|
||||
public Long getValue(Interval valueObject) {
|
||||
return valueObject.getStartMillis();
|
||||
}
|
||||
|
||||
public int getDbType() {
|
||||
return java.sql.Types.TIMESTAMP;
|
||||
}
|
||||
}
|
||||
|
||||
static class End implements CompoundTypeProperty<Interval, Long> {
|
||||
|
||||
public String getName() {
|
||||
return "endMillis";
|
||||
}
|
||||
|
||||
public Long getValue(Interval valueObject) {
|
||||
return valueObject.getEndMillis();
|
||||
}
|
||||
|
||||
public int getDbType() {
|
||||
return java.sql.Types.TIMESTAMP;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
package com.avaje.tests.model.ivo.converter;
|
||||
|
||||
import org.joda.time.Interval;
|
||||
|
||||
import com.avaje.ebean.config.CompoundType;
|
||||
import com.avaje.ebean.config.CompoundTypeProperty;
|
||||
|
||||
public class JodaIntervalCompoundType implements CompoundType<Interval>{
|
||||
|
||||
public Interval create(Object[] propertyValues) {
|
||||
return new Interval((Long)propertyValues[0], (Long)propertyValues[1]);
|
||||
}
|
||||
|
||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||
public CompoundTypeProperty<Interval, ?>[] getProperties() {
|
||||
CompoundTypeProperty[] props = {new Start(), new End()};
|
||||
return props;
|
||||
}
|
||||
|
||||
static class Start implements CompoundTypeProperty<Interval, Long> {
|
||||
|
||||
public String getName() {
|
||||
return "startMillis";
|
||||
}
|
||||
|
||||
public Long getValue(Interval valueObject) {
|
||||
return valueObject.getStartMillis();
|
||||
}
|
||||
|
||||
public int getDbType() {
|
||||
return java.sql.Types.TIMESTAMP;
|
||||
}
|
||||
}
|
||||
|
||||
static class End implements CompoundTypeProperty<Interval, Long> {
|
||||
|
||||
public String getName() {
|
||||
return "endMillis";
|
||||
}
|
||||
|
||||
public Long getValue(Interval valueObject) {
|
||||
return valueObject.getEndMillis();
|
||||
}
|
||||
|
||||
public int getDbType() {
|
||||
return java.sql.Types.TIMESTAMP;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,24 +1,24 @@
|
||||
package com.avaje.tests.model.ivo.converter;
|
||||
|
||||
import java.sql.Timestamp;
|
||||
|
||||
import com.avaje.ebean.config.ScalarTypeConverter;
|
||||
import com.avaje.tests.model.ivo.SysTime;
|
||||
|
||||
public class SysTimeConverter implements ScalarTypeConverter<SysTime, Timestamp> {
|
||||
|
||||
|
||||
public SysTime getNullValue() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public Timestamp unwrapValue(SysTime beanType) {
|
||||
return new Timestamp(beanType.getMillis());
|
||||
}
|
||||
|
||||
public SysTime wrapValue(Timestamp scalarType) {
|
||||
return new SysTime(scalarType.getTime());
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
package com.avaje.tests.model.ivo.converter;
|
||||
|
||||
import java.sql.Timestamp;
|
||||
|
||||
import com.avaje.ebean.config.ScalarTypeConverter;
|
||||
import com.avaje.tests.model.ivo.SysTime;
|
||||
|
||||
public class SysTimeConverter implements ScalarTypeConverter<SysTime, Timestamp> {
|
||||
|
||||
|
||||
public SysTime getNullValue() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public Timestamp unwrapValue(SysTime beanType) {
|
||||
return new Timestamp(beanType.getMillis());
|
||||
}
|
||||
|
||||
public SysTime wrapValue(Timestamp scalarType) {
|
||||
return new SysTime(scalarType.getTime());
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user