Package org.eclipse.rdf4j.query.algebra.evaluation.function.xsd

## Class IntegerCastFunction

- java.lang.Object
- - org.eclipse.rdf4j.query.algebra.evaluation.function.xsd.CastFunction
  - - org.eclipse.rdf4j.query.algebra.evaluation.function.xsd.IntegerCastFunction

- All Implemented Interfaces:
    `Function`
  Direct Known Subclasses:
    `ByteCast`, `IntCast`, `IntegerCast`, `LongCast`, `NegativeIntegerCast`, `NonNegativeIntegerCast`, `NonPositiveIntegerCast`, `PositiveIntegerCast`, `ShortCast`, `UnsignedByteCast`, `UnsignedIntCast`, `UnsignedLongCast`, `UnsignedShortCast`

      public abstract class IntegerCastFunction
      extends CastFunction

  Abstract superclass for `CastFunction`s that cast their arguments to an xsd:integer or one of its derived types.
  Author:
    Jeen Broekstra

- - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `IntegerCastFunction()` |

  - ### Method Summary

    All Methods Instance Methods Abstract Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `protected Literal` | `convert​(ValueFactory valueFactory, Value value)` | Convert the supplied value to a literal of the function output datatype.
    `protected Optional<Literal>` | `createTypedLiteral​(ValueFactory vf, boolean booleanValue)` | create a `Literal` with the specific datatype for the supplied boolean value.
    `protected abstract Optional<Literal>` | `createTypedLiteral​(ValueFactory vf, BigInteger integerValue)` | create a `Literal` with the specific datatype for the supplied `BigInteger` value.

    - ### Methods inherited from class org.eclipse.rdf4j.query.algebra.evaluation.function.xsd.CastFunction

      `evaluate, getURI, getXsdDatatype, getXsdName, isValidForDatatype, typeError`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

    - ### Methods inherited from interface org.eclipse.rdf4j.query.algebra.evaluation.function.Function

      `evaluate`

- - ### Constructor Detail

    - #### IntegerCastFunction

          public IntegerCastFunction()

  - ### Method Detail

    - #### convert

          protected Literal convert​(ValueFactory valueFactory,
                                    Value value)
                             throws ValueExprEvaluationException

      Description copied from class: `CastFunction`
      Convert the supplied value to a literal of the function output datatype.
      Specified by:
        `convert` in class `CastFunction`
      Parameters:
        `valueFactory` - the valueFactory to use
        `value` - a value that is not a string-typed literal, and not a literal of the same datatype as the function output datatype.
      Returns:
        a literal value of the function output datatype
      Throws:
        `ValueExprEvaluationException` - if an error occurs in conversion.

    - #### createTypedLiteral

          protected abstract Optional<Literal> createTypedLiteral​(ValueFactory vf,
                                                                  BigInteger integerValue)
                                                           throws ArithmeticException

      create a `Literal` with the specific datatype for the supplied `BigInteger` value.
      Parameters:
        `vf` - the `ValueFactory` to use for creating the `Literal`
        `integerValue` - the integer value to use for creating the `Literal`
      Returns:
        an `Optional` literal value, which may be empty if the supplied integerValue can not be successfully converted to the specific datatype.
      Throws:
        `ArithmeticException` - if an error occurs when attempting to convert the supplied value to a value of the specific datatype.

    - #### createTypedLiteral

          protected Optional<Literal> createTypedLiteral​(ValueFactory vf,
                                                         boolean booleanValue)

      create a `Literal` with the specific datatype for the supplied boolean value.
      Parameters:
        `vf` - the `ValueFactory` to use for creating the `Literal`
        `booleanValue` - the boolean value to use for creating the `Literal`
      Returns:
        an `Optional` literal value, which may be empty if the supplied boolean value can not be successfully converted to the specific datatype.