@Immutable public class Limit extends Object implements LanguageObject, Limit
Constructor and Description |
---|
Limit(int rowLimit)
Create a limit on the number of rows.
|
Limit(int rowLimit,
int offset)
Create a limit on the number of rows and the number of initial rows to skip.
|
Modifier and Type | Method and Description |
---|---|
void |
accept(Visitor visitor)
Accept the supplied visitor, which should call back to the visitor to complete the double-dispatch operation.
|
boolean |
equals(Object obj) |
int |
getOffset()
Get the number of rows skipped before the results begin.
|
int |
getRowLimit()
Get the maximum number of rows that are to be returned.
|
int |
hashCode() |
boolean |
hasRowLimited()
Determine whether this limit clause defines a maximum limit
|
boolean |
isLimitedToSingleRowWithNoOffset() |
boolean |
isOffset()
Determine whether this limit clause defines an offset.
|
boolean |
isUnlimited()
Determine whether this limit clause is necessary.
|
String |
toString() |
Limit |
withOffset(int offset)
Create a new Limit object that contains the same maximum row count as this object but a new offset.
|
Limit |
withRowLimit(int rowLimit)
Create a new Limit object that contains the same offset as this object but a new maximum row count.
|
public static final Limit NONE
public Limit(int rowLimit)
rowLimit
- the maximum number of rowsIllegalArgumentException
- if the row limit is negativepublic Limit(int rowLimit, int offset)
rowLimit
- the maximum number of rowsoffset
- the number of rows to skip before beginning the resultsIllegalArgumentException
- if the row limit is negative, or if the offset is negativepublic final int getOffset()
Limit
public final int getRowLimit()
Limit
getRowLimit
in interface Limit
Integer.MAX_VALUE
if there is no limitpublic final boolean isUnlimited()
Limit
isUnlimited
in interface Limit
public final boolean hasRowLimited()
public final boolean isLimitedToSingleRowWithNoOffset()
public final boolean isOffset()
Limit
public void accept(Visitor visitor)
Visitable
public Limit withRowLimit(int rowLimit)
rowLimit
- the maximum row count for the new Limit objectpublic Limit withOffset(int offset)
offset
- the offset for the new Limit objectCopyright © 2008-2014 JBoss, a division of Red Hat. All Rights Reserved.