Skip to content

Commit

Permalink
#35 : added RelationalFunctionCall support
Browse files Browse the repository at this point in the history
  • Loading branch information
timowest committed Nov 4, 2011
1 parent ef3d6a7 commit e341699
Show file tree
Hide file tree
Showing 30 changed files with 633 additions and 291 deletions.
375 changes: 214 additions & 161 deletions querydsl-apt/src/main/java/com/mysema/query/apt/ExtendedTypeFactory.java

Large diffs are not rendered by default.

Expand Up @@ -23,7 +23,7 @@ public class SimpleEntity {

}

class CustomComparable implements Comparable<CustomComparable>{
class CustomComparable implements Comparable<CustomComparable> {

@Override
public int compareTo(CustomComparable o) {
Expand All @@ -32,7 +32,7 @@ public int compareTo(CustomComparable o) {

}

class CustomNumber extends Number implements Comparable<CustomNumber>{
class CustomNumber extends Number implements Comparable<CustomNumber> {

private static final long serialVersionUID = 8683978836725543780L;

Expand Down
Expand Up @@ -18,7 +18,7 @@
*
* @param <T>
*/
public class ColDeleteClause<T> implements DeleteClause<ColDeleteClause<T>>{
public class ColDeleteClause<T> implements DeleteClause<ColDeleteClause<T>> {

private final Collection<? extends T> col;

Expand Down
Expand Up @@ -23,7 +23,7 @@
*
* @param <T>
*/
public class ColUpdateClause<T> implements UpdateClause<ColUpdateClause<T>>{
public class ColUpdateClause<T> implements UpdateClause<ColUpdateClause<T>> {

private final Path<T> expr;

Expand Down
Expand Up @@ -15,6 +15,6 @@
*
* @param <C> concrete subtype
*/
public interface DeleteClause<C extends DeleteClause<C>> extends DMLClause<C>, FilteredClause<C>{
public interface DeleteClause<C extends DeleteClause<C>> extends DMLClause<C>, FilteredClause<C> {

}
Expand Up @@ -15,7 +15,7 @@
*
* @param <C> concrete subtype
*/
public interface InsertClause<C extends InsertClause<C>> extends StoreClause<C>{
public interface InsertClause<C extends InsertClause<C>> extends StoreClause<C> {

/**
* Define the columns to be populated
Expand Down
Expand Up @@ -17,7 +17,7 @@
*
* @param <C> concrete subtype
*/
public interface StoreClause<C extends StoreClause<C>> extends DMLClause<C>{
public interface StoreClause<C extends StoreClause<C>> extends DMLClause<C> {

/**
* Add a value binding
Expand Down
Expand Up @@ -17,7 +17,7 @@
*
* @param <C> concrete subtype
*/
public interface UpdateClause<C extends UpdateClause<C>> extends StoreClause<C>, FilteredClause<C>{
public interface UpdateClause<C extends UpdateClause<C>> extends StoreClause<C>, FilteredClause<C> {

/**
* Set the paths to be updated
Expand Down
Expand Up @@ -10,7 +10,7 @@

import com.mysema.query.types.Expression;

class GList<T> extends AbstractGroupExpression<T, List<T>>{
class GList<T> extends AbstractGroupExpression<T, List<T>> {

private static final long serialVersionUID = -5613861506383727078L;

Expand Down
Expand Up @@ -10,7 +10,7 @@

import com.mysema.commons.lang.Pair;

class GMap<K, V> extends AbstractGroupExpression<Pair<K, V>, Map<K, V>>{
class GMap<K, V> extends AbstractGroupExpression<Pair<K, V>, Map<K, V>> {

private static final long serialVersionUID = 7106389414200843920L;

Expand Down
Expand Up @@ -7,7 +7,7 @@

import com.mysema.query.types.Expression;

class GOne<T> extends AbstractGroupExpression<T, T>{
class GOne<T> extends AbstractGroupExpression<T, T> {

private static final long serialVersionUID = 3518868612387641383L;

Expand Down
Expand Up @@ -8,7 +8,7 @@

import com.mysema.query.types.Expression;

class GSet<T> extends AbstractGroupExpression<T, Set<T>>{
class GSet<T> extends AbstractGroupExpression<T, Set<T>> {

private static final long serialVersionUID = -1575808026237160843L;

Expand Down
Expand Up @@ -76,13 +76,12 @@ public Template getTemplate() {
return template;
}

@SuppressWarnings("unchecked")
@Override
public boolean equals(Object o) {
if (o == this) {
return true;
} else if (o instanceof TemplateExpression) {
TemplateExpression c = (TemplateExpression)o;
TemplateExpression<?> c = (TemplateExpression<?>)o;
return c.getTemplate().equals(template)
&& c.getType().equals(type);
} else {
Expand Down
Expand Up @@ -86,7 +86,7 @@ private static void scanJar(Set<Class<?>> classes, URL url, String packagePath)
}
}

private static Class<?> safeClassForName(String className){
public static Class<?> safeClassForName(String className){
try {
if (className.startsWith("com.sun")) {
return null;
Expand Down
Expand Up @@ -10,10 +10,12 @@
import com.mysema.query.JoinExpression;
import com.mysema.query.JoinFlag;
import com.mysema.query.QueryFlag;
import com.mysema.query.QueryMetadata;
import com.mysema.query.QueryFlag.Position;
import com.mysema.query.QueryMetadata;
import com.mysema.query.sql.ForeignKey;
import com.mysema.query.sql.RelationalFunctionCall;
import com.mysema.query.sql.RelationalPath;
import com.mysema.query.sql.SQLQueryMixin;
import com.mysema.query.support.ProjectableQuery;
import com.mysema.query.support.QueryMixin;
import com.mysema.query.types.Expression;
Expand All @@ -32,11 +34,14 @@
*
* @param <T>
*/
public abstract class AbstractSQLQuery<T extends AbstractSQLQuery<T>> extends ProjectableQuery<T>{
public abstract class AbstractSQLQuery<T extends AbstractSQLQuery<T>> extends ProjectableQuery<T> {

protected final SQLQueryMixin<T> queryMixin;

@SuppressWarnings("unchecked")
public AbstractSQLQuery(QueryMetadata metadata) {
super(new QueryMixin<T>(metadata));
this.queryMixin = (SQLQueryMixin<T>)super.queryMixin;
this.queryMixin.setSelf((T)this);
}

Expand All @@ -59,13 +64,17 @@ public T from(SubQueryExpression<?> subQuery, Path<?> alias) {
return queryMixin.from(ExpressionUtils.as((Expression)subQuery, alias));
}

public <E> T fullJoin(ForeignKey<E> key, RelationalPath<E> entity) {
return queryMixin.innerJoin(entity).on(key.on(entity));
}

public T fullJoin(RelationalPath<?> o) {
return queryMixin.fullJoin(o);
}

public <E> T fullJoin(RelationalFunctionCall<E> target, Path<E> alias) {
return queryMixin.fullJoin(target, alias);
}

public <E> T fullJoin(ForeignKey<E> key, RelationalPath<E> entity) {
return queryMixin.fullJoin(entity).on(key.on(entity));
}

public T fullJoin(SubQueryExpression<?> o, Path<?> alias) {
return queryMixin.fullJoin(o, alias);
Expand All @@ -75,37 +84,49 @@ public QueryMetadata getMetadata() {
return queryMixin.getMetadata();
}

public <E> T innerJoin(ForeignKey<E> key, RelationalPath<E> entity) {
return queryMixin.innerJoin(entity).on(key.on(entity));
}

public T innerJoin(RelationalPath<?> o) {
return queryMixin.innerJoin(o);
}

public T innerJoin(SubQueryExpression<?> o, Path<?> alias) {
return queryMixin.innerJoin(o, alias);
public <E> T innerJoin(RelationalFunctionCall<E> target, Path<E> alias) {
return queryMixin.innerJoin(target, alias);
}

public <E> T join(ForeignKey<E> key, RelationalPath<E> entity) {
public <E> T innerJoin(ForeignKey<E> key, RelationalPath<E> entity) {
return queryMixin.innerJoin(entity).on(key.on(entity));
}

public T innerJoin(SubQueryExpression<?> o, Path<?> alias) {
return queryMixin.innerJoin(o, alias);
}

public T join(RelationalPath<?> o) {
return queryMixin.join(o);
}

public <E> T join(RelationalFunctionCall<E> target, Path<E> alias) {
return queryMixin.join(target, alias);
}

public <E> T join(ForeignKey<E> key, RelationalPath<E> entity) {
return queryMixin.join(entity).on(key.on(entity));
}

public T join(SubQueryExpression<?> o, Path<?> alias) {
return queryMixin.join(o, alias);
}

public <E> T leftJoin(ForeignKey<E> key, RelationalPath<E> entity) {
return queryMixin.innerJoin(entity).on(key.on(entity));
}

public T leftJoin(RelationalPath<?> o) {
return queryMixin.leftJoin(o);
}

public <E> T leftJoin(RelationalFunctionCall<E> target, Path<E> alias) {
return queryMixin.leftJoin(target, alias);
}

public <E> T leftJoin(ForeignKey<E> key, RelationalPath<E> entity) {
return queryMixin.leftJoin(entity).on(key.on(entity));
}

public T leftJoin(SubQueryExpression<?> o, Path<?> alias) {
return queryMixin.leftJoin(o, alias);
Expand All @@ -115,14 +136,18 @@ public T on(Predicate... conditions) {
return queryMixin.on(conditions);
}

public <E> T rightJoin(ForeignKey<E> key, RelationalPath<E> entity) {
return queryMixin.innerJoin(entity).on(key.on(entity));
}

public T rightJoin(RelationalPath<?> o) {
return queryMixin.rightJoin(o);
}

public <E> T rightJoin(RelationalFunctionCall<E> target, Path<E> alias) {
return queryMixin.rightJoin(target, alias);
}

public <E> T rightJoin(ForeignKey<E> key, RelationalPath<E> entity) {
return queryMixin.innerJoin(entity).on(key.on(entity));
}

public T rightJoin(SubQueryExpression<?> o, Path<?> alias) {
return queryMixin.rightJoin(o, alias);
}
Expand Down
Expand Up @@ -42,7 +42,7 @@
* @author tiwe
*
*/
public final class JDOSQLQuery extends AbstractSQLQuery<JDOSQLQuery> implements SQLCommonQuery<JDOSQLQuery>{
public final class JDOSQLQuery extends AbstractSQLQuery<JDOSQLQuery> implements SQLCommonQuery<JDOSQLQuery> {

private static final Logger logger = LoggerFactory.getLogger(JDOSQLQuery.class);

Expand Down

0 comments on commit e341699

Please sign in to comment.