Package acdp.design

Class CL

java.lang.Object
acdp.design.CL

public final class CL extends Object
Provides factory methods that return columns of various types.
Author:
Beat Hörmann
  • Method Details

    • ofBoolean

      public static final Column<Boolean> ofBoolean(ST.Nulls nulls)
      Creates a new column of type Boolean. It is safe to cast column.info().type() of the returned column to the BooleanType interface or to the SimpleType class.
      Parameters:
      nulls - Must be set to Nulls.NULLABLE if the type allows the null value, Nulls.NO_NULL if not.
      Returns:
      The created column of type Boolean.
    • ofByte

      public static final Column<Byte> ofByte(ST.Nulls nulls)
      Creates a new column of type Byte. It is safe to cast column.info().type() of the returned column to the ByteType interface or to the SimpleType class.
      Parameters:
      nulls - Must be set to Nulls.NULLABLE if the type allows the null value, Nulls.NO_NULL if not.
      Returns:
      The created column of type Byte.
    • ofShort

      public static final Column<Short> ofShort(ST.Nulls nulls)
      Creates a new column of type Short. It is safe to cast column.getInfo().type() of the returned column to the ShortType interface or to the SimpleType class.
      Parameters:
      nulls - Must be set to Nulls.NULLABLE if the type allows the null value, Nulls.NO_NULL if not.
      Returns:
      The created column of type Short.
    • ofInteger

      public static final Column<Integer> ofInteger(ST.Nulls nulls)
      Creates a new column of type Integer. It is safe to cast column.info().type() of the returned column to the IntegerType interface or to the SimpleType class.
      Parameters:
      nulls - Must be set to Nulls.NULLABLE if the type allows the null value, Nulls.NO_NULL if not.
      Returns:
      The created column of type Integer.
    • ofLong

      public static final Column<Long> ofLong(ST.Nulls nulls)
      Creates a new column of type Long. It is safe to cast column.info().type() of the returned column to the LongType interface or to the SimpleType class.
      Parameters:
      nulls - Must be set to Nulls.NULLABLE if the type allows the null value, Nulls.NO_NULL if not.
      Returns:
      The created column of type Long.
    • ofFloat

      public static final Column<Float> ofFloat(ST.Nulls nulls)
      Creates a new column of type Float. It is safe to cast column.info().type() of the returned column to the FloatType interface or to the SimpleType class.
      Parameters:
      nulls - Must be set to Nulls.NULLABLE if the type allows the null value, Nulls.NO_NULL if not.
      Returns:
      The created column of type Float.
    • ofDouble

      public static final Column<Double> ofDouble(ST.Nulls nulls)
      Creates a new column of type Double. It is safe to cast column.info().type() of the returned column to the DoubleType interface or to the SimpleType class.
      Parameters:
      nulls - Must be set to Nulls.NULLABLE if the type allows the null value, Nulls.NO_NULL if not.
      Returns:
      The created column of type Double.
    • ofString

      public static final Column<String> ofString()
      Creates a new column of type "classic Java" String. It is safe to cast column.info().type() of the returned column to the StringType interface or to the SimpleType class.

      Invoking this method has the same effect as invoking ofString(Nulls.NULLABLE, OutrowStringLength.GIANT).

      Returns:
      The created column of type String.
    • ofString

      public static final Column<String> ofString(ST.Nulls nulls, ST.OutrowStringLength length)
      Creates a new column of type String with an outrow storage scheme and applying the "UTF-8" charset for any byte conversions. It is safe to cast column.info().type() of the returned column to the StringType interface or to the SimpleType class.

      Invoking this method has the same effect as invoking ofString(StandardCharsets.UTF_8, nulls, length).

      Parameters:
      nulls - Must be set to Nulls.NULLABLE if the type allows the null value, Nulls.NO_NULL if not.
      length - The length of the string.
      Returns:
      The created column of type String.
    • ofString

      public static final Column<String> ofString(Charset charset, ST.Nulls nulls, ST.OutrowStringLength length) throws NullPointerException
      Creates a new column of type String with an outrow storage scheme and applying the specified charset for any byte conversions. It is safe to cast column.info().type() of the returned column to the StringType interface or to the SimpleType class.
      Parameters:
      charset - The Charset to be used to encode a string value, not allowed to be null.
      nulls - Must be set to Nulls.NULLABLE if the type allows the null value, Nulls.NO_NULL if not.
      length - The length of the string.
      Returns:
      The created column of type String.
      Throws:
      NullPointerException - If charset is null.
    • ofString

      public static final Column<String> ofString(Charset charset, ST.Nulls nulls, int length) throws NullPointerException, IllegalArgumentException
      Creates a new column of type String with an inrow storage scheme and applying the specified charset for any byte conversions. It is safe to cast column.info().type() of the returned column to the StringType interface or to the SimpleType class.
      Parameters:
      charset - The Charset to be used to encode a string value, not allowed to be null.
      nulls - Must be set to Nulls.NULLABLE if the type allows the null value, Nulls.NO_NULL if not.
      length - The maximum number of characters of the String, must be greater than or equal to 1 and less than or equal to Integer.MAX_VALUE - 4. Depending on the character set the maximum number of characters may be less than this value.
      Returns:
      The created column of type String.
      Throws:
      NullPointerException - If charset is null.
      IllegalArgumentException - If length is less than 1 or greater than Integer.MAX_VALUE - 4.
    • create

      public static final <T> Column<T> create(SimpleType<T> simpleType) throws NullPointerException
      Creates a new column having the specified simple column type.

      This method is typically used if the column type is a custom column type, hence, if the column can't be created with one of the type methods of this class.

      Note that the type of the returned column may not be identical (==) to the specified column type but the type descriptors will be equal (String.equals). This is because ACDP internally treats column types with same type descriptors as singletons.

      Type Parameters:
      T - The type of the column's values.
      Parameters:
      simpleType - The simple column type, not allowed to be null.
      Returns:
      The created column having the specified simple type.
      Throws:
      NullPointerException - If simpleType is null.
    • ofArray

      public static final <T> Column<T[]> ofArray(int maxSize, SimpleType<T> elementType) throws NullPointerException, IllegalArgumentException
      Creates a new column of type array with an outrow storage scheme and with elements of the specified element type. It is safe to cast column.info().type() of the returned column to the ArrayType interface.

      Consider using the ST simple column type factory if the element type should be a built-in simple column type. If you are not using the ST simple column type factory then note that the element type of the returned array column may not be identical (==) to the specified element type but the type descriptors will be equal (String.equals). This is because ACDP internally handles column types with same type descriptors as singletons.

      Invoking this method has the same effect as invoking ofArray(Scheme.OUTROW, maxSize, elementType).

      Type Parameters:
      T - The type of the elements.
      Parameters:
      maxSize - The maximum number of elements in an array value of this array type.
      elementType - The type of the elements of the array, not allowed to be null.
      Returns:
      The created array type column.
      Throws:
      NullPointerException - If elementType is null.
      IllegalArgumentException - If maxSize is less than 1.
    • ofArray

      public static final <T> Column<T[]> ofArray(Type.Scheme scheme, int maxSize, SimpleType<T> elementType) throws NullPointerException, IllegalArgumentException
      Creates a new column of type array with elements of the specified element type. It is safe to cast column.info().type() of the returned column to the ArrayType interface.

      Consider using the ST simple column type factory if the element type should be a built-in simple column type. If you are not using the ST simple column type factory then note that the element type of the returned array column may not be identical (==) to the specified element type but the type descriptors will be equal (String.equals). This is because ACDP internally handles column types with same type descriptors as singletons.

      Type Parameters:
      T - The type of the elements.
      Parameters:
      scheme - The storage scheme of the type, not allowed to be null.
      maxSize - The maximum number of elements in an array value of this array type.
      elementType - The type of the elements of the array, not allowed to be null.
      Returns:
      The created array type column.
      Throws:
      NullPointerException - If scheme or elementType is null.
      IllegalArgumentException - If maxSize is less than 1.
    • ofRef

      public static final Column<Ref> ofRef()
      Creates a new column having the reference column type. It is safe to cast column.info().type() of the returned column to the RefType interface.
      Returns:
      The created column.
    • ofArrayOfRef

      public static final Column<Ref[]> ofArrayOfRef(int maxSize) throws IllegalArgumentException
      Creates a new column having an array of references column type with an outrow storage scheme. It is safe to cast column.info().type() of the returned column to the ArrayOfRefType interface.

      Invoking this method has the same effect as invoking ofArrayOfRef(Scheme.OUTROW, maxSize).

      Parameters:
      maxSize - The maximum number of elements in an array value of this array type.
      Returns:
      The created column of type array with elements being references.
      Throws:
      IllegalArgumentException - If maxSize is less than 1.
    • ofArrayOfRef

      public static final Column<Ref[]> ofArrayOfRef(Type.Scheme scheme, int maxSize) throws NullPointerException, IllegalArgumentException
      Creates a new column having an array of references column type. It is safe to cast column.info().type() of the returned column to the ArrayOfRefType interface.
      Parameters:
      scheme - The storage scheme of the type, not allowed to be null.
      maxSize - The maximum number of elements in an array value of this array type.
      Returns:
      The created column of type array with elements being references.
      Throws:
      NullPointerException - If scheme is null.
      IllegalArgumentException - If maxSize is less than 1.