Package oracle.kv.table
Class FieldRange
- java.lang.Object
-
- oracle.kv.table.FieldRange
-
- All Implemented Interfaces:
java.lang.Cloneable,oracle.kv.impl.util.FastExternalizable
public class FieldRange extends java.lang.Object implements oracle.kv.impl.util.FastExternalizable, java.lang.CloneableFieldRange defines a range of values to be used in a table or index iteration or multiGet operation. A FieldRange is used as the least significant component in a partially specifiedPrimaryKeyorIndexKeyin order to create a value range for an operation that returns multiple rows or keys. The data types supported by FieldRange are limited to those which are valid for primary keys and/or index keys, as indicated byFieldDef.isValidKeyField()andFieldDef.isValidIndexField().This object is used to scope a table or index operation and is constructed by
Table.createFieldRange(java.lang.String)andIndex.createFieldRange(java.lang.String). If used on a table the field referenced must be part of the table's primary key and be in proper order relative to the parent value. If used on an index the field must be part of the index definition and in proper order relative to the index definition.The fieldPath used in FieldRange construction must be one of the strings returned from
PrimaryKey.getFields()orIndexKey.getFields(), respectively.- Since:
- 3.0
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleancheck()FieldRangeclone()Creates a new FieldRange instance that is a shallow copy of this instance.MultiRowOptionscreateMultiRowOptions()A convenience factory method to create a MultiRowOptions instance using this FieldRange.booleanequals(java.lang.Object obj)FieldDefgetDefinition()Returns the FieldDef for the field used in the range.FieldValuegetEnd()Returns the FieldValue that defines upper bound of the range, or null if no upper bound is enforced.booleangetEndInclusive()Returns whether end is included in the range, i.e., end is greater than or equal to the last FieldValue in the range.FieldDefgetField()Returns the FieldDef that was used to construct this object.java.lang.StringgetFieldName()Returns the name for the field used in the range.FieldValuegetStart()Returns the FieldValue that defines lower bound of the range, or null if no lower bound is enforced.booleangetStartInclusive()Returns whether start is included in the range, i.e., start is less than or equal to the first FieldValue in the range.intgetStorageSize()inthashCode()FieldRangesetEnd(double value, boolean isInclusive)Sets the end value of the range to the specified double value.FieldRangesetEnd(float value, boolean isInclusive)Sets the end value of the range to the specified float value.FieldRangesetEnd(int value, boolean isInclusive)Sets the end value of the range to the specified integer value.FieldRangesetEnd(long value, boolean isInclusive)Sets the end value of the range to the specified long value.FieldRangesetEnd(java.lang.String value, boolean isInclusive)Sets the end value of the range to the specified string value.FieldRangesetEnd(java.math.BigDecimal value, boolean isInclusive)Sets the end value of the range to the specified BigDecimal value.FieldRangesetEnd(java.sql.Timestamp value, boolean isInclusive)Sets the end value of the range to the specified timestamp value.FieldRangesetEnd(FieldValue value, boolean isInclusive)Sets the end value of the range to the specified value.FieldRangesetEnd(FieldValue value, boolean isInclusive, boolean validate)FieldRangesetEndEnum(java.lang.String value, boolean isInclusive)Sets the end value of the range to the specified enumeration value.FieldRangesetStart(double value, boolean isInclusive)Sets the start value of the range to the specified double value.FieldRangesetStart(float value, boolean isInclusive)Sets the start value of the range to the specified float value.FieldRangesetStart(int value, boolean isInclusive)Sets the start value of the range to the specified integer value.FieldRangesetStart(long value, boolean isInclusive)Sets the start value of the range to the specified long value.FieldRangesetStart(java.lang.String value, boolean isInclusive)Sets the start value of the range to the specified string value.FieldRangesetStart(java.math.BigDecimal value, boolean isInclusive)Sets the start value of the range to the specified BigDecimal value.FieldRangesetStart(java.sql.Timestamp value, boolean isInclusive)Sets the start value of the range to the specified timestamp value.FieldRangesetStart(FieldValue value, boolean isInclusive)Sets the start value of the range to the specified value.FieldRangesetStart(FieldValue value, boolean isInclusive, boolean validate)FieldRangesetStartEnum(java.lang.String value, boolean isInclusive)Sets the start value of the range to the specified enumeration value.FieldRangesetStartValue(FieldValue value, boolean isInclusive)java.lang.StringtoString()
-
-
-
Method Detail
-
clone
public FieldRange clone()
Creates a new FieldRange instance that is a shallow copy of this instance.- Overrides:
clonein classjava.lang.Object
-
createMultiRowOptions
public MultiRowOptions createMultiRowOptions()
A convenience factory method to create a MultiRowOptions instance using this FieldRange.- Returns:
- a new MultiRowOptions
-
getField
public FieldDef getField()
Returns the FieldDef that was used to construct this object. If this FieldRange is being used in an index and the indexed field is an array the definition of the indexed element is returned and not the array definition.- Returns:
- the FieldDef
-
getStart
public FieldValue getStart()
Returns the FieldValue that defines lower bound of the range, or null if no lower bound is enforced.- Returns:
- the start FieldValue
-
getStartInclusive
public boolean getStartInclusive()
Returns whether start is included in the range, i.e., start is less than or equal to the first FieldValue in the range. This value is valid only if the start value is not null.- Returns:
- true if the start value is inclusive
-
getEnd
public FieldValue getEnd()
Returns the FieldValue that defines upper bound of the range, or null if no upper bound is enforced.- Returns:
- the end FieldValue
-
getEndInclusive
public boolean getEndInclusive()
Returns whether end is included in the range, i.e., end is greater than or equal to the last FieldValue in the range. This value is valid only if the end value is not null.- Returns:
- true if the end value is inclusive
-
getDefinition
public FieldDef getDefinition()
Returns the FieldDef for the field used in the range.- Returns:
- the FieldDef
-
getFieldName
public java.lang.String getFieldName()
Returns the name for the field used in the range.- Returns:
- the name of the field
-
setStart
public FieldRange setStart(int value, boolean isInclusive)
Sets the start value of the range to the specified integer value.- Parameters:
value- the value to setisInclusive- set to true if the range is inclusive of the value, false if it is exclusive.- Returns:
- this
- Throws:
java.lang.IllegalArgumentException- if the value is not valid for the field in the range.
-
setStart
public FieldRange setStart(double value, boolean isInclusive)
Sets the start value of the range to the specified double value.- Parameters:
value- the value to setisInclusive- set to true if the range is inclusive of the value, false if it is exclusive.- Returns:
- this
- Throws:
java.lang.IllegalArgumentException- if the value is not valid for the field in the range.
-
setStart
public FieldRange setStart(float value, boolean isInclusive)
Sets the start value of the range to the specified float value.- Parameters:
value- the value to setisInclusive- set to true if the range is inclusive of the value, false if it is exclusive.- Returns:
- this
- Throws:
java.lang.IllegalArgumentException- if the value is not valid for the field in the range.
-
setStart
public FieldRange setStart(long value, boolean isInclusive)
Sets the start value of the range to the specified long value.- Parameters:
value- the value to setisInclusive- set to true if the range is inclusive of the value, false if it is exclusive.- Returns:
- this
- Throws:
java.lang.IllegalArgumentException- if the value is not valid for the field in the range.
-
setStart
public FieldRange setStart(java.lang.String value, boolean isInclusive)
Sets the start value of the range to the specified string value.- Parameters:
value- the value to setisInclusive- set to true if the range is inclusive of the value, false if it is exclusive.- Returns:
- this
- Throws:
java.lang.IllegalArgumentException- if the value is not valid for the field in the range.
-
setStartEnum
public FieldRange setStartEnum(java.lang.String value, boolean isInclusive)
Sets the start value of the range to the specified enumeration value.- Parameters:
value- the value to setisInclusive- set to true if the range is inclusive of the value, false if it is exclusive.- Returns:
- this
- Throws:
java.lang.IllegalArgumentException- if the value is not valid for the field in the range.
-
setStart
public FieldRange setStart(java.sql.Timestamp value, boolean isInclusive)
Sets the start value of the range to the specified timestamp value.- Parameters:
value- the value to setisInclusive- set to true if the range is inclusive of the value, false if it is exclusive.- Returns:
- this
- Throws:
java.lang.IllegalArgumentException- if the value is not valid for the field in the range.- Since:
- 4.3
-
setStart
public FieldRange setStart(java.math.BigDecimal value, boolean isInclusive)
Sets the start value of the range to the specified BigDecimal value.- Parameters:
value- the value to setisInclusive- set to true if the range is inclusive of the value, false if it is exclusive.- Returns:
- this
- Throws:
java.lang.IllegalArgumentException- if the value is not valid for the field in the range.- Since:
- 4.4
-
setEnd
public FieldRange setEnd(int value, boolean isInclusive)
Sets the end value of the range to the specified integer value.- Parameters:
value- the value to setisInclusive- set to true if the range is inclusive of the value, false if it is exclusive.- Returns:
- this
- Throws:
java.lang.IllegalArgumentException- if the value is not valid for the field in the range.
-
setEnd
public FieldRange setEnd(double value, boolean isInclusive)
Sets the end value of the range to the specified double value.- Parameters:
value- the value to setisInclusive- set to true if the range is inclusive of the value, false if it is exclusive.- Returns:
- this
- Throws:
java.lang.IllegalArgumentException- if the value is not valid for the field in the range.
-
setEnd
public FieldRange setEnd(float value, boolean isInclusive)
Sets the end value of the range to the specified float value.- Parameters:
value- the value to setisInclusive- set to true if the range is inclusive of the value, false if it is exclusive.- Returns:
- this
- Throws:
java.lang.IllegalArgumentException- if the value is not valid for the field in the range.
-
setEnd
public FieldRange setEnd(long value, boolean isInclusive)
Sets the end value of the range to the specified long value.- Parameters:
value- the value to setisInclusive- set to true if the range is inclusive of the value, false if it is exclusive.- Returns:
- this
- Throws:
java.lang.IllegalArgumentException- if the value is not valid for the field in the range.
-
setEnd
public FieldRange setEnd(java.lang.String value, boolean isInclusive)
Sets the end value of the range to the specified string value.- Parameters:
value- the value to setisInclusive- set to true if the range is inclusive of the value, false if it is exclusive.- Returns:
- this
- Throws:
java.lang.IllegalArgumentException- if the value is not valid for the field in the range.
-
setEndEnum
public FieldRange setEndEnum(java.lang.String value, boolean isInclusive)
Sets the end value of the range to the specified enumeration value.- Parameters:
value- the value to setisInclusive- set to true if the range is inclusive of the value, false if it is exclusive.- Returns:
- this
- Throws:
java.lang.IllegalArgumentException- if the value is not valid for the field in the range.
-
setEnd
public FieldRange setEnd(java.sql.Timestamp value, boolean isInclusive)
Sets the end value of the range to the specified timestamp value.- Parameters:
value- the value to setisInclusive- set to true if the range is inclusive of the value, false if it is exclusive.- Returns:
- this
- Throws:
java.lang.IllegalArgumentException- if the value is not valid for the field in the range.- Since:
- 4.3
-
setEnd
public FieldRange setEnd(java.math.BigDecimal value, boolean isInclusive)
Sets the end value of the range to the specified BigDecimal value.- Parameters:
value- the value to setisInclusive- set to true if the range is inclusive of the value, false if it is exclusive.- Returns:
- this
- Throws:
java.lang.IllegalArgumentException- if the value is not valid for the field in the range.- Since:
- 4.4
-
setStart
public FieldRange setStart(FieldValue value, boolean isInclusive)
Sets the start value of the range to the specified value.- Parameters:
value- the value to setisInclusive- set to true if the range is inclusive of the value, false if it is exclusive.- Returns:
- this
- Throws:
java.lang.IllegalArgumentException- if the value is not valid for the field in the range.
-
setEnd
public FieldRange setEnd(FieldValue value, boolean isInclusive)
Sets the end value of the range to the specified value.- Parameters:
value- the value to setisInclusive- set to true if the range is inclusive of the value, false if it is exclusive.- Returns:
- this
- Throws:
java.lang.IllegalArgumentException- if the value is not valid for the field in the range.
-
setStart
public FieldRange setStart(FieldValue value, boolean isInclusive, boolean validate)
-
setEnd
public FieldRange setEnd(FieldValue value, boolean isInclusive, boolean validate)
-
setStartValue
public FieldRange setStartValue(FieldValue value, boolean isInclusive)
-
getStorageSize
public int getStorageSize()
-
check
public boolean check()
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equalsin classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCodein classjava.lang.Object
-
-