mirror of
https://github.com/querydsl/querydsl.git
synced 2026-06-30 21:08:30 +08:00
simplified accessors for date / time segments
This commit is contained in:
parent
723b84fc16
commit
3f26fdc8d5
@ -54,7 +54,7 @@ public abstract class EDate<D extends Comparable> extends EDateOrTime<D> {
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public ENumber<Integer> getDayOfMonth(){
|
||||
public ENumber<Integer> dayOfMonth(){
|
||||
if (dayOfMonth == null){
|
||||
dayOfMonth = ONumber.create(Integer.class, Ops.DateTimeOps.DAY_OF_MONTH, this);
|
||||
}
|
||||
@ -67,7 +67,7 @@ public abstract class EDate<D extends Comparable> extends EDateOrTime<D> {
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public ENumber<Integer> getDayOfWeek() {
|
||||
public ENumber<Integer> dayOfWeek() {
|
||||
if (dayOfWeek == null){
|
||||
dayOfWeek = ONumber.create(Integer.class, Ops.DateTimeOps.DAY_OF_WEEK, this);
|
||||
}
|
||||
@ -80,7 +80,7 @@ public abstract class EDate<D extends Comparable> extends EDateOrTime<D> {
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public ENumber<Integer> getDayOfYear() {
|
||||
public ENumber<Integer> dayOfYear() {
|
||||
if (dayOfYear == null){
|
||||
dayOfYear = ONumber.create(Integer.class, Ops.DateTimeOps.DAY_OF_YEAR, this);
|
||||
}
|
||||
@ -92,7 +92,7 @@ public abstract class EDate<D extends Comparable> extends EDateOrTime<D> {
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public ENumber<Integer> getMonth(){
|
||||
public ENumber<Integer> month(){
|
||||
if (month == null){
|
||||
month = ONumber.create(Integer.class, Ops.DateTimeOps.MONTH, this);
|
||||
}
|
||||
@ -104,7 +104,7 @@ public abstract class EDate<D extends Comparable> extends EDateOrTime<D> {
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public ENumber<Integer> getWeek() {
|
||||
public ENumber<Integer> week() {
|
||||
if (week == null){
|
||||
week = ONumber.create(Integer.class, Ops.DateTimeOps.WEEK, this);
|
||||
}
|
||||
@ -116,7 +116,7 @@ public abstract class EDate<D extends Comparable> extends EDateOrTime<D> {
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public ENumber<Integer> getYear(){
|
||||
public ENumber<Integer> year(){
|
||||
if (year == null){
|
||||
year = ONumber.create(Integer.class, Ops.DateTimeOps.YEAR, this);
|
||||
}
|
||||
@ -128,7 +128,7 @@ public abstract class EDate<D extends Comparable> extends EDateOrTime<D> {
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public ENumber<Integer> getYearMonth(){
|
||||
public ENumber<Integer> yearMonth(){
|
||||
if (yearMonth == null){
|
||||
yearMonth = ONumber.create(Integer.class, Ops.DateTimeOps.YEAR_MONTH, this);
|
||||
}
|
||||
|
||||
@ -38,37 +38,37 @@ public class EDateConst extends EDate<java.sql.Date> implements Constant<java.sq
|
||||
}
|
||||
|
||||
@Override
|
||||
public ENumber<Integer> getDayOfMonth(){
|
||||
public ENumber<Integer> dayOfMonth(){
|
||||
return ENumberConst.create(calendar.get(Calendar.DAY_OF_MONTH));
|
||||
}
|
||||
|
||||
@Override
|
||||
public ENumber<Integer> getMonth(){
|
||||
public ENumber<Integer> month(){
|
||||
return ENumberConst.create(calendar.get(Calendar.MONTH) + 1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ENumber<Integer> getYear(){
|
||||
public ENumber<Integer> year(){
|
||||
return ENumberConst.create(calendar.get(Calendar.YEAR));
|
||||
}
|
||||
|
||||
@Override
|
||||
public ENumber<Integer> getYearMonth(){
|
||||
public ENumber<Integer> yearMonth(){
|
||||
return ENumberConst.create(calendar.get(Calendar.YEAR) * 100 + calendar.get(Calendar.MONTH) + 1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ENumber<Integer> getDayOfWeek() {
|
||||
public ENumber<Integer> dayOfWeek() {
|
||||
return ENumberConst.create(calendar.get(Calendar.DAY_OF_WEEK));
|
||||
}
|
||||
|
||||
@Override
|
||||
public ENumber<Integer> getDayOfYear() {
|
||||
public ENumber<Integer> dayOfYear() {
|
||||
return ENumberConst.create(calendar.get(Calendar.DAY_OF_YEAR));
|
||||
}
|
||||
|
||||
@Override
|
||||
public ENumber<Integer> getWeek() {
|
||||
public ENumber<Integer> week() {
|
||||
return ENumberConst.create(calendar.get(Calendar.WEEK_OF_YEAR));
|
||||
}
|
||||
|
||||
|
||||
@ -74,7 +74,7 @@ public abstract class EDateTime<D extends Comparable> extends EDateOrTime<D> {
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public ENumber<Integer> getDayOfMonth(){
|
||||
public ENumber<Integer> dayOfMonth(){
|
||||
if (dayOfMonth == null){
|
||||
dayOfMonth = ONumber.create(Integer.class, Ops.DateTimeOps.DAY_OF_MONTH, this);
|
||||
}
|
||||
@ -87,7 +87,7 @@ public abstract class EDateTime<D extends Comparable> extends EDateOrTime<D> {
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public ENumber<Integer> getDayOfWeek() {
|
||||
public ENumber<Integer> dayOfWeek() {
|
||||
if (dayOfWeek == null){
|
||||
dayOfWeek = ONumber.create(Integer.class, Ops.DateTimeOps.DAY_OF_WEEK, this);
|
||||
}
|
||||
@ -100,7 +100,7 @@ public abstract class EDateTime<D extends Comparable> extends EDateOrTime<D> {
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public ENumber<Integer> getDayOfYear() {
|
||||
public ENumber<Integer> dayOfYear() {
|
||||
if (dayOfYear == null){
|
||||
dayOfYear = ONumber.create(Integer.class, Ops.DateTimeOps.DAY_OF_YEAR, this);
|
||||
}
|
||||
@ -112,7 +112,7 @@ public abstract class EDateTime<D extends Comparable> extends EDateOrTime<D> {
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public ENumber<Integer> getHour(){
|
||||
public ENumber<Integer> hour(){
|
||||
if (hours == null){
|
||||
hours = ONumber.create(Integer.class, Ops.DateTimeOps.HOUR, this);
|
||||
}
|
||||
@ -125,7 +125,7 @@ public abstract class EDateTime<D extends Comparable> extends EDateOrTime<D> {
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public ENumber<Integer> getMilliSecond(){
|
||||
public ENumber<Integer> milliSecond(){
|
||||
if (milliseconds == null){
|
||||
milliseconds = ONumber.create(Integer.class, Ops.DateTimeOps.MILLISECOND, this);
|
||||
}
|
||||
@ -137,7 +137,7 @@ public abstract class EDateTime<D extends Comparable> extends EDateOrTime<D> {
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public ENumber<Integer> getMinute(){
|
||||
public ENumber<Integer> minute(){
|
||||
if (minutes == null){
|
||||
minutes = ONumber.create(Integer.class, Ops.DateTimeOps.MINUTE, this);
|
||||
}
|
||||
@ -149,7 +149,7 @@ public abstract class EDateTime<D extends Comparable> extends EDateOrTime<D> {
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public ENumber<Integer> getMonth(){
|
||||
public ENumber<Integer> month(){
|
||||
if (month == null){
|
||||
month = ONumber.create(Integer.class, Ops.DateTimeOps.MONTH, this);
|
||||
}
|
||||
@ -161,7 +161,7 @@ public abstract class EDateTime<D extends Comparable> extends EDateOrTime<D> {
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public ENumber<Integer> getSecond(){
|
||||
public ENumber<Integer> second(){
|
||||
if (seconds == null){
|
||||
seconds = ONumber.create(Integer.class, Ops.DateTimeOps.SECOND, this);
|
||||
}
|
||||
@ -174,7 +174,7 @@ public abstract class EDateTime<D extends Comparable> extends EDateOrTime<D> {
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public ENumber<Integer> getWeek() {
|
||||
public ENumber<Integer> week() {
|
||||
if (week == null){
|
||||
week = ONumber.create(Integer.class, Ops.DateTimeOps.WEEK, this);
|
||||
}
|
||||
@ -186,7 +186,7 @@ public abstract class EDateTime<D extends Comparable> extends EDateOrTime<D> {
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public ENumber<Integer> getYear(){
|
||||
public ENumber<Integer> year(){
|
||||
if (year == null){
|
||||
year = ONumber.create(Integer.class, Ops.DateTimeOps.YEAR, this);
|
||||
}
|
||||
@ -198,7 +198,7 @@ public abstract class EDateTime<D extends Comparable> extends EDateOrTime<D> {
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public ENumber<Integer> getYearMonth(){
|
||||
public ENumber<Integer> yearMonth(){
|
||||
if (yearMonth == null){
|
||||
yearMonth = ONumber.create(Integer.class, Ops.DateTimeOps.YEAR_MONTH, this);
|
||||
}
|
||||
|
||||
@ -38,57 +38,57 @@ public class EDateTimeConst extends EDateTime<java.util.Date> implements Constan
|
||||
}
|
||||
|
||||
@Override
|
||||
public ENumber<Integer> getDayOfMonth(){
|
||||
public ENumber<Integer> dayOfMonth(){
|
||||
return ENumberConst.create(calendar.get(Calendar.DAY_OF_MONTH));
|
||||
}
|
||||
|
||||
@Override
|
||||
public ENumber<Integer> getMonth(){
|
||||
public ENumber<Integer> month(){
|
||||
return ENumberConst.create(calendar.get(Calendar.MONTH) + 1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ENumber<Integer> getYear(){
|
||||
public ENumber<Integer> year(){
|
||||
return ENumberConst.create(calendar.get(Calendar.YEAR));
|
||||
}
|
||||
|
||||
@Override
|
||||
public ENumber<Integer> getYearMonth(){
|
||||
public ENumber<Integer> yearMonth(){
|
||||
return ENumberConst.create(calendar.get(Calendar.YEAR) * 100 + calendar.get(Calendar.MONTH) + 1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ENumber<Integer> getDayOfWeek() {
|
||||
public ENumber<Integer> dayOfWeek() {
|
||||
return ENumberConst.create(calendar.get(Calendar.DAY_OF_WEEK));
|
||||
}
|
||||
|
||||
@Override
|
||||
public ENumber<Integer> getDayOfYear() {
|
||||
public ENumber<Integer> dayOfYear() {
|
||||
return ENumberConst.create(calendar.get(Calendar.DAY_OF_YEAR));
|
||||
}
|
||||
|
||||
@Override
|
||||
public ENumber<Integer> getWeek() {
|
||||
public ENumber<Integer> week() {
|
||||
return ENumberConst.create(calendar.get(Calendar.WEEK_OF_YEAR));
|
||||
}
|
||||
|
||||
@Override
|
||||
public ENumber<Integer> getHour() {
|
||||
public ENumber<Integer> hour() {
|
||||
return ENumberConst.create(calendar.get(Calendar.HOUR_OF_DAY));
|
||||
}
|
||||
|
||||
@Override
|
||||
public ENumber<Integer> getMinute() {
|
||||
public ENumber<Integer> minute() {
|
||||
return ENumberConst.create(calendar.get(Calendar.MINUTE));
|
||||
}
|
||||
|
||||
@Override
|
||||
public ENumber<Integer> getSecond() {
|
||||
public ENumber<Integer> second() {
|
||||
return ENumberConst.create(calendar.get(Calendar.SECOND));
|
||||
}
|
||||
|
||||
@Override
|
||||
public ENumber<Integer> getMilliSecond() {
|
||||
public ENumber<Integer> milliSecond() {
|
||||
return ENumberConst.create(calendar.get(Calendar.MILLISECOND));
|
||||
}
|
||||
|
||||
|
||||
@ -34,7 +34,7 @@ public abstract class ETime<D extends Comparable> extends EDateOrTime<D> {
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public ENumber<Integer> getHour(){
|
||||
public ENumber<Integer> hour(){
|
||||
if (hours == null){
|
||||
hours = ONumber.create(Integer.class, Ops.DateTimeOps.HOUR, this);
|
||||
}
|
||||
@ -46,7 +46,7 @@ public abstract class ETime<D extends Comparable> extends EDateOrTime<D> {
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public ENumber<Integer> getMinute(){
|
||||
public ENumber<Integer> minute(){
|
||||
if (minutes == null){
|
||||
minutes = ONumber.create(Integer.class, Ops.DateTimeOps.MINUTE, this);
|
||||
}
|
||||
@ -58,7 +58,7 @@ public abstract class ETime<D extends Comparable> extends EDateOrTime<D> {
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public ENumber<Integer> getSecond(){
|
||||
public ENumber<Integer> second(){
|
||||
if (seconds == null){
|
||||
seconds = ONumber.create(Integer.class, Ops.DateTimeOps.SECOND, this);
|
||||
}
|
||||
@ -72,7 +72,7 @@ public abstract class ETime<D extends Comparable> extends EDateOrTime<D> {
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public ENumber<Integer> getMilliSecond(){
|
||||
public ENumber<Integer> milliSecond(){
|
||||
if (milliseconds == null){
|
||||
milliseconds = ONumber.create(Integer.class, Ops.DateTimeOps.MILLISECOND, this);
|
||||
}
|
||||
|
||||
@ -38,22 +38,22 @@ public class ETimeConst extends ETime<java.sql.Time> implements Constant<java.sq
|
||||
}
|
||||
|
||||
@Override
|
||||
public ENumber<Integer> getHour() {
|
||||
public ENumber<Integer> hour() {
|
||||
return ENumberConst.create(calendar.get(Calendar.HOUR_OF_DAY));
|
||||
}
|
||||
|
||||
@Override
|
||||
public ENumber<Integer> getMinute() {
|
||||
public ENumber<Integer> minute() {
|
||||
return ENumberConst.create(calendar.get(Calendar.MINUTE));
|
||||
}
|
||||
|
||||
@Override
|
||||
public ENumber<Integer> getSecond() {
|
||||
public ENumber<Integer> second() {
|
||||
return ENumberConst.create(calendar.get(Calendar.SECOND));
|
||||
}
|
||||
|
||||
@Override
|
||||
public ENumber<Integer> getMilliSecond() {
|
||||
public ENumber<Integer> milliSecond() {
|
||||
return ENumberConst.create(calendar.get(Calendar.MILLISECOND));
|
||||
}
|
||||
|
||||
|
||||
@ -88,9 +88,9 @@ public class Filters {
|
||||
<A extends Comparable> Collection<EBoolean> date(EDate<A> expr, EDate<A> other, A knownValue){
|
||||
List<EBoolean> rv = new ArrayList<EBoolean>();
|
||||
rv.addAll(comparable(expr, other, knownValue));
|
||||
rv.add(expr.getDayOfMonth().eq(other.getDayOfMonth()));
|
||||
rv.add(expr.getMonth().eq(other.getMonth()));
|
||||
rv.add(expr.getYear().eq(other.getYear()));
|
||||
rv.add(expr.dayOfMonth().eq(other.dayOfMonth()));
|
||||
rv.add(expr.month().eq(other.month()));
|
||||
rv.add(expr.year().eq(other.year()));
|
||||
return rv;
|
||||
}
|
||||
|
||||
@ -99,25 +99,25 @@ public class Filters {
|
||||
<A extends Comparable> Collection<EBoolean> dateTime(EDateTime<A> expr, EDateTime<A> other, A knownValue){
|
||||
List<EBoolean> rv = new ArrayList<EBoolean>();
|
||||
rv.addAll(comparable(expr, other, knownValue));
|
||||
rv.add(expr.getDayOfMonth().eq(1));
|
||||
rv.add(expr.getDayOfMonth().eq(other.getDayOfMonth()));
|
||||
rv.add(expr.dayOfMonth().eq(1));
|
||||
rv.add(expr.dayOfMonth().eq(other.dayOfMonth()));
|
||||
|
||||
rv.add(expr.getMonth().eq(1));
|
||||
rv.add(expr.getMonth().eq(other.getMonth()));
|
||||
rv.add(expr.month().eq(1));
|
||||
rv.add(expr.month().eq(other.month()));
|
||||
|
||||
rv.add(expr.getYear().eq(2000));
|
||||
rv.add(expr.getYear().eq(other.getYear()));
|
||||
rv.add(expr.year().eq(2000));
|
||||
rv.add(expr.year().eq(other.year()));
|
||||
|
||||
rv.add(expr.getYearMonth().eq(other.getYearMonth()));
|
||||
rv.add(expr.yearMonth().eq(other.yearMonth()));
|
||||
|
||||
rv.add(expr.getHour().eq(1));
|
||||
rv.add(expr.getHour().eq(other.getHour()));
|
||||
rv.add(expr.hour().eq(1));
|
||||
rv.add(expr.hour().eq(other.hour()));
|
||||
|
||||
rv.add(expr.getMinute().eq(1));
|
||||
rv.add(expr.getMinute().eq(other.getMinute()));
|
||||
rv.add(expr.minute().eq(1));
|
||||
rv.add(expr.minute().eq(other.minute()));
|
||||
|
||||
rv.add(expr.getSecond().eq(1));
|
||||
rv.add(expr.getSecond().eq(other.getSecond()));
|
||||
rv.add(expr.second().eq(1));
|
||||
rv.add(expr.second().eq(other.second()));
|
||||
return rv;
|
||||
}
|
||||
|
||||
@ -260,9 +260,9 @@ public class Filters {
|
||||
<A extends Comparable> Collection<EBoolean> time(ETime<A> expr, ETime<A> other, A knownValue){
|
||||
List<EBoolean> rv = new ArrayList<EBoolean>();
|
||||
rv.addAll(comparable(expr, other, knownValue));
|
||||
rv.add(expr.getHour().eq(other.getHour()));
|
||||
rv.add(expr.getMinute().eq(other.getMinute()));
|
||||
rv.add(expr.getSecond().eq(other.getSecond()));
|
||||
rv.add(expr.hour().eq(other.hour()));
|
||||
rv.add(expr.minute().eq(other.minute()));
|
||||
rv.add(expr.second().eq(other.second()));
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
||||
@ -70,17 +70,17 @@ public class MatchingFilters {
|
||||
Collection<EBoolean> date(EDate<java.sql.Date> expr, EDate<java.sql.Date> other){
|
||||
HashSet<EBoolean> rv = new HashSet<EBoolean>();
|
||||
rv.addAll(comparable(expr, other));
|
||||
rv.add(expr.getDayOfMonth().eq(other.getDayOfMonth()));
|
||||
rv.add(expr.dayOfMonth().eq(other.dayOfMonth()));
|
||||
|
||||
if (!target.equals(Target.DERBY) && !module.equals(Module.JDOQL)){
|
||||
rv.add(expr.getDayOfWeek().eq(other.getDayOfWeek ()));
|
||||
rv.add(expr.getDayOfYear().eq(other.getDayOfYear()));
|
||||
rv.add(expr.getWeek().eq(other.getWeek()));
|
||||
rv.add(expr.dayOfWeek().eq(other.dayOfWeek ()));
|
||||
rv.add(expr.dayOfYear().eq(other.dayOfYear()));
|
||||
rv.add(expr.week().eq(other.week()));
|
||||
}
|
||||
|
||||
rv.add(expr.getMonth().eq(other.getMonth()));
|
||||
rv.add(expr.getYear().eq(other.getYear()));
|
||||
rv.add(expr.getYearMonth().eq(other.getYearMonth()));
|
||||
rv.add(expr.month().eq(other.month()));
|
||||
rv.add(expr.year().eq(other.year()));
|
||||
rv.add(expr.yearMonth().eq(other.yearMonth()));
|
||||
return rv;
|
||||
}
|
||||
|
||||
@ -94,21 +94,21 @@ public class MatchingFilters {
|
||||
Collection<EBoolean> dateTime(EDateTime<java.util.Date> expr, EDateTime<java.util.Date> other){
|
||||
HashSet<EBoolean> rv = new HashSet<EBoolean>();
|
||||
rv.addAll(comparable(expr, other));
|
||||
rv.add(expr.getMilliSecond().eq(other.getMilliSecond()));
|
||||
rv.add(expr.getSecond().eq(other.getSecond()));
|
||||
rv.add(expr.getMinute().eq(other.getMinute()));
|
||||
rv.add(expr.getHour().eq(other.getHour()));
|
||||
rv.add(expr.getDayOfMonth().eq(other.getDayOfMonth()));
|
||||
rv.add(expr.milliSecond().eq(other.milliSecond()));
|
||||
rv.add(expr.second().eq(other.second()));
|
||||
rv.add(expr.minute().eq(other.minute()));
|
||||
rv.add(expr.hour().eq(other.hour()));
|
||||
rv.add(expr.dayOfMonth().eq(other.dayOfMonth()));
|
||||
|
||||
if (!target.equals(Target.DERBY) && !module.equals(Module.JDOQL)){
|
||||
rv.add(expr.getDayOfWeek().eq(other.getDayOfWeek ()));
|
||||
rv.add(expr.getDayOfYear().eq(other.getDayOfYear()));
|
||||
rv.add(expr.getWeek().eq(other.getWeek()));
|
||||
rv.add(expr.dayOfWeek().eq(other.dayOfWeek ()));
|
||||
rv.add(expr.dayOfYear().eq(other.dayOfYear()));
|
||||
rv.add(expr.week().eq(other.week()));
|
||||
}
|
||||
|
||||
rv.add(expr.getMonth().eq(other.getMonth()));
|
||||
rv.add(expr.getYear().eq(other.getYear()));
|
||||
rv.add(expr.getYearMonth().eq(other.getYearMonth()));
|
||||
rv.add(expr.month().eq(other.month()));
|
||||
rv.add(expr.year().eq(other.year()));
|
||||
rv.add(expr.yearMonth().eq(other.yearMonth()));
|
||||
return rv;
|
||||
}
|
||||
|
||||
@ -247,10 +247,10 @@ public class MatchingFilters {
|
||||
Collection<EBoolean> time(ETime<java.sql.Time> expr, ETime<java.sql.Time> other){
|
||||
HashSet<EBoolean> rv = new HashSet<EBoolean>();
|
||||
rv.addAll(comparable(expr, other));
|
||||
rv.add(expr.getMilliSecond().eq(other.getMilliSecond()));
|
||||
rv.add(expr.getSecond().eq(other.getSecond()));
|
||||
rv.add(expr.getMinute().eq(other.getMinute()));
|
||||
rv.add(expr.getHour().eq(other.getHour()));
|
||||
rv.add(expr.milliSecond().eq(other.milliSecond()));
|
||||
rv.add(expr.second().eq(other.second()));
|
||||
rv.add(expr.minute().eq(other.minute()));
|
||||
rv.add(expr.hour().eq(other.hour()));
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
||||
@ -54,23 +54,23 @@ public class Projections {
|
||||
@SuppressWarnings("unchecked")
|
||||
<A extends Comparable> Collection<Expr<?>> date(EDate<A> expr, EDate<A> other, A knownValue){
|
||||
HashSet<Expr<?>> rv = new HashSet<Expr<?>>();
|
||||
rv.add(expr.getDayOfMonth());
|
||||
rv.add(expr.getMonth());
|
||||
rv.add(expr.getYear());
|
||||
rv.add(expr.getYearMonth());
|
||||
rv.add(expr.dayOfMonth());
|
||||
rv.add(expr.month());
|
||||
rv.add(expr.year());
|
||||
rv.add(expr.yearMonth());
|
||||
return rv;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
<A extends Comparable> Collection<Expr<?>> dateTime(EDateTime<A> expr, EDateTime<A> other, A knownValue){
|
||||
HashSet<Expr<?>> rv = new HashSet<Expr<?>>();
|
||||
rv.add(expr.getDayOfMonth());
|
||||
rv.add(expr.getMonth());
|
||||
rv.add(expr.getYear());
|
||||
rv.add(expr.getYearMonth());
|
||||
rv.add(expr.getHour());
|
||||
rv.add(expr.getMinute());
|
||||
rv.add(expr.getSecond());
|
||||
rv.add(expr.dayOfMonth());
|
||||
rv.add(expr.month());
|
||||
rv.add(expr.year());
|
||||
rv.add(expr.yearMonth());
|
||||
rv.add(expr.hour());
|
||||
rv.add(expr.minute());
|
||||
rv.add(expr.second());
|
||||
return rv;
|
||||
}
|
||||
|
||||
@ -191,9 +191,9 @@ public class Projections {
|
||||
@SuppressWarnings("unchecked")
|
||||
<A extends Comparable> Collection<Expr<?>> time(ETime<A> expr, ETime<A> other, A knownValue){
|
||||
HashSet<Expr<?>> rv = new HashSet<Expr<?>>();
|
||||
rv.add(expr.getHour());
|
||||
rv.add(expr.getMinute());
|
||||
rv.add(expr.getSecond());
|
||||
rv.add(expr.hour());
|
||||
rv.add(expr.minute());
|
||||
rv.add(expr.second());
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
||||
@ -24,11 +24,11 @@ public class EDateConstTest {
|
||||
System.out.println(cal.getTime());
|
||||
|
||||
EDate<Date> date = EDateConst.create(new Date(cal.getTimeInMillis()));
|
||||
assertEquals("1", date.getDayOfMonth().toString());
|
||||
assertEquals("1", date.getMonth().toString());
|
||||
assertEquals("2000",date.getYear().toString());
|
||||
assertEquals("7", date.getDayOfWeek().toString());
|
||||
assertEquals("1", date.getDayOfYear().toString());
|
||||
assertEquals("1", date.dayOfMonth().toString());
|
||||
assertEquals("1", date.month().toString());
|
||||
assertEquals("2000",date.year().toString());
|
||||
assertEquals("7", date.dayOfWeek().toString());
|
||||
assertEquals("1", date.dayOfYear().toString());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -27,15 +27,15 @@ public class EDateTimeConstTest {
|
||||
System.out.println(cal.getTime());
|
||||
|
||||
EDateTime<Date> date = EDateTimeConst.create(cal.getTime());
|
||||
assertEquals("1", date.getDayOfMonth().toString());
|
||||
assertEquals("1", date.getMonth().toString());
|
||||
assertEquals("2000", date.getYear().toString());
|
||||
assertEquals("7", date.getDayOfWeek().toString());
|
||||
assertEquals("1", date.getDayOfYear().toString());
|
||||
assertEquals("13", date.getHour().toString());
|
||||
assertEquals("30", date.getMinute().toString());
|
||||
assertEquals("12", date.getSecond().toString());
|
||||
assertEquals("3", date.getMilliSecond().toString());
|
||||
assertEquals("1", date.dayOfMonth().toString());
|
||||
assertEquals("1", date.month().toString());
|
||||
assertEquals("2000", date.year().toString());
|
||||
assertEquals("7", date.dayOfWeek().toString());
|
||||
assertEquals("1", date.dayOfYear().toString());
|
||||
assertEquals("13", date.hour().toString());
|
||||
assertEquals("30", date.minute().toString());
|
||||
assertEquals("12", date.second().toString());
|
||||
assertEquals("3", date.milliSecond().toString());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -24,9 +24,9 @@ public class ETimeConstTest {
|
||||
System.out.println(cal.getTime());
|
||||
|
||||
ETime<Time> time = ETimeConst.create(new Time(cal.getTimeInMillis()));
|
||||
assertEquals("13", time.getHour().toString());
|
||||
assertEquals("30", time.getMinute().toString());
|
||||
assertEquals("12", time.getSecond().toString());
|
||||
assertEquals("13", time.hour().toString());
|
||||
assertEquals("30", time.minute().toString());
|
||||
assertEquals("12", time.second().toString());
|
||||
// assertEquals("3", time.getMilliSecond().toString());
|
||||
}
|
||||
|
||||
|
||||
@ -21,12 +21,12 @@ public class DateTimeTest extends AbstractQueryTest {
|
||||
toString("current_time()", ETime.currentTime());
|
||||
toString("current_timestamp()", EDateTime.currentTimestamp());
|
||||
// second(...), minute(...), hour(...), day(...), month(...), year(...),
|
||||
catalog.effectiveDate.getSecond();
|
||||
catalog.effectiveDate.getMinute();
|
||||
catalog.effectiveDate.getHour();
|
||||
catalog.effectiveDate.getDayOfMonth();
|
||||
catalog.effectiveDate.getMonth();
|
||||
catalog.effectiveDate.getYear();
|
||||
catalog.effectiveDate.second();
|
||||
catalog.effectiveDate.minute();
|
||||
catalog.effectiveDate.hour();
|
||||
catalog.effectiveDate.dayOfMonth();
|
||||
catalog.effectiveDate.month();
|
||||
catalog.effectiveDate.year();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user