Skip to content

Commit

Permalink
Better preserve original Expression type
Browse files Browse the repository at this point in the history
  • Loading branch information
timowest committed Dec 20, 2015
1 parent 8509767 commit fdfc0e4
Show file tree
Hide file tree
Showing 31 changed files with 322 additions and 72 deletions.
Expand Up @@ -30,6 +30,11 @@ public class BooleanOperation extends BooleanExpression implements Operation<Boo

private final PredicateOperation opMixin;

protected BooleanOperation(PredicateOperation mixin) {
super(mixin);
this.opMixin = mixin;
}

protected BooleanOperation(Operator op, Expression<?>... args) {
this(op, ImmutableList.copyOf(args));
}
Expand Down
Expand Up @@ -30,6 +30,11 @@ public class BooleanPath extends BooleanExpression implements Path<Boolean> {

private final PathImpl<Boolean> pathMixin;

protected BooleanPath(PathImpl<Boolean> mixin) {
super(mixin);
this.pathMixin = mixin;
}

protected BooleanPath(Path<?> parent, String property) {
this(PathMetadataFactory.forProperty(parent, property));
}
Expand Down
Expand Up @@ -30,6 +30,11 @@ public class BooleanTemplate extends BooleanExpression implements TemplateExpres

private final PredicateTemplate templateMixin;

protected BooleanTemplate(PredicateTemplate mixin) {
super(mixin);
this.templateMixin = mixin;
}

protected BooleanTemplate(Template template, ImmutableList<?> args) {
super(ExpressionUtils.predicateTemplate(template, args));
this.templateMixin = (PredicateTemplate) mixin;
Expand Down
Expand Up @@ -32,6 +32,11 @@ public class ComparableOperation<T extends Comparable<?>> extends

private final OperationImpl<T> opMixin;

protected ComparableOperation(OperationImpl<T> mixin) {
super(mixin);
this.opMixin = mixin;
}

protected ComparableOperation(Class<? extends T> type, Operator op, Expression<?>... args) {
this(type, op, ImmutableList.copyOf(args));
}
Expand Down
Expand Up @@ -32,6 +32,11 @@ public class ComparablePath<T extends Comparable> extends ComparableExpression<T

private final PathImpl<T> pathMixin;

protected ComparablePath(PathImpl<T> mixin) {
super(mixin);
this.pathMixin = mixin;
}

protected ComparablePath(Class<? extends T> type, Path<?> parent, String property) {
this(type, PathMetadataFactory.forProperty(parent, property));
}
Expand Down
Expand Up @@ -31,6 +31,11 @@ public class ComparableTemplate<T extends Comparable<?>> extends ComparableExpre

private final TemplateExpressionImpl<T> templateMixin;

protected ComparableTemplate(TemplateExpressionImpl<T> mixin) {
super(mixin);
this.templateMixin = mixin;
}

protected ComparableTemplate(Class<? extends T> type, Template template, ImmutableList<?> args) {
super(ExpressionUtils.template(type, template, args));
templateMixin = (TemplateExpressionImpl<T>) mixin;
Expand Down
Expand Up @@ -32,6 +32,11 @@ public class DateOperation<T extends Comparable<?>> extends

private final OperationImpl<T> opMixin;

protected DateOperation(OperationImpl<T> mixin) {
super(mixin);
this.opMixin = mixin;
}

protected DateOperation(Class<? extends T> type, Operator op, Expression<?>... args) {
this(type, op, ImmutableList.copyOf(args));
}
Expand Down
Expand Up @@ -31,6 +31,11 @@ public class DatePath<T extends Comparable> extends DateExpression<T> implements

private final PathImpl<T> pathMixin;

protected DatePath(PathImpl<T> mixin) {
super(mixin);
this.pathMixin = mixin;
}

protected DatePath(Class<? extends T> type, Path<?> parent, String property) {
this(type, PathMetadataFactory.forProperty(parent, property));
}
Expand Down
Expand Up @@ -31,6 +31,11 @@ public class DateTemplate<T extends Comparable<?>> extends DateExpression<T> imp

private final TemplateExpressionImpl<T> templateMixin;

protected DateTemplate(TemplateExpressionImpl<T> mixin) {
super(mixin);
this.templateMixin = mixin;
}

protected DateTemplate(Class<? extends T> type, Template template, ImmutableList<?> args) {
super(ExpressionUtils.template(type, template, args));
templateMixin = (TemplateExpressionImpl<T>) mixin;
Expand Down
Expand Up @@ -31,6 +31,11 @@ public class DateTimeOperation<T extends Comparable<?>> extends DateTimeExpressi

private final OperationImpl<T> opMixin;

protected DateTimeOperation(OperationImpl<T> mixin) {
super(mixin);
this.opMixin = mixin;
}

protected DateTimeOperation(Class<? extends T> type, Operator op, Expression<?>... args) {
this(type, op, ImmutableList.copyOf(args));
}
Expand Down
Expand Up @@ -30,6 +30,11 @@ public class DateTimePath<T extends Comparable> extends DateTimeExpression<T> im

private final PathImpl<T> pathMixin;

protected DateTimePath(PathImpl<T> mixin) {
super(mixin);
this.pathMixin = mixin;
}

protected DateTimePath(Class<? extends T> type, Path<?> parent, String property) {
this(type, PathMetadataFactory.forProperty(parent, property));
}
Expand Down
Expand Up @@ -31,6 +31,11 @@ public class DateTimeTemplate<T extends Comparable<?>> extends DateTimeExpressio

private final TemplateExpressionImpl<T> templateMixin;

protected DateTimeTemplate(TemplateExpressionImpl<T> mixin) {
super(mixin);
this.templateMixin = mixin;
}

protected DateTimeTemplate(Class<? extends T> type, Template template, ImmutableList<?> args) {
super(ExpressionUtils.template(type, template, args));
templateMixin = (TemplateExpressionImpl<T>) mixin;
Expand Down
Expand Up @@ -31,6 +31,11 @@ public class EnumOperation<T extends Enum<T>> extends EnumExpression<T> implemen

private final OperationImpl<T> opMixin;

protected EnumOperation(OperationImpl<T> mixin) {
super(mixin);
this.opMixin = mixin;
}

protected EnumOperation(Class<? extends T> type, Operator op, Expression<?>... args) {
this(type, op, ImmutableList.copyOf(args));
}
Expand Down
Expand Up @@ -30,6 +30,11 @@ public class EnumPath<T extends Enum<T>> extends EnumExpression<T> implements Pa

private final PathImpl<T> pathMixin;

protected EnumPath(PathImpl<T> mixin) {
super(mixin);
this.pathMixin = mixin;
}

protected EnumPath(Class<? extends T> type, Path<?> parent, String property) {
this(type, PathMetadataFactory.forProperty(parent, property));
}
Expand Down
Expand Up @@ -31,6 +31,11 @@ public class EnumTemplate<T extends Enum<T>> extends EnumExpression<T> implement

private final TemplateExpressionImpl<T> templateMixin;

protected EnumTemplate(TemplateExpressionImpl<T> mixin) {
super(mixin);
this.templateMixin = mixin;
}

protected EnumTemplate(Class<? extends T> type, Template template, ImmutableList<?> args) {
super(ExpressionUtils.template(type, template, args));
templateMixin = (TemplateExpressionImpl<T>) mixin;
Expand Down

0 comments on commit fdfc0e4

Please sign in to comment.