From 7ae47ae9d73c8d78213cea25828596e4e6fca777 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timo=20Westk=C3=A4mper?= Date: Wed, 12 Mar 2008 22:15:45 +0000 Subject: [PATCH] moved all domain types of HqlParserTest into one java file --- .../mysema/query/grammar/PathMetadata.java | 1 - .../java/com/mysema/query/grammar/Types.java | 56 +++++++++---------- 2 files changed, 25 insertions(+), 32 deletions(-) diff --git a/querydsl-core/src/main/java/com/mysema/query/grammar/PathMetadata.java b/querydsl-core/src/main/java/com/mysema/query/grammar/PathMetadata.java index ea29701bc..49c553ee8 100644 --- a/querydsl-core/src/main/java/com/mysema/query/grammar/PathMetadata.java +++ b/querydsl-core/src/main/java/com/mysema/query/grammar/PathMetadata.java @@ -6,7 +6,6 @@ package com.mysema.query.grammar; import static com.mysema.query.grammar.Grammar.*; -import com.mysema.query.grammar.Types.ConstantExpr; import com.mysema.query.grammar.Types.Expr; import com.mysema.query.grammar.Types.Path; diff --git a/querydsl-core/src/main/java/com/mysema/query/grammar/Types.java b/querydsl-core/src/main/java/com/mysema/query/grammar/Types.java index a9c6272ef..9d0e51663 100644 --- a/querydsl-core/src/main/java/com/mysema/query/grammar/Types.java +++ b/querydsl-core/src/main/java/com/mysema/query/grammar/Types.java @@ -22,16 +22,6 @@ import com.mysema.query.grammar.Ops.Op; */ public class Types { - public interface AliasSimple{ - Expr getFrom(); - String getTo(); - } - - public interface AliasToPath{ - Expr getFrom(); - Path getTo(); - } - public static class AliasEntity extends ExprEntity implements AliasToPath{ private final Expr from; private final Path to; @@ -43,7 +33,7 @@ public class Types { public Expr getFrom() {return from;} public Path getTo() {return to;} } - + public static class AliasEntityCollection extends ExprEntity implements AliasToPath{ private final Expr from; private final Path to; @@ -55,7 +45,7 @@ public class Types { public Expr getFrom() {return from;} public Path getTo() {return to;} } - + public static class AliasNoEntity extends ExprNoEntity implements AliasSimple{ private final Expr from; private final String to; @@ -70,6 +60,16 @@ public class Types { public Expr getFrom() {return from;} public String getTo() {return to;} } + + public interface AliasSimple{ + Expr getFrom(); + String getTo(); + } + + public interface AliasToPath{ + Expr getFrom(); + Path getTo(); + } public static class ConstantExpr extends Expr{ private final D constant; @@ -249,14 +249,14 @@ public class Types { public static class PathEntity extends ExprEntity implements Path{ private final PathMetadata metadata; - public PathEntity(Class type, String localName) { - super(type); - metadata = forVariable(localName); - } public PathEntity(Class type, PathMetadata metadata) { super(type); this.metadata = metadata; } + public PathEntity(Class type, String localName) { + super(type); + metadata = forVariable(localName); + } protected PathBoolean _boolean(String path){ return new PathBoolean(forProperty(this, path)); } @@ -267,10 +267,10 @@ public class Types { return new PathEntityRenamable(type, forProperty(this, path)); } protected PathEntityCollection _entitycol(String path,Class type) { - return new PathEntityCollection(type, this, path); + return new PathEntityCollection(type, forProperty(this, path)); } protected PathNoEntitySimple _simple(String path, Class type){ - return new PathNoEntitySimple(type, this, path); + return new PathNoEntitySimple(type, forProperty(this, path)); } protected PathComponentCollection _simplecol(String path,Class type) { return new PathComponentCollection(type, forProperty(this, path)); @@ -279,7 +279,7 @@ public class Types { return new PathComponentMap(value, forProperty(this, path)); } protected PathString _string(String path){ - return new PathString(this, path); + return new PathString(forProperty(this, path)); } public PathMetadata getMetadata() {return metadata;} public ExprBoolean in(ExprEntity> right){return Grammar.in(this, right);} @@ -291,10 +291,10 @@ public class Types { public static class PathEntityCollection extends ExprEntity> implements Path>{ private final PathMetadata metadata; private final Class type; - PathEntityCollection(Class type, Path parent, String localName) { + PathEntityCollection(Class type, PathMetadata metadata) { super(null); this.type = type; - metadata = forProperty(parent, localName); + this.metadata = metadata; } public AliasEntityCollection as(PathEntity to) {return Grammar.as(this, to);} public ExprEntity get(int index) { @@ -308,10 +308,10 @@ public class Types { public static class PathEntityMap extends ExprEntity> implements Path>{ private final PathMetadata metadata; private final Class type; - PathEntityMap(Class type, Path parent, String localName) { + PathEntityMap(Class type, PathMetadata metadata) { super(null); this.type = type; - metadata = forProperty(parent, localName); + this.metadata = metadata; } public PathMetadata getMetadata() {return metadata;} public ExprBoolean isnotnull() {return Grammar.isnotnull(this);} @@ -323,18 +323,12 @@ public class Types { public AliasEntity as(PathEntity to) {return Grammar.as(this, to);} } - - public interface PathNoEntity extends Path{ Expr as(String to); } public static class PathNoEntitySimple extends ExprNoEntity implements PathNoEntity{ private final PathMetadata metadata; - public PathNoEntitySimple(Class type, Path parent, String localName) { - super(type); - metadata = forProperty(parent, localName); - } public PathNoEntitySimple(Class type, PathMetadata metadata) { super(type); this.metadata = metadata; @@ -346,8 +340,8 @@ public class Types { public static class PathString extends ExprString implements PathNoEntity{ private final PathMetadata metadata; - public PathString(Path parent, String localName) { - metadata = forProperty(parent, localName); + public PathString(PathMetadata metadata) { + this.metadata = metadata; } public PathMetadata getMetadata() {return metadata;} public ExprBoolean isnotnull() {return Grammar.isnotnull(this);}