From b9f8bac585fa65924ec54505c352ac5661c3dce7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timo=20Westk=C3=A4mper?= Date: Wed, 25 Nov 2009 10:18:26 +0000 Subject: [PATCH] refactored Path implementations to use PathMixin as a delegate --- .../com/mysema/query/types/expr/EArray.java | 5 + .../com/mysema/query/types/path/PArray.java | 69 ++++++------- .../com/mysema/query/types/path/PBoolean.java | 90 ++++++++--------- .../mysema/query/types/path/PCollection.java | 51 ++++------ .../mysema/query/types/path/PComparable.java | 65 +++++-------- .../com/mysema/query/types/path/PDate.java | 55 ++++------- .../mysema/query/types/path/PDateTime.java | 85 +++++++--------- .../com/mysema/query/types/path/PEntity.java | 96 +++++++++---------- .../com/mysema/query/types/path/PList.java | 41 ++++---- .../com/mysema/query/types/path/PMap.java | 93 ++++++++---------- .../com/mysema/query/types/path/PNumber.java | 93 ++++++++---------- .../com/mysema/query/types/path/PSet.java | 57 +++++------ .../com/mysema/query/types/path/PSimple.java | 94 ++++++++---------- .../com/mysema/query/types/path/PString.java | 90 ++++++++--------- .../com/mysema/query/types/path/PTime.java | 58 +++++------ .../com/mysema/query/types/path/Path.java | 12 +-- .../mysema/query/types/path/PathInits.java | 4 +- .../mysema/query/types/path/PathMetadata.java | 12 +-- .../mysema/query/types/path/PathMixin.java | 84 ++++++++++++++++ 19 files changed, 532 insertions(+), 622 deletions(-) create mode 100644 querydsl-core/src/main/java/com/mysema/query/types/path/PathMixin.java diff --git a/querydsl-core/src/main/java/com/mysema/query/types/expr/EArray.java b/querydsl-core/src/main/java/com/mysema/query/types/expr/EArray.java index da7b57800..debe9787c 100644 --- a/querydsl-core/src/main/java/com/mysema/query/types/expr/EArray.java +++ b/querydsl-core/src/main/java/com/mysema/query/types/expr/EArray.java @@ -1,3 +1,8 @@ +/* + * Copyright (c) 2009 Mysema Ltd. + * All rights reserved. + * + */ package com.mysema.query.types.expr; import javax.annotation.Nonnegative; diff --git a/querydsl-core/src/main/java/com/mysema/query/types/path/PArray.java b/querydsl-core/src/main/java/com/mysema/query/types/path/PArray.java index 9c42ed070..b90c64d73 100644 --- a/querydsl-core/src/main/java/com/mysema/query/types/path/PArray.java +++ b/querydsl-core/src/main/java/com/mysema/query/types/path/PArray.java @@ -14,7 +14,6 @@ import com.mysema.query.types.expr.EArray; import com.mysema.query.types.expr.EBoolean; import com.mysema.query.types.expr.ENumber; import com.mysema.query.types.expr.Expr; -import com.mysema.query.types.operation.OBoolean; import com.mysema.query.types.operation.ONumber; import com.mysema.query.types.operation.Ops; @@ -32,31 +31,31 @@ public class PArray extends Expr implements Path, EArray{ private final Class componentType; - private volatile EBoolean isnull, isnotnull; - - private final PathMetadata metadata; + private final Path pathMixin; private volatile ENumber size; - - private final Path root; @SuppressWarnings("unchecked") public PArray(Class type, PathMetadata metadata) { super((Class)Object[].class); + this.pathMixin = new PathMixin(this, metadata); this.arrayType = (Class) Array.newInstance(type, 0).getClass(); this.componentType = (Class) type; - this.metadata = metadata; - this.root = metadata.getRoot() != null ? metadata.getRoot() : this; } -// public PArray(Class type, @NotEmpty String var) { -// this(type, PathMetadata.forVariable(var)); -// } + @Override + public void accept(Visitor v) { + v.visit(this); + } - @SuppressWarnings("unchecked") + @Override + public Expr asExpr() { + return this; + } + +@Override public boolean equals(Object o) { - return o instanceof Path ? ((Path) o).getMetadata().equals(metadata) - : false; + return pathMixin.equals(o); } /** @@ -70,6 +69,7 @@ public class PArray extends Expr implements Path, EArray{ return new PSimple(componentType, md); } + /** * Create a expression for indexed access * @@ -81,21 +81,21 @@ public class PArray extends Expr implements Path, EArray{ return new PSimple(componentType, md); } -// @Override + // @Override public Class getElementType() { return componentType; } @Override public PathMetadata getMetadata() { - return metadata; - } + return pathMixin.getMetadata(); + } @Override public Path getRoot() { - return root; + return pathMixin.getRoot(); } - + @Override public Class getType() { return arrayType; @@ -103,25 +103,19 @@ public class PArray extends Expr implements Path, EArray{ @Override public int hashCode() { - return metadata.hashCode(); + return pathMixin.hashCode(); } @Override public EBoolean isNotNull() { - if (isnotnull == null) { - isnotnull = OBoolean.create(Ops.IS_NOT_NULL, this); - } - return isnotnull; - } - - @Override - public EBoolean isNull() { - if (isnull == null) { - isnull = OBoolean.create(Ops.IS_NULL, this); - } - return isnull; + return pathMixin.isNotNull(); } + @Override + public EBoolean isNull() { + return pathMixin.isNull(); + } + /** * Create an expression for the array size * @@ -133,14 +127,5 @@ public class PArray extends Expr implements Path, EArray{ } return size; } - - @Override - public void accept(Visitor v) { - v.visit(this); - } - - @Override - public Expr asExpr() { - return this; - } + } \ No newline at end of file diff --git a/querydsl-core/src/main/java/com/mysema/query/types/path/PBoolean.java b/querydsl-core/src/main/java/com/mysema/query/types/path/PBoolean.java index e4f2c4976..d7bfdde28 100644 --- a/querydsl-core/src/main/java/com/mysema/query/types/path/PBoolean.java +++ b/querydsl-core/src/main/java/com/mysema/query/types/path/PBoolean.java @@ -7,8 +7,6 @@ package com.mysema.query.types.path; import com.mysema.query.types.Visitor; import com.mysema.query.types.expr.EBoolean; -import com.mysema.query.types.operation.OBoolean; -import com.mysema.query.types.operation.Ops; import com.mysema.query.util.NotEmpty; /** @@ -20,71 +18,59 @@ import com.mysema.query.util.NotEmpty; */ @SuppressWarnings("serial") public class PBoolean extends EBoolean implements Path { - - private volatile EBoolean isnull, isnotnull; - - private final PathMetadata metadata; - - private final Path root; - public PBoolean(PathMetadata metadata) { - this.metadata = metadata; - this.root = metadata.getRoot() != null ? metadata.getRoot() : this; - } + private final Path pathMixin; - public PBoolean(@NotEmpty String var) { - this(PathMetadata.forVariable(var)); - } - public PBoolean(Path parent, @NotEmpty String property) { this(PathMetadata.forProperty(parent, property)); } - @SuppressWarnings("unchecked") - @Override - public boolean equals(Object o) { - return o instanceof Path ? ((Path) o).getMetadata().equals(metadata) - : false; + public PBoolean(PathMetadata metadata) { + this.pathMixin = new PathMixin(this, metadata); } - - @Override - public PathMetadata getMetadata() { - return metadata; - } - - @Override - public Path getRoot() { - return root; - } - - @Override - public int hashCode() { - return metadata.hashCode(); - } - - @Override - public EBoolean isNotNull() { - if (isnotnull == null) { - isnotnull = OBoolean.create(Ops.IS_NOT_NULL, this); - } - return isnotnull; + + public PBoolean(@NotEmpty String var) { + this(PathMetadata.forVariable(var)); } @Override public void accept(Visitor v) { v.visit(this); - } - - @Override - public EBoolean isNull() { - if (isnull == null) { - isnull = OBoolean.create(Ops.IS_NULL, this); - } - return isnull; - } + } @Override public EBoolean asExpr() { return this; } + + @Override + public boolean equals(Object o) { + return pathMixin.equals(o); + } + + @Override + public PathMetadata getMetadata() { + return pathMixin.getMetadata(); + } + + @Override + public Path getRoot() { + return pathMixin.getRoot(); + } + + @Override + public int hashCode() { + return pathMixin.hashCode(); + } + + @Override + public EBoolean isNotNull() { + return pathMixin.isNotNull(); + } + + @Override + public EBoolean isNull() { + return pathMixin.isNull(); + } + } \ No newline at end of file diff --git a/querydsl-core/src/main/java/com/mysema/query/types/path/PCollection.java b/querydsl-core/src/main/java/com/mysema/query/types/path/PCollection.java index 91abb35cd..90db9e3dd 100644 --- a/querydsl-core/src/main/java/com/mysema/query/types/path/PCollection.java +++ b/querydsl-core/src/main/java/com/mysema/query/types/path/PCollection.java @@ -12,8 +12,6 @@ import com.mysema.query.types.Visitor; import com.mysema.query.types.expr.EBoolean; import com.mysema.query.types.expr.ECollectionBase; import com.mysema.query.types.expr.Expr; -import com.mysema.query.types.operation.OBoolean; -import com.mysema.query.types.operation.Ops; import com.mysema.query.util.NotEmpty; /** @@ -26,23 +24,18 @@ import com.mysema.query.util.NotEmpty; @SuppressWarnings("serial") public class PCollection extends ECollectionBase,E> implements Path> { - private final PathMetadata metadata; - private final Class elementType; private final String entityName; - private volatile EBoolean isnull, isnotnull; - - private final Path root; + private final Path> pathMixin; @SuppressWarnings("unchecked") public PCollection(Class type, @NotEmpty String entityName, PathMetadata metadata) { - super((Class)Collection.class); + super((Class)Collection.class); this.elementType = (Class) Assert.notNull(type,"type is null"); - this.metadata = Assert.notNull(metadata,"metadata is null"); this.entityName = Assert.notNull(entityName,"entityName is null"); - this.root = metadata.getRoot() != null ? metadata.getRoot() : this; + this.pathMixin = new PathMixin>(this, metadata); } @Override @@ -50,17 +43,21 @@ public class PCollection extends ECollectionBase,E> implements v.visit(this); } - @SuppressWarnings("unchecked") @Override - public boolean equals(Object o) { - return o instanceof Path ? ((Path) o).getMetadata().equals(metadata) : false; + public Expr> asExpr() { + return this; } + @Override + public boolean equals(Object o) { + return pathMixin.equals(o); + } + @Override public Class getElementType() { return elementType; } - + /** * Get the entity name for this Entity collection path * @@ -69,42 +66,30 @@ public class PCollection extends ECollectionBase,E> implements public String getEntityName() { return entityName; } - + @Override public PathMetadata getMetadata() { - return metadata; + return pathMixin.getMetadata(); } @Override public Path getRoot() { - return root; + return pathMixin.getRoot(); } - + @Override public int hashCode() { - return metadata.hashCode(); + return pathMixin.hashCode(); } @Override public EBoolean isNotNull() { - if (isnotnull == null) { - isnotnull = OBoolean.create(Ops.IS_NOT_NULL, this); - } - return isnotnull; + return pathMixin.isNotNull(); } @Override public EBoolean isNull() { - if (isnull == null) { - isnull = OBoolean.create(Ops.IS_NULL, this); - } - return isnull; - } - - - @Override - public Expr> asExpr() { - return this; + return pathMixin.isNull(); } } \ No newline at end of file diff --git a/querydsl-core/src/main/java/com/mysema/query/types/path/PComparable.java b/querydsl-core/src/main/java/com/mysema/query/types/path/PComparable.java index 3d7430fb4..8c2c977d1 100644 --- a/querydsl-core/src/main/java/com/mysema/query/types/path/PComparable.java +++ b/querydsl-core/src/main/java/com/mysema/query/types/path/PComparable.java @@ -8,8 +8,6 @@ package com.mysema.query.types.path; import com.mysema.query.types.Visitor; import com.mysema.query.types.expr.EBoolean; import com.mysema.query.types.expr.EComparable; -import com.mysema.query.types.operation.OBoolean; -import com.mysema.query.types.operation.Ops; import com.mysema.query.util.NotEmpty; /** @@ -21,75 +19,64 @@ import com.mysema.query.util.NotEmpty; * @see java.util.Comparable */ @SuppressWarnings({"unchecked","serial"}) -public class PComparable extends EComparable implements - Path { - - private volatile EBoolean isnull, isnotnull; - - private final PathMetadata metadata; - - private final Path root; +public class PComparable extends EComparable implements Path { - public PComparable(Class type, PathMetadata metadata) { - super(type); - this.metadata = metadata; - this.root = metadata.getRoot() != null ? metadata.getRoot() : this; - } - - public PComparable(Class type, @NotEmpty String var) { - this(type, PathMetadata.forVariable(var)); - } + private final Path pathMixin; public PComparable(Class type, Path parent, @NotEmpty String property) { this(type, PathMetadata.forProperty(parent, property)); } + + public PComparable(Class type, PathMetadata metadata) { + super(type); + this.pathMixin = new PathMixin(this, metadata); + } + + public PComparable(Class type, @NotEmpty String var) { + this(type, PathMetadata.forVariable(var)); + } public PComparable(Path parent, @NotEmpty String property) { this((Class) Comparable.class, PathMetadata.forProperty(parent, property)); } - - public boolean equals(Object o) { - return o instanceof Path ? ((Path) o).getMetadata().equals(metadata) : false; - } @Override public void accept(Visitor v) { v.visit(this); } + @Override + public EComparable asExpr() { + return this; + } + + @Override + public boolean equals(Object o) { + return pathMixin.equals(o); + } + @Override public PathMetadata getMetadata() { - return metadata; + return pathMixin.getMetadata(); } @Override public Path getRoot() { - return root; + return pathMixin.getRoot(); } @Override public int hashCode() { - return metadata.hashCode(); + return pathMixin.hashCode(); } @Override public EBoolean isNotNull() { - if (isnotnull == null) { - isnotnull = OBoolean.create(Ops.IS_NOT_NULL, this); - } - return isnotnull; + return pathMixin.isNotNull(); } @Override public EBoolean isNull() { - if (isnull == null) { - isnull = OBoolean.create(Ops.IS_NULL, this); - } - return isnull; - } - - @Override - public EComparable asExpr() { - return this; + return pathMixin.isNull(); } } \ No newline at end of file diff --git a/querydsl-core/src/main/java/com/mysema/query/types/path/PDate.java b/querydsl-core/src/main/java/com/mysema/query/types/path/PDate.java index 86fb007ff..62e73e065 100644 --- a/querydsl-core/src/main/java/com/mysema/query/types/path/PDate.java +++ b/querydsl-core/src/main/java/com/mysema/query/types/path/PDate.java @@ -8,8 +8,6 @@ package com.mysema.query.types.path; import com.mysema.query.types.Visitor; import com.mysema.query.types.expr.EBoolean; import com.mysema.query.types.expr.EDate; -import com.mysema.query.types.operation.OBoolean; -import com.mysema.query.types.operation.Ops; import com.mysema.query.util.NotEmpty; /** @@ -20,70 +18,59 @@ import com.mysema.query.util.NotEmpty; @SuppressWarnings({"unchecked","serial"}) public class PDate extends EDate implements Path{ - private volatile EBoolean isnull, isnotnull; - - private final PathMetadata metadata; - - private final Path root; + private final Path pathMixin; + public PDate(Class type, Path parent, @NotEmpty String property) { + this(type, PathMetadata.forProperty(parent, property)); + } + public PDate(Class type, PathMetadata metadata) { super(type); - this.metadata = metadata; - this.root = metadata.getRoot() != null ? metadata.getRoot() : this; + this.pathMixin = new PathMixin(this, metadata); } public PDate(Class type, @NotEmpty String var) { this(type, PathMetadata.forVariable(var)); } - - public PDate(Class type, Path parent, @NotEmpty String property) { - this(type, PathMetadata.forProperty(parent, property)); - } - - public boolean equals(Object o) { - return o instanceof Path ? ((Path) o).getMetadata().equals(metadata) - : false; - } @Override public void accept(Visitor v) { v.visit(this); } + @Override + public EDate asExpr() { + return this; + } + + @Override + public boolean equals(Object o) { + return pathMixin.equals(o); + } + @Override public PathMetadata getMetadata() { - return metadata; + return pathMixin.getMetadata(); } @Override public Path getRoot() { - return root; + return pathMixin.getRoot(); } @Override public int hashCode() { - return metadata.hashCode(); + return pathMixin.hashCode(); } @Override public EBoolean isNotNull() { - if (isnotnull == null) { - isnotnull = OBoolean.create(Ops.IS_NOT_NULL, this); - } - return isnotnull; + return pathMixin.isNotNull(); } @Override public EBoolean isNull() { - if (isnull == null) { - isnull = OBoolean.create(Ops.IS_NULL, this); - } - return isnull; - } - - @Override - public EDate asExpr() { - return this; + return pathMixin.isNull(); } } diff --git a/querydsl-core/src/main/java/com/mysema/query/types/path/PDateTime.java b/querydsl-core/src/main/java/com/mysema/query/types/path/PDateTime.java index 32773df9f..91098d3d6 100644 --- a/querydsl-core/src/main/java/com/mysema/query/types/path/PDateTime.java +++ b/querydsl-core/src/main/java/com/mysema/query/types/path/PDateTime.java @@ -8,8 +8,6 @@ package com.mysema.query.types.path; import com.mysema.query.types.Visitor; import com.mysema.query.types.expr.EBoolean; import com.mysema.query.types.expr.EDateTime; -import com.mysema.query.types.operation.OBoolean; -import com.mysema.query.types.operation.Ops; import com.mysema.query.util.NotEmpty; /** @@ -20,69 +18,58 @@ import com.mysema.query.util.NotEmpty; @SuppressWarnings({"unchecked","serial"}) public class PDateTime extends EDateTime implements Path { - private volatile EBoolean isnull, isnotnull; - - private final PathMetadata metadata; - - private final Path root; + private final Path pathMixin; + public PDateTime(Class type, Path parent, @NotEmpty String property) { + this(type, PathMetadata.forProperty(parent, property)); + } + public PDateTime(Class type, PathMetadata metadata) { super(type); - this.metadata = metadata; - this.root = metadata.getRoot() != null ? metadata.getRoot() : this; + this.pathMixin = new PathMixin(this, metadata); } public PDateTime(Class type, @NotEmpty String var) { this(type, PathMetadata.forVariable(var)); } - public PDateTime(Class type, Path parent, @NotEmpty String property) { - this(type, PathMetadata.forProperty(parent, property)); - } - - public boolean equals(Object o) { - return o instanceof Path ? ((Path) o).getMetadata().equals(metadata) - : false; - } - @Override public void accept(Visitor v) { v.visit(this); } - - @Override - public PathMetadata getMetadata() { - return metadata; - } - - @Override - public Path getRoot() { - return root; - } - - @Override - public int hashCode() { - return metadata.hashCode(); - } - - @Override - public EBoolean isNotNull() { - if (isnotnull == null) { - isnotnull = OBoolean.create(Ops.IS_NOT_NULL, this); - } - return isnotnull; - } - - @Override - public EBoolean isNull() { - if (isnull == null) { - isnull = OBoolean.create(Ops.IS_NULL, this); - } - return isnull; - } @Override public EDateTime asExpr() { return this; } + + @Override + public boolean equals(Object o) { + return pathMixin.equals(o); + } + + @Override + public PathMetadata getMetadata() { + return pathMixin.getMetadata(); + } + + @Override + public Path getRoot() { + return pathMixin.getRoot(); + } + + @Override + public int hashCode() { + return pathMixin.hashCode(); + } + + @Override + public EBoolean isNotNull() { + return pathMixin.isNotNull(); + } + + @Override + public EBoolean isNull() { + return pathMixin.isNull(); + } } diff --git a/querydsl-core/src/main/java/com/mysema/query/types/path/PEntity.java b/querydsl-core/src/main/java/com/mysema/query/types/path/PEntity.java index e1776d91b..48d5800d9 100644 --- a/querydsl-core/src/main/java/com/mysema/query/types/path/PEntity.java +++ b/querydsl-core/src/main/java/com/mysema/query/types/path/PEntity.java @@ -30,17 +30,12 @@ public class PEntity extends Expr implements Path { private final String entityName; - private volatile EBoolean isnull, isnotnull; + private final Path pathMixin; - private final PathMetadata metadata; - - private final Path root; - public PEntity(Class type, @NotEmpty String entityName, PathMetadata metadata) { super(type); + this.pathMixin = new PathMixin(this, metadata); this.entityName = entityName; - this.metadata = metadata; - this.root = metadata.getRoot() != null ? metadata.getRoot() : this; } @Override @@ -76,6 +71,16 @@ public class PEntity extends Expr implements Path { return this; } + /** + * @param + * @param property + * @param type + * @return + */ + protected PArray createArray(@NotEmpty String property, Class type) { + return new PArray(type, PathMetadata.forProperty(this, property)); + } + /** * @param propertyName * @return @@ -84,6 +89,16 @@ public class PEntity extends Expr implements Path { return new PBoolean(this, propertyName); } + /** + * @param + * @param property + * @param type + * @return + */ + protected PCollection createCollection(@NotEmpty String property, Class type) { + return new PCollection(type, type.getSimpleName(), PathMetadata.forProperty(this, property)); + } + /** * @param * @param property @@ -94,7 +109,7 @@ public class PEntity extends Expr implements Path { protected PComparable createComparable(@NotEmpty String property, Class type) { return new PComparable((Class)type, this, property); } - + /** * @param * @param property @@ -117,36 +132,6 @@ public class PEntity extends Expr implements Path { return new PDateTime((Class)type, this, property); } - /** - * @param - * @param property - * @param type - * @return - */ - protected PArray createArray(@NotEmpty String property, Class type) { - return new PArray(type, PathMetadata.forProperty(this, property)); - } - - /** - * @param - * @param property - * @param type - * @return - */ - protected PCollection createCollection(@NotEmpty String property, Class type) { - return new PCollection(type, type.getSimpleName(), PathMetadata.forProperty(this, property)); - } - - /** - * @param - * @param property - * @param type - * @return - */ - protected PSet createSet(@NotEmpty String property, Class type) { - return new PSet(type, type.getSimpleName(), PathMetadata.forProperty(this, property)); - } - /** * @param * @param @@ -186,6 +171,16 @@ public class PEntity extends Expr implements Path { return new PNumber((Class)type, this, property); } + /** + * @param + * @param property + * @param type + * @return + */ + protected PSet createSet(@NotEmpty String property, Class type) { + return new PSet(type, type.getSimpleName(), PathMetadata.forProperty(this, property)); + } + /** * @param * @param path @@ -216,11 +211,12 @@ public class PEntity extends Expr implements Path { return new PTime((Class)type, this, property); } - @SuppressWarnings("unchecked") + @Override public boolean equals(Object o) { - return o instanceof Path ? ((Path) o).getMetadata().equals(metadata) : false; + return pathMixin.equals(o); } + /** * Get the entity name for this Entity path @@ -233,17 +229,17 @@ public class PEntity extends Expr implements Path { @Override public PathMetadata getMetadata() { - return metadata; + return pathMixin.getMetadata(); } @Override public Path getRoot() { - return root; + return pathMixin.getRoot(); } - + @Override public int hashCode() { - return metadata.hashCode(); + return pathMixin.hashCode(); } /** @@ -256,20 +252,14 @@ public class PEntity extends Expr implements Path { public EBoolean instanceOf(Class type) { return OBoolean.create(Ops.INSTANCE_OF, this, ExprConst.create(type)); } - + @Override public EBoolean isNotNull() { - if (isnotnull == null) { - isnotnull = OBoolean.create(Ops.IS_NOT_NULL, this); - } - return isnotnull; + return pathMixin.isNotNull(); } @Override public EBoolean isNull() { - if (isnull == null) { - isnull = OBoolean.create(Ops.IS_NULL, this); - } - return isnull; + return pathMixin.isNull(); } } \ No newline at end of file diff --git a/querydsl-core/src/main/java/com/mysema/query/types/path/PList.java b/querydsl-core/src/main/java/com/mysema/query/types/path/PList.java index 3faafd298..da4b7d397 100644 --- a/querydsl-core/src/main/java/com/mysema/query/types/path/PList.java +++ b/querydsl-core/src/main/java/com/mysema/query/types/path/PList.java @@ -19,8 +19,6 @@ import com.mysema.query.types.expr.EBoolean; import com.mysema.query.types.expr.ECollectionBase; import com.mysema.query.types.expr.EList; import com.mysema.query.types.expr.Expr; -import com.mysema.query.types.operation.OBoolean; -import com.mysema.query.types.operation.Ops; import com.mysema.query.util.NotEmpty; /** @@ -48,24 +46,19 @@ public class PList> extends ECollectionBase,E> impl protected final String entityName; - private volatile EBoolean isnull, isnotnull; + private final Path> pathMixin; - private final PathMetadata metadata; - - private final Class queryType; + private final Class queryType; private Constructor queryTypeConstructor; - private final Path root; - @SuppressWarnings("unchecked") public PList(Class elementType, @NotEmpty String entityName, Class queryType, PathMetadata metadata) { super((Class)List.class); this.elementType = (Class) Assert.notNull(elementType,"type is null"); - this.metadata = Assert.notNull(metadata,"metadata is null"); this.entityName = Assert.notNull(entityName,"entityName is null"); this.queryType = queryType; - this.root = metadata.getRoot() != null ? metadata.getRoot() : this; + this.pathMixin = new PathMixin>(this, metadata); } @Override @@ -87,6 +80,11 @@ public class PList> extends ECollectionBase,E> impl } } + @Override + public boolean equals(Object o) { + return pathMixin.equals(o); + } + @Override public Q get(Expr index) { PathMetadata md = PathMetadata.forListAccess(this, index); @@ -112,31 +110,30 @@ public class PList> extends ECollectionBase,E> impl public Class getElementType() { return elementType; } - + @Override public PathMetadata getMetadata() { - return metadata; + return pathMixin.getMetadata(); + } + + @Override + public Path getRoot() { + return pathMixin.getRoot(); } @Override - public Path getRoot() { - return root; + public int hashCode() { + return pathMixin.hashCode(); } @Override public EBoolean isNotNull() { - if (isnotnull == null) { - isnotnull = OBoolean.create(Ops.IS_NOT_NULL, this); - } - return isnotnull; + return pathMixin.isNotNull(); } @Override public EBoolean isNull() { - if (isnull == null) { - isnull = OBoolean.create(Ops.IS_NULL, this); - } - return isnull; + return pathMixin.isNull(); } private Q newInstance(PathMetadata pm) throws Exception{ diff --git a/querydsl-core/src/main/java/com/mysema/query/types/path/PMap.java b/querydsl-core/src/main/java/com/mysema/query/types/path/PMap.java index ecefb369a..8d2d2caf8 100644 --- a/querydsl-core/src/main/java/com/mysema/query/types/path/PMap.java +++ b/querydsl-core/src/main/java/com/mysema/query/types/path/PMap.java @@ -15,8 +15,6 @@ import com.mysema.query.types.Visitor; import com.mysema.query.types.expr.EBoolean; import com.mysema.query.types.expr.EMapBase; import com.mysema.query.types.expr.Expr; -import com.mysema.query.types.operation.OBoolean; -import com.mysema.query.types.operation.Ops; /** * PMap represents map paths @@ -37,30 +35,24 @@ public class PMap> extends EMapBase implements Pat PSimple.class, PTime.class )); - - - private volatile EBoolean isnull, isnotnull; - + private final Class keyType; - private final Class valueType; + private final Path> pathMixin; private final Class queryType; private Constructor queryTypeConstructor; - private final PathMetadata metadata; + private final Class valueType; - private final Path root; - @SuppressWarnings("unchecked") public PMap(Class keyType, Class valueType, Class queryType, PathMetadata metadata) { super((Class)Map.class); this.keyType = (Class) keyType; this.valueType = (Class) valueType; this.queryType = queryType; - this.metadata = metadata; - this.root = metadata.getRoot() != null ? metadata.getRoot() : this; + this.pathMixin = new PathMixin>(this, metadata); } @Override @@ -68,29 +60,14 @@ public class PMap> extends EMapBase implements Pat v.visit(this); } - @SuppressWarnings("unchecked") + @Override + public PMap asExpr() { + return this; + } + @Override public boolean equals(Object o) { - return o instanceof Path ? ((Path) o).getMetadata().equals(metadata) : false; - } - - private E newInstance(PathMetadata pm) throws Exception{ - if (queryTypeConstructor == null){ - try { - if (typedClasses.contains(queryType)){ - queryTypeConstructor = queryType.getConstructor(Class.class, PathMetadata.class); - }else{ - queryTypeConstructor = queryType.getConstructor(PathMetadata.class); - } - } catch (Exception e) { - throw new RuntimeException(e.getMessage(), e); - } - } - if (typedClasses.contains(queryType)){ - return queryTypeConstructor.newInstance(getValueType(), pm); - }else{ - return queryTypeConstructor.newInstance(pm); - } + return pathMixin.equals(o); } @Override @@ -112,51 +89,59 @@ public class PMap> extends EMapBase implements Pat throw new RuntimeException(e.getMessage(), e); } } - + @Override public Class getKeyType() { return keyType; } - + @Override public PathMetadata getMetadata() { - return metadata; + return pathMixin.getMetadata(); } - + @Override public Path getRoot() { - return root; + return pathMixin.getRoot(); } - + @Override public Class getValueType() { return valueType; } - + @Override public int hashCode() { - return metadata.hashCode(); + return pathMixin.hashCode(); } - + @Override public EBoolean isNotNull() { - if (isnotnull == null) { - isnotnull = OBoolean.create(Ops.IS_NOT_NULL, this); - } - return isnotnull; + return pathMixin.isNotNull(); } - + @Override public EBoolean isNull() { - if (isnull == null) { - isnull = OBoolean.create(Ops.IS_NULL, this); - } - return isnull; + return pathMixin.isNull(); } - @Override - public PMap asExpr() { - return this; + private E newInstance(PathMetadata pm) throws Exception{ + if (queryTypeConstructor == null){ + try { + if (typedClasses.contains(queryType)){ + queryTypeConstructor = queryType.getConstructor(Class.class, PathMetadata.class); + }else{ + queryTypeConstructor = queryType.getConstructor(PathMetadata.class); + } + } catch (Exception e) { + throw new RuntimeException(e.getMessage(), e); + } + } + if (typedClasses.contains(queryType)){ + return queryTypeConstructor.newInstance(getValueType(), pm); + }else{ + return queryTypeConstructor.newInstance(pm); + } } } \ No newline at end of file diff --git a/querydsl-core/src/main/java/com/mysema/query/types/path/PNumber.java b/querydsl-core/src/main/java/com/mysema/query/types/path/PNumber.java index c8fca39c4..ba74d9a3c 100644 --- a/querydsl-core/src/main/java/com/mysema/query/types/path/PNumber.java +++ b/querydsl-core/src/main/java/com/mysema/query/types/path/PNumber.java @@ -8,8 +8,6 @@ package com.mysema.query.types.path; import com.mysema.query.types.Visitor; import com.mysema.query.types.expr.EBoolean; import com.mysema.query.types.expr.ENumber; -import com.mysema.query.types.operation.OBoolean; -import com.mysema.query.types.operation.Ops; import com.mysema.query.util.NotEmpty; /** @@ -22,71 +20,58 @@ import com.mysema.query.util.NotEmpty; @SuppressWarnings("serial") public class PNumber> extends ENumber implements Path { - private volatile EBoolean isnull, isnotnull; - - private final PathMetadata metadata; - - private final Path root; + private final Path pathMixin; + + public PNumber(Class type, Path parent, @NotEmpty String property) { + this(type, PathMetadata.forProperty(parent, property)); + } public PNumber(Class type, PathMetadata metadata) { super(type); - this.metadata = metadata; - this.root = metadata.getRoot() != null ? metadata.getRoot() : this; - } - - public PNumber(Class type, @NotEmpty String var) { - this(type, PathMetadata.forVariable(var)); + this.pathMixin = new PathMixin(this, metadata); } - public PNumber(Class type, Path parent, @NotEmpty String property) { - this(type, PathMetadata.forProperty(parent, property)); + public PNumber(Class type, @NotEmpty String var) { + this(type, PathMetadata.forVariable(var)); } @Override public void accept(Visitor v) { v.visit(this); } - - @SuppressWarnings("unchecked") - @Override - public boolean equals(Object o) { - return o instanceof Path ? ((Path) o).getMetadata().equals(metadata) - : false; - } - - @Override - public PathMetadata getMetadata() { - return metadata; - } - - @Override - public Path getRoot() { - return root; - } - - @Override - public int hashCode() { - return metadata.hashCode(); - } - - @Override - public EBoolean isNotNull() { - if (isnotnull == null) { - isnotnull = OBoolean.create(Ops.IS_NOT_NULL, this); - } - return isnotnull; - } - - @Override - public EBoolean isNull() { - if (isnull == null) { - isnull = OBoolean.create(Ops.IS_NULL, this); - } - return isnull; - } - + @Override public ENumber asExpr() { return this; } + + @Override + public boolean equals(Object o) { + return pathMixin.equals(o); + } + + @Override + public PathMetadata getMetadata() { + return pathMixin.getMetadata(); + } + + @Override + public Path getRoot() { + return pathMixin.getRoot(); + } + + @Override + public int hashCode() { + return pathMixin.hashCode(); + } + + @Override + public EBoolean isNotNull() { + return pathMixin.isNotNull(); + } + + @Override + public EBoolean isNull() { + return pathMixin.isNull(); + } } \ No newline at end of file diff --git a/querydsl-core/src/main/java/com/mysema/query/types/path/PSet.java b/querydsl-core/src/main/java/com/mysema/query/types/path/PSet.java index 65a1271e9..d0932286b 100644 --- a/querydsl-core/src/main/java/com/mysema/query/types/path/PSet.java +++ b/querydsl-core/src/main/java/com/mysema/query/types/path/PSet.java @@ -1,6 +1,10 @@ +/* + * Copyright (c) 2009 Mysema Ltd. + * All rights reserved. + * + */ package com.mysema.query.types.path; -import java.util.Collection; import java.util.Set; import com.mysema.commons.lang.Assert; @@ -8,8 +12,6 @@ import com.mysema.query.types.Visitor; import com.mysema.query.types.expr.EBoolean; import com.mysema.query.types.expr.ECollectionBase; import com.mysema.query.types.expr.Expr; -import com.mysema.query.types.operation.OBoolean; -import com.mysema.query.types.operation.Ops; import com.mysema.query.util.NotEmpty; /** @@ -22,23 +24,18 @@ import com.mysema.query.util.NotEmpty; @SuppressWarnings("serial") public class PSet extends ECollectionBase,E> implements Path> { - private final PathMetadata metadata; - private final Class elementType; private final String entityName; - private volatile EBoolean isnull, isnotnull; - - private final Path root; + private final Path> pathMixin; @SuppressWarnings("unchecked") public PSet(Class type, @NotEmpty String entityName, PathMetadata metadata) { super((Class)Set.class); - this.elementType = (Class) Assert.notNull(type,"type is null"); - this.metadata = Assert.notNull(metadata,"metadata is null"); + this.elementType = (Class) Assert.notNull(type,"type is null"); this.entityName = Assert.notNull(entityName,"entityName is null"); - this.root = metadata.getRoot() != null ? metadata.getRoot() : this; + this.pathMixin = new PathMixin>(this, metadata); } @Override @@ -46,17 +43,21 @@ public class PSet extends ECollectionBase,E> implements Path> { v.visit(this); } - @SuppressWarnings("unchecked") @Override - public boolean equals(Object o) { - return o instanceof Path ? ((Path) o).getMetadata().equals(metadata) : false; + public Expr> asExpr() { + return this; } + @Override + public boolean equals(Object o) { + return pathMixin.equals(o); + } + @Override public Class getElementType() { return elementType; } - + /** * Get the entity name for this Entity collection path * @@ -65,42 +66,30 @@ public class PSet extends ECollectionBase,E> implements Path> { public String getEntityName() { return entityName; } - + @Override public PathMetadata getMetadata() { - return metadata; + return pathMixin.getMetadata(); } @Override public Path getRoot() { - return root; + return pathMixin.getRoot(); } - + @Override public int hashCode() { - return metadata.hashCode(); + return pathMixin.hashCode(); } @Override public EBoolean isNotNull() { - if (isnotnull == null) { - isnotnull = OBoolean.create(Ops.IS_NOT_NULL, this); - } - return isnotnull; + return pathMixin.isNotNull(); } @Override public EBoolean isNull() { - if (isnull == null) { - isnull = OBoolean.create(Ops.IS_NULL, this); - } - return isnull; - } - - - @Override - public Expr> asExpr() { - return this; + return pathMixin.isNull(); } } diff --git a/querydsl-core/src/main/java/com/mysema/query/types/path/PSimple.java b/querydsl-core/src/main/java/com/mysema/query/types/path/PSimple.java index 7e7c83061..727593709 100644 --- a/querydsl-core/src/main/java/com/mysema/query/types/path/PSimple.java +++ b/querydsl-core/src/main/java/com/mysema/query/types/path/PSimple.java @@ -8,8 +8,6 @@ package com.mysema.query.types.path; import com.mysema.query.types.Visitor; import com.mysema.query.types.expr.EBoolean; import com.mysema.query.types.expr.Expr; -import com.mysema.query.types.operation.OBoolean; -import com.mysema.query.types.operation.Ops; import com.mysema.query.util.NotEmpty; /** @@ -22,72 +20,58 @@ import com.mysema.query.util.NotEmpty; @SuppressWarnings("serial") public class PSimple extends Expr implements Path { - private volatile EBoolean isnull, isnotnull; - - private final PathMetadata metadata; - - private final Path root; - - public PSimple(Class type, PathMetadata metadata) { - super(type); - this.metadata = metadata; - this.root = metadata.getRoot() != null ? metadata.getRoot() : this; - } - - public PSimple(Class type, @NotEmpty String var) { - this(type, PathMetadata.forVariable(var)); - } + private final Path pathMixin; public PSimple(Class type, @NotEmpty Path parent, String property) { this(type, PathMetadata.forProperty(parent, property)); } + + public PSimple(Class type, PathMetadata metadata) { + super(type); + this.pathMixin = new PathMixin(this, metadata); + } + + public PSimple(Class type, @NotEmpty String var) { + this(type, PathMetadata.forVariable(var)); + } @Override public void accept(Visitor v) { v.visit(this); } - - @SuppressWarnings("unchecked") - @Override - public boolean equals(Object o) { - return o instanceof Path ? ((Path) o).getMetadata().equals(metadata) - : false; - } - - @Override - public PathMetadata getMetadata() { - return metadata; - } - - @Override - public Path getRoot() { - return root; - } - - @Override - public int hashCode() { - return metadata.hashCode(); - } - - @Override - public EBoolean isNotNull() { - if (isnotnull == null) { - isnotnull = OBoolean.create(Ops.IS_NOT_NULL, this); - } - return isnotnull; - } - - @Override - public EBoolean isNull() { - if (isnull == null) { - isnull = OBoolean.create(Ops.IS_NULL, this); - } - return isnull; - } @Override public Expr asExpr() { return this; } + @Override + public boolean equals(Object o) { + return pathMixin.equals(o); + } + + @Override + public PathMetadata getMetadata() { + return pathMixin.getMetadata(); + } + + @Override + public Path getRoot() { + return pathMixin.getRoot(); + } + + @Override + public int hashCode() { + return pathMixin.hashCode(); + } + + @Override + public EBoolean isNotNull() { + return pathMixin.isNotNull(); + } + + @Override + public EBoolean isNull() { + return pathMixin.isNull(); + } } \ No newline at end of file diff --git a/querydsl-core/src/main/java/com/mysema/query/types/path/PString.java b/querydsl-core/src/main/java/com/mysema/query/types/path/PString.java index a05164dd4..bc100bf88 100644 --- a/querydsl-core/src/main/java/com/mysema/query/types/path/PString.java +++ b/querydsl-core/src/main/java/com/mysema/query/types/path/PString.java @@ -8,8 +8,6 @@ package com.mysema.query.types.path; import com.mysema.query.types.Visitor; import com.mysema.query.types.expr.EBoolean; import com.mysema.query.types.expr.EString; -import com.mysema.query.types.operation.OBoolean; -import com.mysema.query.types.operation.Ops; import com.mysema.query.util.NotEmpty; /** @@ -20,68 +18,58 @@ import com.mysema.query.util.NotEmpty; */ @SuppressWarnings("serial") public class PString extends EString implements Path { - - private volatile EBoolean isnull, isnotnull; - - private final PathMetadata metadata; - public PString(PathMetadata metadata) { - this.metadata = metadata; - } - - public PString(@NotEmpty String var) { - this(PathMetadata.forVariable(var)); - } + private final Path pathMixin; public PString(Path parent, @NotEmpty String property) { this(PathMetadata.forProperty(parent, property)); } + public PString(PathMetadata metadata) { + this.pathMixin = new PathMixin(this, metadata); + } + + public PString(@NotEmpty String var) { + this(PathMetadata.forVariable(var)); + } + @Override public void accept(Visitor v) { v.visit(this); } - @SuppressWarnings("unchecked") - @Override - public boolean equals(Object o) { - return o instanceof Path ? ((Path) o).getMetadata().equals(metadata) - : false; - } - - @Override - public PathMetadata getMetadata() { - return metadata; - } - - @Override - public Path getRoot() { - return metadata.getRoot() != null ? metadata.getRoot() : this; - } - - @Override - public int hashCode() { - return metadata.hashCode(); - } - - @Override - public EBoolean isNotNull() { - if (isnotnull == null) { - isnotnull = OBoolean.create(Ops.IS_NOT_NULL, this); - } - return isnotnull; - } - - @Override - public EBoolean isNull() { - if (isnull == null) { - isnull = OBoolean.create(Ops.IS_NULL, this); - } - return isnull; - } - @Override public EString asExpr() { return this; } + + @Override + public boolean equals(Object o) { + return pathMixin.equals(o); + } + + @Override + public PathMetadata getMetadata() { + return pathMixin.getMetadata(); + } + + @Override + public Path getRoot() { + return pathMixin.getRoot(); + } + + @Override + public int hashCode() { + return pathMixin.hashCode(); + } + + @Override + public EBoolean isNotNull() { + return pathMixin.isNotNull(); + } + + @Override + public EBoolean isNull() { + return pathMixin.isNull(); + } } \ No newline at end of file diff --git a/querydsl-core/src/main/java/com/mysema/query/types/path/PTime.java b/querydsl-core/src/main/java/com/mysema/query/types/path/PTime.java index 2ba222e27..8b94745da 100644 --- a/querydsl-core/src/main/java/com/mysema/query/types/path/PTime.java +++ b/querydsl-core/src/main/java/com/mysema/query/types/path/PTime.java @@ -8,8 +8,6 @@ package com.mysema.query.types.path; import com.mysema.query.types.Visitor; import com.mysema.query.types.expr.EBoolean; import com.mysema.query.types.expr.ETime; -import com.mysema.query.types.operation.OBoolean; -import com.mysema.query.types.operation.Ops; import com.mysema.query.util.NotEmpty; /** @@ -20,69 +18,57 @@ import com.mysema.query.util.NotEmpty; @SuppressWarnings({"unchecked","serial"}) public class PTime extends ETime implements Path{ - private volatile EBoolean isnull, isnotnull; - - private final PathMetadata metadata; - - private final Path root; - - public PTime(Class type, PathMetadata metadata) { - super(type); - this.metadata = metadata; - this.root = metadata.getRoot() != null ? metadata.getRoot() : this; - } - - public PTime(Class type, @NotEmpty String var) { - this(type, PathMetadata.forVariable(var)); - } + private final Path pathMixin; public PTime(Class type, Path parent, @NotEmpty String property) { this(type, PathMetadata.forProperty(parent, property)); } - public boolean equals(Object o) { - return o instanceof Path ? ((Path) o).getMetadata().equals(metadata) - : false; + public PTime(Class type, PathMetadata metadata) { + super(type); + this.pathMixin = new PathMixin(this, metadata); } + public PTime(Class type, @NotEmpty String var) { + this(type, PathMetadata.forVariable(var)); + } @Override public void accept(Visitor v) { v.visit(this); } + @Override + public ETime asExpr() { + return this; + } + + @Override + public boolean equals(Object o) { + return pathMixin.equals(o); + } + @Override public PathMetadata getMetadata() { - return metadata; + return pathMixin.getMetadata(); } @Override public Path getRoot() { - return root; + return pathMixin.getRoot(); } @Override public int hashCode() { - return metadata.hashCode(); + return pathMixin.hashCode(); } @Override public EBoolean isNotNull() { - if (isnotnull == null) { - isnotnull = OBoolean.create(Ops.IS_NOT_NULL, this); - } - return isnotnull; + return pathMixin.isNotNull(); } @Override public EBoolean isNull() { - if (isnull == null) { - isnull = OBoolean.create(Ops.IS_NULL, this); - } - return isnull; - } - - @Override - public ETime asExpr() { - return this; + return pathMixin.isNull(); } } diff --git a/querydsl-core/src/main/java/com/mysema/query/types/path/Path.java b/querydsl-core/src/main/java/com/mysema/query/types/path/Path.java index 7c8886dcc..c0f011c46 100644 --- a/querydsl-core/src/main/java/com/mysema/query/types/path/Path.java +++ b/querydsl-core/src/main/java/com/mysema/query/types/path/Path.java @@ -15,6 +15,11 @@ import com.mysema.query.types.expr.Expr; * @version $Id$ */ public interface Path { + /** + * @return + */ + Expr asExpr(); + /** * Get the metadata for this path * @@ -42,7 +47,7 @@ public interface Path { * @return */ EBoolean isNotNull(); - + /** * Create a this is null expression * @@ -50,10 +55,5 @@ public interface Path { * @return */ EBoolean isNull(); - - /** - * @return - */ - Expr asExpr(); } diff --git a/querydsl-core/src/main/java/com/mysema/query/types/path/PathInits.java b/querydsl-core/src/main/java/com/mysema/query/types/path/PathInits.java index 44783d136..33e8f8852 100644 --- a/querydsl-core/src/main/java/com/mysema/query/types/path/PathInits.java +++ b/querydsl-core/src/main/java/com/mysema/query/types/path/PathInits.java @@ -21,10 +21,10 @@ public class PathInits { public static final PathInits DIRECT = new PathInits("*"); - private final Map propertyToInits = new HashMap(); - private boolean initAllProps = false; + private final Map propertyToInits = new HashMap(); + public PathInits(String... inits){ for (String init : inits){ addInit(init); diff --git a/querydsl-core/src/main/java/com/mysema/query/types/path/PathMetadata.java b/querydsl-core/src/main/java/com/mysema/query/types/path/PathMetadata.java index 94847f0e2..6a7e3a8aa 100644 --- a/querydsl-core/src/main/java/com/mysema/query/types/path/PathMetadata.java +++ b/querydsl-core/src/main/java/com/mysema/query/types/path/PathMetadata.java @@ -67,13 +67,13 @@ public final class PathMetadata implements Serializable{ private final Expr expression; + private final int hashCode; + @Nullable private final Path parent, root; private final PathType pathType; - private final int hashCode; - private PathMetadata(@Nullable Path parent, Expr expression, PathType type) { this.parent = parent; this.expression = expression; @@ -105,10 +105,6 @@ public final class PathMetadata implements Serializable{ return parent; } - public boolean isRoot(){ - return parent == null; - } - public PathType getPathType() { return pathType; } @@ -122,4 +118,8 @@ public final class PathMetadata implements Serializable{ return hashCode; } + public boolean isRoot(){ + return parent == null; + } + } diff --git a/querydsl-core/src/main/java/com/mysema/query/types/path/PathMixin.java b/querydsl-core/src/main/java/com/mysema/query/types/path/PathMixin.java new file mode 100644 index 000000000..1b5b1fecf --- /dev/null +++ b/querydsl-core/src/main/java/com/mysema/query/types/path/PathMixin.java @@ -0,0 +1,84 @@ +/* + * Copyright (c) 2009 Mysema Ltd. + * All rights reserved. + * + */ +package com.mysema.query.types.path; + +import com.mysema.query.types.expr.EBoolean; +import com.mysema.query.types.expr.Expr; +import com.mysema.query.types.operation.OBoolean; +import com.mysema.query.types.operation.Ops; + +/** + * PathMixin defines a mixin version of the Path interface which can be used + * as a component and target in actual Path implementations + * + * @author tiwe + * + * @param + */ +class PathMixin implements Path { + + private volatile EBoolean isnull, isnotnull; + + private final PathMetadata metadata; + + private final Path root; + + private final Expr self; + + @SuppressWarnings("unchecked") + public PathMixin(Expr self, PathMetadata metadata){ + this.self = self; + this.metadata = metadata; + this.root = metadata.getRoot() != null ? metadata.getRoot() : (Path)self; + } + + @Override + public Expr asExpr() { + return self; + } + + @SuppressWarnings("unchecked") + public boolean equals(Object o) { + return o instanceof Path ? ((Path) o).getMetadata().equals(metadata) : false; + } + + @Override + public PathMetadata getMetadata() { + return metadata; + } + + @Override + public Path getRoot() { + return root; + } + + @Override + public Class getType() { + return self.getType(); + } + + @Override + public int hashCode() { + return metadata.hashCode(); + } + + @Override + public EBoolean isNotNull() { + if (isnotnull == null) { + isnotnull = OBoolean.create(Ops.IS_NOT_NULL, self); + } + return isnotnull; + } + + @Override + public EBoolean isNull() { + if (isnull == null) { + isnull = OBoolean.create(Ops.IS_NULL, self); + } + return isnull; + } + +}