mirror of
https://github.com/querydsl/querydsl.git
synced 2026-07-03 21:07:49 +08:00
Use singleton
This commit is contained in:
parent
1227c60d66
commit
232b8b8d37
@ -637,8 +637,9 @@ public final class Expressions {
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public static NullExpression<Object> nullExpression() {
|
||||
return NullExpression.DEFAULT;
|
||||
@SuppressWarnings("unchecked")//does not produce non-null instances of T
|
||||
public static <T> NullExpression<T> nullExpression() {
|
||||
return (NullExpression<T>) NullExpression.DEFAULT;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -649,7 +650,7 @@ public final class Expressions {
|
||||
* @return
|
||||
*/
|
||||
public static <T> NullExpression<T> nullExpression(Class<T> type) {
|
||||
return new NullExpression<T>(type);
|
||||
return nullExpression();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -660,7 +661,7 @@ public final class Expressions {
|
||||
* @return
|
||||
*/
|
||||
public static <T> NullExpression<T> nullExpression(Path<T> path) {
|
||||
return new NullExpression<T>(path.getType());
|
||||
return nullExpression();
|
||||
}
|
||||
|
||||
private Expressions() {}
|
||||
|
||||
@ -33,7 +33,7 @@ public class NullExpression<T> extends TemplateExpressionImpl<T> {
|
||||
*/
|
||||
public static final NullExpression<Object> DEFAULT = new NullExpression<Object>(Object.class);
|
||||
|
||||
public NullExpression(Class<? extends T> type) {
|
||||
private NullExpression(Class<? extends T> type) {
|
||||
super(type, NULL_TEMPLATE, Collections.<Expression<?>>emptyList());
|
||||
}
|
||||
|
||||
|
||||
@ -1,27 +0,0 @@
|
||||
/*
|
||||
* Copyright 2011, Mysema Ltd
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.querydsl.core.types;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
public class NullExpressionTest {
|
||||
|
||||
@Test
|
||||
public void test() {
|
||||
assertNotNull(new NullExpression<Object>(Object.class));
|
||||
}
|
||||
|
||||
}
|
||||
Loading…
Reference in New Issue
Block a user