Java Code Examples for org.jooq.impl.DSL#extract()

The following examples show how to use org.jooq.impl.DSL#extract() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: PgExpressionHandler.java    From FROST-Server with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Override
public FieldWrapper visit(Day node) {
    Expression param = node.getParameters().get(0);
    FieldWrapper input = param.accept(this);
    if (input instanceof TimeFieldWrapper) {
        TimeFieldWrapper timeExpression = (TimeFieldWrapper) input;
        return new SimpleFieldWrapper(DSL.extract(timeExpression.getDateTime(), DatePart.DAY));
    }
    throw new IllegalArgumentException("Day can only be used on times, not on " + input.getClass().getName());
}
 
Example 2
Source File: PgExpressionHandler.java    From FROST-Server with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Override
public FieldWrapper visit(Hour node) {
    Expression param = node.getParameters().get(0);
    FieldWrapper input = param.accept(this);
    if (input instanceof TimeFieldWrapper) {
        TimeFieldWrapper timeExpression = (TimeFieldWrapper) input;
        return new SimpleFieldWrapper(DSL.extract(timeExpression.getDateTime(), DatePart.HOUR));
    }
    throw new IllegalArgumentException("Hour can only be used on times, not on " + input.getClass().getName());
}
 
Example 3
Source File: PgExpressionHandler.java    From FROST-Server with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Override
public FieldWrapper visit(Minute node) {
    Expression param = node.getParameters().get(0);
    FieldWrapper input = param.accept(this);
    if (input instanceof TimeFieldWrapper) {
        TimeFieldWrapper timeExpression = (TimeFieldWrapper) input;
        return new SimpleFieldWrapper(DSL.extract(timeExpression.getDateTime(), DatePart.MINUTE));
    }
    throw new IllegalArgumentException("Minute can only be used on times, not on " + input.getClass().getName());
}
 
Example 4
Source File: PgExpressionHandler.java    From FROST-Server with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Override
public FieldWrapper visit(Month node) {
    Expression param = node.getParameters().get(0);
    FieldWrapper input = param.accept(this);
    if (input instanceof TimeFieldWrapper) {
        TimeFieldWrapper timeExpression = (TimeFieldWrapper) input;
        return new SimpleFieldWrapper(DSL.extract(timeExpression.getDateTime(), DatePart.MONTH));
    }
    throw new IllegalArgumentException("Month can only be used on times, not on " + input.getClass().getName());
}
 
Example 5
Source File: PgExpressionHandler.java    From FROST-Server with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Override
public FieldWrapper visit(Second node) {
    Expression param = node.getParameters().get(0);
    FieldWrapper input = param.accept(this);
    if (input instanceof TimeFieldWrapper) {
        TimeFieldWrapper timeExpression = (TimeFieldWrapper) input;
        return new SimpleFieldWrapper(DSL.extract(timeExpression.getDateTime(), DatePart.SECOND));
    }
    throw new IllegalArgumentException("Second can only be used on times, not on " + input.getClass().getName());
}
 
Example 6
Source File: PgExpressionHandler.java    From FROST-Server with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Override
public FieldWrapper visit(Year node) {
    Expression param = node.getParameters().get(0);
    FieldWrapper input = param.accept(this);
    if (input instanceof TimeFieldWrapper) {
        TimeFieldWrapper timeExpression = (TimeFieldWrapper) input;
        return new SimpleFieldWrapper(DSL.extract(timeExpression.getDateTime(), DatePart.YEAR));
    }
    throw new IllegalArgumentException("Year can only be used on times, not on " + input.getClass().getName());
}