Skip to content

Commit

Permalink
Fix whitespace for querydsl-jdo
Browse files Browse the repository at this point in the history
  • Loading branch information
timowest committed May 13, 2015
1 parent 856b660 commit b23eb5b
Show file tree
Hide file tree
Showing 15 changed files with 44 additions and 44 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ public AbstractJDOQuery(
@Override
public Q addFetchGroup(String fetchGroupName) {
fetchGroups.add(fetchGroupName);
return (Q)this;
return (Q) this;
}

/**
Expand Down Expand Up @@ -147,7 +147,7 @@ private Query createQuery(boolean forCount) {
if (!forCount) {
Expression<?> projection = queryMixin.getMetadata().getProjection();
if (projection instanceof FactoryExpression) {
this.projection = (FactoryExpression<?>)projection;
this.projection = (FactoryExpression<?>) projection;
}
if (!fetchGroups.isEmpty()) {
query.getFetchPlan().setGroups(fetchGroups);
Expand Down Expand Up @@ -187,7 +187,7 @@ private Object project(FactoryExpression<?> expr, Object row) {
if (row == null) {
return null;
} else if (row.getClass().isArray()) {
return expr.newInstance((Object[])row);
return expr.newInstance((Object[]) row);
} else {
return expr.newInstance(new Object[]{row});
}
Expand All @@ -206,10 +206,10 @@ private Object execute(Query query, boolean forCount) {
}
if (projection != null && !forCount) {
if (rv instanceof List) {
List<?> original = (List<?>)rv;
List<?> original = (List<?>) rv;
rv = Lists.newArrayList();
for (Object o : original) {
((List)rv).add(project(projection, o));
((List) rv).add(project(projection, o));
}
} else {
rv = project(projection, rv);
Expand All @@ -226,7 +226,7 @@ public Q from(EntityPath<?>... args) {

@Override
public <U> Q from(CollectionExpression<?, U> path, Path<U> alias) {
return queryMixin.from(ExpressionUtils.as((Path)path, alias));
return queryMixin.from(ExpressionUtils.as((Path) path, alias));
}

public JDOQLTemplates getTemplates() {
Expand All @@ -246,7 +246,7 @@ public CloseableIterator<T> iterate() {
public List<T> fetch() {
try {
Object rv = execute(createQuery(false), false);
return rv instanceof List ? (List<T>)rv : Collections.singletonList((T)rv);
return rv instanceof List ? (List<T>) rv : Collections.singletonList((T) rv);
} finally {
reset();
}
Expand Down Expand Up @@ -290,7 +290,7 @@ private void reset() {
@Override
public Q setMaxFetchDepth(int depth) {
maxFetchDepth = depth;
return (Q)this;
return (Q) this;
}

@Override
Expand All @@ -315,7 +315,7 @@ public T fetchOne() {
Query query = createQuery(false);
Object rv = execute(query, false);
if (rv instanceof List) {
List<?> list = (List)rv;
List<?> list = (List) rv;
if (!list.isEmpty()) {
if (list.size() > 1) {
throw new NonUniqueResultException();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,6 @@ public static <T> JDOQuery<T> selectFrom(EntityPath<T> expr) {
return select(expr).from(expr);
}

private JDOExpressions() {}
private JDOExpressions() { }

}
10 changes: 5 additions & 5 deletions querydsl-jdo/src/main/java/com/querydsl/jdo/JDOQLSerializer.java
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ private String serializeParameters(Map<ParamExpression<?>, Object> params) {
throw new ParamNotSetException((Param<?>) entry.getKey());
}
constants.add(constant);
b.append(((Param<?>)entry.getKey()).getType().getName());
b.append(((Param<?>) entry.getKey()).getType().getName());
} else {
constants.add(entry.getKey());
b.append(entry.getKey().getClass().getName());
Expand Down Expand Up @@ -296,20 +296,20 @@ protected void visitOperation(Class<?> type, Operator operator, List<? extends E

// not exists
} else if (operator == Ops.NOT && args.get(0) instanceof Operation
&& ((Operation)args.get(0)).getOperator().equals(Ops.EXISTS)) {
final SubQueryExpression subQuery = (SubQueryExpression) ((Operation)args.get(0)).getArg(0);
&& ((Operation) args.get(0)).getOperator().equals(Ops.EXISTS)) {
final SubQueryExpression subQuery = (SubQueryExpression) ((Operation) args.get(0)).getArg(0);
append("(");
serialize(subQuery.getMetadata(), true, true);
append(") == 0");

} else if (operator == Ops.NUMCAST) {
@SuppressWarnings("unchecked") //This is the expected type for castToNum
Constant<Class<?>> rightArg = (Constant<Class<?>>)args.get(1);
Constant<Class<?>> rightArg = (Constant<Class<?>>) args.get(1);
Class<?> clazz = rightArg.getConstant();
if (Number.class.isAssignableFrom(clazz) && Primitives.isWrapperType(clazz)) {
clazz = Primitives.unwrap(clazz);
}
append("("+clazz.getSimpleName()+")").handle(args.get(0));
append("(" + clazz.getSimpleName() + ")").handle(args.get(0));

} else {
super.visitOperation(type, operator, args);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
*/
public class JDOQueryMixin<T> extends QueryMixin<T> {

public JDOQueryMixin() {}
public JDOQueryMixin() { }

public JDOQueryMixin(QueryMetadata metadata) {
super(metadata);
Expand All @@ -39,7 +39,7 @@ public JDOQueryMixin(T self, QueryMetadata metadata) {

@Override
protected Predicate convert(Predicate predicate, Role role) {
predicate = (Predicate)ExpressionUtils.extract(predicate);
predicate = (Predicate) ExpressionUtils.extract(predicate);
if (predicate != null) {
Context context = new Context();
Predicate transformed = (Predicate) predicate.accept(collectionAnyVisitor, context);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ public AbstractSQLQuery(QueryMetadata metadata, Configuration conf, PersistenceM
boolean detach) {
super(new QueryMixin<Q>(metadata, false), conf);
this.queryMixin = super.queryMixin;
this.queryMixin.setSelf((Q)this);
this.queryMixin.setSelf((Q) this);
this.persistenceManager = persistenceManager;
this.detach = detach;
}
Expand Down Expand Up @@ -125,7 +125,7 @@ private Query createQuery(boolean forCount) {
if (!forCount) {
Expression<?> projection = queryMixin.getMetadata().getProjection();
if (projection instanceof FactoryExpression) {
this.projection = (FactoryExpression<?>)projection;
this.projection = (FactoryExpression<?>) projection;
}
} else {
query.setResultClass(Long.class);
Expand All @@ -147,7 +147,7 @@ private Object project(FactoryExpression<?> expr, Object row) {
if (row == null) {
return null;
} else if (row.getClass().isArray()) {
return expr.newInstance((Object[])row);
return expr.newInstance((Object[]) row);
} else {
return expr.newInstance(row);
}
Expand All @@ -165,10 +165,10 @@ private Object execute(Query query, boolean forCount) {
}
if (projection != null && !forCount) {
if (rv instanceof List) {
List<?> original = (List<?>)rv;
List<?> original = (List<?>) rv;
rv = Lists.newArrayList();
for (Object o : original) {
((List)rv).add(project(projection, o));
((List) rv).add(project(projection, o));
}
} else {
rv = project(projection, rv);
Expand All @@ -191,7 +191,7 @@ public CloseableIterator<T> iterate() {
public List<T> fetch() {
Object rv = execute(createQuery(false), false);
reset();
return rv instanceof List ? (List<T>)rv : Collections.singletonList((T) rv);
return rv instanceof List ? (List<T>) rv : Collections.singletonList((T) rv);
}

@Override
Expand Down Expand Up @@ -236,7 +236,7 @@ public T fetchOne() {
reset();
Object rv = execute(query, false);
if (rv instanceof List) {
List<?> list = (List<?>)rv;
List<?> list = (List<?>) rv;
if (!list.isEmpty()) {
if (list.size() > 1) {
throw new NonUniqueResultException();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ public void FactoryExpression_In_GroupBy() {
assertFalse(query().from(product).groupBy(productBean).select(productBean).fetch().isEmpty());
}

@Test(expected=NonUniqueResultException.class)
@Test(expected = NonUniqueResultException.class)
public void Unique_Result_Throws_Exception_On_Multiple_Results() {
query().from(product).select(product).fetchOne();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public void ListProducts() throws Exception {

Field queriesField = AbstractJDOQuery.class.getDeclaredField("queries");
queriesField.setAccessible(true);
List<Query> queries = (List<Query>)queriesField.get(query);
List<Query> queries = (List<Query>) queriesField.get(query);
Query jdoQuery = queries.get(0);
assertEquals(new HashSet<String>(Arrays.asList("myfetchgroup1","myfetchgroup2")),
jdoQuery.getFetchPlan().getGroups());
Expand All @@ -77,7 +77,7 @@ public void ListStores() throws Exception {

Field queriesField = AbstractJDOQuery.class.getDeclaredField("queries");
queriesField.setAccessible(true);
List<Query> queries = (List<Query>)queriesField.get(query);
List<Query> queries = (List<Query>) queriesField.get(query);
Query jdoQuery = queries.get(0);
assertEquals(new HashSet<String>(Arrays.asList("products")),
jdoQuery.getFetchPlan().getGroups());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public class JDOQueryStandardTest extends AbstractJDOTest {

public static class Projection {

public Projection(String str) {}
public Projection(String str) { }

}

Expand Down Expand Up @@ -192,7 +192,7 @@ public void Params_anon() {
.select(product.name).fetchFirst());
}

@Test(expected=ParamNotSetException.class)
@Test(expected = ParamNotSetException.class)
public void Params_not_set() {
Param<String> name = new Param<String>(String.class,"name");
assertEquals("ABC0",query().from(product).where(product.name.eq(name))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public void Count() {
assertEquals(30L, sql().from(product).fetchCount());
}

@Test(expected=NonUniqueResultException.class)
@Test(expected = NonUniqueResultException.class)
public void UniqueResult() {
sql().from(product).select(product.name).fetchOne();
}
Expand All @@ -79,9 +79,9 @@ public void StartsWith_Count() {
@Test
public void Eq_Count() {
for (int i = 0; i < 10; i++) {
assertEquals(1L, sql().from(product).where(product.name.eq("A"+i)).fetchCount());
assertEquals(1L, sql().from(product).where(product.name.eq("B"+i)).fetchCount());
assertEquals(1L, sql().from(product).where(product.name.eq("C"+i)).fetchCount());
assertEquals(1L, sql().from(product).where(product.name.eq("A" + i)).fetchCount());
assertEquals(1L, sql().from(product).where(product.name.eq("B" + i)).fetchCount());
assertEquals(1L, sql().from(product).where(product.name.eq("C" + i)).fetchCount());
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public class PackageVerification {
@Test
public void Verify_Package() throws Exception {
String version = System.getProperty("version");
verify(new File("target/querydsl-jdo-"+version+"-apt-one-jar.jar"));
verify(new File("target/querydsl-jdo-" + version + "-apt-one-jar.jar"));
}

private void verify(File oneJar) throws Exception {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ public class GroupByTest extends AbstractTest {
public void GroupBy() {
QEmployee employee = QEmployee.employee;
assertEquals(
"SELECT FROM com.querydsl.jdo.models.company.Employee "+
"PARAMETERS java.lang.String a1 "+
"GROUP BY this.emailAddress "+
"SELECT FROM com.querydsl.jdo.models.company.Employee " +
"PARAMETERS java.lang.String a1 " +
"GROUP BY this.emailAddress " +
"HAVING this.emailAddress != a1",

serialize(selectFrom(employee)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
*
*/
@SuppressWarnings("serial")
public class QBook extends EntityPathBase<com.querydsl.jdo.test.domain.Book>{
public class QBook extends EntityPathBase<com.querydsl.jdo.test.domain.Book> {

public static final QBook book = new QBook("book");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
*
*/
@SuppressWarnings("serial")
public class QProduct extends EntityPathBase<com.querydsl.jdo.test.domain.Product>{
public class QProduct extends EntityPathBase<com.querydsl.jdo.test.domain.Product> {

public static final QProduct product = new QProduct("product");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
*
*/
@SuppressWarnings("serial")
public class QStore extends EntityPathBase<com.querydsl.jdo.test.domain.Store>{
public class QStore extends EntityPathBase<com.querydsl.jdo.test.domain.Store> {

public static final QStore store = new QStore("store");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,19 +23,19 @@
@PersistenceCapable
@Inheritance(strategy = InheritanceStrategy.NEW_TABLE)
@FetchGroups({
@FetchGroup(name="products", members={@Persistent(name="products")})
@FetchGroup(name = "products", members = {@Persistent(name = "products")})
})
public class Store {

private String name;

@Join
@Element(types=Product.class)
@Element(types = Product.class)
private List<Product> products = new ArrayList<Product>();

@Join
@Key(types=String.class)
@Value(types=Product.class)
@Key(types = String.class)
@Value(types = Product.class)
private Map<String,Product> productsByName = new HashMap<String,Product>();

public String getName() {
Expand Down

0 comments on commit b23eb5b

Please sign in to comment.