From ceca1632680d0f5560b512e9eb92ff5ff32f5256 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timo=20Westk=C3=A4mper?= Date: Mon, 22 Mar 2010 19:04:12 +0000 Subject: [PATCH] moved Detachable to com.mysema.query.types.query --- .../query/serialization/JavaTemplates.java | 3 +-- .../query/support/DetachableAdapter.java | 2 +- .../mysema/query/support/DetachableMixin.java | 2 +- .../mysema/query/support/DetachableQuery.java | 2 +- .../com/mysema/query/types/EConstructor.java | 8 +++----- .../com/mysema/query/types/ExprException.java | 19 +++++++++++++++++++ .../com/mysema/query/types/path/PEntity.java | 10 +++++----- .../com/mysema/query/types/path/PList.java | 18 +++++++++--------- .../com/mysema/query/types/path/PMap.java | 18 +++++++++--------- .../query/{ => types/query}/Detachable.java | 11 +---------- .../main/java/com/mysema/util/JDBCUtil.java | 2 -- 11 files changed, 50 insertions(+), 45 deletions(-) create mode 100644 querydsl-core/src/main/java/com/mysema/query/types/ExprException.java rename querydsl-core/src/main/java/com/mysema/query/{ => types/query}/Detachable.java (84%) diff --git a/querydsl-core/src/main/java/com/mysema/query/serialization/JavaTemplates.java b/querydsl-core/src/main/java/com/mysema/query/serialization/JavaTemplates.java index a5155243b..685eeb9d1 100644 --- a/querydsl-core/src/main/java/com/mysema/query/serialization/JavaTemplates.java +++ b/querydsl-core/src/main/java/com/mysema/query/serialization/JavaTemplates.java @@ -7,7 +7,6 @@ package com.mysema.query.serialization; import java.lang.reflect.Field; -import com.mysema.query.QueryException; import com.mysema.query.types.Templates; import com.mysema.query.types.operation.OperatorImpl; import com.mysema.query.types.operation.Ops; @@ -99,7 +98,7 @@ public class JavaTemplates extends Templates { add(op, "Math." + getTemplate(op)); } } catch (IllegalAccessException e) { - throw new QueryException(e.getMessage(), e); + throw new RuntimeException(e.getMessage(), e); } add(Ops.MOD, "{0} % {0}"); diff --git a/querydsl-core/src/main/java/com/mysema/query/support/DetachableAdapter.java b/querydsl-core/src/main/java/com/mysema/query/support/DetachableAdapter.java index aae00fdd9..cb8390b93 100644 --- a/querydsl-core/src/main/java/com/mysema/query/support/DetachableAdapter.java +++ b/querydsl-core/src/main/java/com/mysema/query/support/DetachableAdapter.java @@ -5,7 +5,6 @@ */ package com.mysema.query.support; -import com.mysema.query.Detachable; import com.mysema.query.types.EBoolean; import com.mysema.query.types.EComparable; import com.mysema.query.types.EDate; @@ -18,6 +17,7 @@ import com.mysema.query.types.query.BooleanSubQuery; import com.mysema.query.types.query.ComparableSubQuery; import com.mysema.query.types.query.DateSubQuery; import com.mysema.query.types.query.DateTimeSubQuery; +import com.mysema.query.types.query.Detachable; import com.mysema.query.types.query.ListSubQuery; import com.mysema.query.types.query.NumberSubQuery; import com.mysema.query.types.query.ObjectSubQuery; diff --git a/querydsl-core/src/main/java/com/mysema/query/support/DetachableMixin.java b/querydsl-core/src/main/java/com/mysema/query/support/DetachableMixin.java index 47e601089..1eb002579 100644 --- a/querydsl-core/src/main/java/com/mysema/query/support/DetachableMixin.java +++ b/querydsl-core/src/main/java/com/mysema/query/support/DetachableMixin.java @@ -6,7 +6,6 @@ package com.mysema.query.support; import com.mysema.commons.lang.Assert; -import com.mysema.query.Detachable; import com.mysema.query.types.EBoolean; import com.mysema.query.types.EComparable; import com.mysema.query.types.EDate; @@ -20,6 +19,7 @@ import com.mysema.query.types.query.BooleanSubQuery; import com.mysema.query.types.query.ComparableSubQuery; import com.mysema.query.types.query.DateSubQuery; import com.mysema.query.types.query.DateTimeSubQuery; +import com.mysema.query.types.query.Detachable; import com.mysema.query.types.query.ListSubQuery; import com.mysema.query.types.query.NumberSubQuery; import com.mysema.query.types.query.ObjectSubQuery; diff --git a/querydsl-core/src/main/java/com/mysema/query/support/DetachableQuery.java b/querydsl-core/src/main/java/com/mysema/query/support/DetachableQuery.java index 7f3139281..c4011515f 100644 --- a/querydsl-core/src/main/java/com/mysema/query/support/DetachableQuery.java +++ b/querydsl-core/src/main/java/com/mysema/query/support/DetachableQuery.java @@ -5,7 +5,6 @@ */ package com.mysema.query.support; -import com.mysema.query.Detachable; import com.mysema.query.types.EBoolean; import com.mysema.query.types.EComparable; import com.mysema.query.types.EDate; @@ -18,6 +17,7 @@ import com.mysema.query.types.query.BooleanSubQuery; import com.mysema.query.types.query.ComparableSubQuery; import com.mysema.query.types.query.DateSubQuery; import com.mysema.query.types.query.DateTimeSubQuery; +import com.mysema.query.types.query.Detachable; import com.mysema.query.types.query.ListSubQuery; import com.mysema.query.types.query.NumberSubQuery; import com.mysema.query.types.query.ObjectSubQuery; diff --git a/querydsl-core/src/main/java/com/mysema/query/types/EConstructor.java b/querydsl-core/src/main/java/com/mysema/query/types/EConstructor.java index dbdf4d4d4..0d4740103 100644 --- a/querydsl-core/src/main/java/com/mysema/query/types/EConstructor.java +++ b/querydsl-core/src/main/java/com/mysema/query/types/EConstructor.java @@ -12,8 +12,6 @@ import java.util.List; import org.apache.commons.lang.ClassUtils; -import com.mysema.query.QueryException; - /** * EConstructor represents a constructor invocation * @@ -49,7 +47,7 @@ public class EConstructor extends Expr { } } } - throw new QueryException("Got no matching constructor"); + throw new ExprException("Got no matching constructor"); } private final List> args; @@ -116,9 +114,9 @@ public class EConstructor extends Expr { try { return (Constructor) getType().getConstructor(parameterTypes); } catch (SecurityException e) { - throw new QueryException(e.getMessage(), e); + throw new ExprException(e.getMessage(), e); } catch (NoSuchMethodException e) { - throw new QueryException(e.getMessage(), e); + throw new ExprException(e.getMessage(), e); } } diff --git a/querydsl-core/src/main/java/com/mysema/query/types/ExprException.java b/querydsl-core/src/main/java/com/mysema/query/types/ExprException.java new file mode 100644 index 000000000..20940633a --- /dev/null +++ b/querydsl-core/src/main/java/com/mysema/query/types/ExprException.java @@ -0,0 +1,19 @@ +package com.mysema.query.types; + +public class ExprException extends RuntimeException{ + + private static final long serialVersionUID = 6031724386976562965L; + + public ExprException(String msg){ + super(msg); + } + + public ExprException(String msg, Throwable t){ + super(msg, t); + } + + public ExprException(Throwable t){ + super(t); + } + +} 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 b1ca04af7..190f670ea 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 @@ -12,10 +12,10 @@ import java.util.Map; import javax.annotation.Nullable; -import com.mysema.query.QueryException; import com.mysema.query.types.EBoolean; import com.mysema.query.types.Expr; import com.mysema.query.types.ExprConst; +import com.mysema.query.types.ExprException; import com.mysema.query.types.Path; import com.mysema.query.types.PathMetadata; import com.mysema.query.types.Visitor; @@ -83,13 +83,13 @@ public class PEntity extends Expr implements Path { } } catch (InstantiationException e) { - throw new QueryException(e.getMessage(), e); + throw new ExprException(e.getMessage(), e); } catch (IllegalAccessException e) { - throw new QueryException(e.getMessage(), e); + throw new ExprException(e.getMessage(), e); } catch (InvocationTargetException e) { - throw new QueryException(e.getMessage(), e); + throw new ExprException(e.getMessage(), e); } catch (NoSuchMethodException e) { - throw new QueryException(e.getMessage(), e); + throw new ExprException(e.getMessage(), e); } } 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 7fd4f2f98..9de768a10 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 @@ -18,11 +18,11 @@ import java.util.Set; import javax.annotation.Nullable; import com.mysema.commons.lang.Assert; -import com.mysema.query.QueryException; import com.mysema.query.types.EBoolean; import com.mysema.query.types.ECollectionBase; import com.mysema.query.types.EList; import com.mysema.query.types.Expr; +import com.mysema.query.types.ExprException; import com.mysema.query.types.Path; import com.mysema.query.types.PathMetadata; import com.mysema.query.types.Visitor; @@ -87,13 +87,13 @@ public class PList> extends ECollectionBase,E> impl PathMetadata md = forListAccess(index); return newInstance(md); } catch (NoSuchMethodException e) { - throw new QueryException(e); + throw new ExprException(e); } catch (InstantiationException e) { - throw new QueryException(e); + throw new ExprException(e); } catch (IllegalAccessException e) { - throw new QueryException(e); + throw new ExprException(e); } catch (InvocationTargetException e) { - throw new QueryException(e); + throw new ExprException(e); } } @@ -108,13 +108,13 @@ public class PList> extends ECollectionBase,E> impl PathMetadata md = forListAccess(index); return newInstance(md); } catch (NoSuchMethodException e) { - throw new QueryException(e); + throw new ExprException(e); } catch (InstantiationException e) { - throw new QueryException(e); + throw new ExprException(e); } catch (IllegalAccessException e) { - throw new QueryException(e); + throw new ExprException(e); } catch (InvocationTargetException e) { - throw new QueryException(e); + throw new ExprException(e); } } 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 719e4a473..ab7f5cf8a 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,10 +15,10 @@ import java.util.Set; import javax.annotation.Nullable; -import com.mysema.query.QueryException; import com.mysema.query.types.EBoolean; import com.mysema.query.types.EMapBase; import com.mysema.query.types.Expr; +import com.mysema.query.types.ExprException; import com.mysema.query.types.Path; import com.mysema.query.types.PathMetadata; import com.mysema.query.types.Visitor; @@ -90,13 +90,13 @@ public class PMap> extends EMapBase implements Pat PathMetadata md = forMapAccess(key); return newInstance(md); } catch (NoSuchMethodException e) { - throw new QueryException(e); + throw new ExprException(e); } catch (InstantiationException e) { - throw new QueryException(e); + throw new ExprException(e); } catch (IllegalAccessException e) { - throw new QueryException(e); + throw new ExprException(e); } catch (InvocationTargetException e) { - throw new QueryException(e); + throw new ExprException(e); } } @@ -106,13 +106,13 @@ public class PMap> extends EMapBase implements Pat PathMetadata md = forMapAccess(key); return newInstance(md); } catch (NoSuchMethodException e) { - throw new QueryException(e); + throw new ExprException(e); } catch (InstantiationException e) { - throw new QueryException(e); + throw new ExprException(e); } catch (IllegalAccessException e) { - throw new QueryException(e); + throw new ExprException(e); } catch (InvocationTargetException e) { - throw new QueryException(e); + throw new ExprException(e); } } diff --git a/querydsl-core/src/main/java/com/mysema/query/Detachable.java b/querydsl-core/src/main/java/com/mysema/query/types/query/Detachable.java similarity index 84% rename from querydsl-core/src/main/java/com/mysema/query/Detachable.java rename to querydsl-core/src/main/java/com/mysema/query/types/query/Detachable.java index 6db5dd2d0..60144c694 100644 --- a/querydsl-core/src/main/java/com/mysema/query/Detachable.java +++ b/querydsl-core/src/main/java/com/mysema/query/types/query/Detachable.java @@ -3,7 +3,7 @@ * All rights reserved. * */ -package com.mysema.query; +package com.mysema.query.types.query; import com.mysema.query.types.EBoolean; import com.mysema.query.types.EComparable; @@ -13,15 +13,6 @@ import com.mysema.query.types.ENumber; import com.mysema.query.types.EString; import com.mysema.query.types.ETime; import com.mysema.query.types.Expr; -import com.mysema.query.types.query.BooleanSubQuery; -import com.mysema.query.types.query.ComparableSubQuery; -import com.mysema.query.types.query.DateSubQuery; -import com.mysema.query.types.query.DateTimeSubQuery; -import com.mysema.query.types.query.ListSubQuery; -import com.mysema.query.types.query.NumberSubQuery; -import com.mysema.query.types.query.ObjectSubQuery; -import com.mysema.query.types.query.StringSubQuery; -import com.mysema.query.types.query.TimeSubQuery; /** * Detachable defines methods for the construction of SubQuery instances diff --git a/querydsl-core/src/main/java/com/mysema/util/JDBCUtil.java b/querydsl-core/src/main/java/com/mysema/util/JDBCUtil.java index b30ab5718..a8b76e910 100644 --- a/querydsl-core/src/main/java/com/mysema/util/JDBCUtil.java +++ b/querydsl-core/src/main/java/com/mysema/util/JDBCUtil.java @@ -11,8 +11,6 @@ import java.util.Collection; import org.apache.commons.lang.ClassUtils; -import com.mysema.query.QueryException; - /** * @author tiwe *