java.lang.Object
org.apache.olingo.commons.core.edm.primitivetype.SingletonPrimitiveType
org.apache.olingo.commons.core.edm.primitivetype.EdmInt16
All Implemented Interfaces:
EdmNamed, EdmPrimitiveType, EdmType

public final class EdmInt16 extends SingletonPrimitiveType
Implementation of the EDM primitive type Int16.
  • Field Details

  • Constructor Details

    • EdmInt16

      public EdmInt16()
  • Method Details

    • getInstance

      public static EdmInt16 getInstance()
    • isCompatible

      public boolean isCompatible(EdmPrimitiveType primitiveType)
      Description copied from interface: EdmPrimitiveType
      Checks type compatibility.
      Specified by:
      isCompatible in interface EdmPrimitiveType
      Parameters:
      primitiveType - the EdmPrimitiveType to be tested for compatibility
      Returns:
      true if the provided type is compatible to this type
    • getDefaultType

      public Class<?> getDefaultType()
      Description copied from interface: EdmPrimitiveType
      Returns the default Java type for this EDM primitive type as described in the documentation of EdmPrimitiveType.
      Returns:
      the default Java type
    • internalValueOfString

      protected <T> T internalValueOfString(String value, Boolean isNullable, Integer maxLength, Integer precision, Integer scale, Boolean isUnicode, Class<T> returnType) throws EdmPrimitiveTypeException
      Throws:
      EdmPrimitiveTypeException
    • internalValueToString

      protected <T> String internalValueToString(T value, Boolean isNullable, Integer maxLength, Integer precision, Integer scale, Boolean isUnicode) throws EdmPrimitiveTypeException
      Throws:
      EdmPrimitiveTypeException
    • getFullQualifiedName

      public FullQualifiedName getFullQualifiedName()
      Specified by:
      getFullQualifiedName in interface EdmType
      Returns:
      full qualified name
    • validate

      public boolean validate(String value, Boolean isNullable, Integer maxLength, Integer precision, Integer scale, Boolean isUnicode)
      Description copied from interface: EdmPrimitiveType
      Validates literal value.
      Specified by:
      validate in interface EdmPrimitiveType
      Parameters:
      value - the literal value
      isNullable - whether the null value is allowed
      maxLength - the maximum length
      precision - the precision
      scale - the scale
      isUnicode - whether non-ASCII characters are allowed (relevant only for Edm.String)
      Returns:
      true if the validation is successful
    • valueOfString

      public final <T> T valueOfString(String value, Boolean isNullable, Integer maxLength, Integer precision, Integer scale, Boolean isUnicode, Class<T> returnType) throws EdmPrimitiveTypeException
      Description copied from interface: EdmPrimitiveType
      Converts literal representation of value to system data type.
      Specified by:
      valueOfString in interface EdmPrimitiveType
      Parameters:
      value - the literal representation of value
      isNullable - whether the null value is allowed
      maxLength - the maximum length
      precision - the precision
      scale - the scale
      isUnicode - whether non-ASCII characters are allowed (relevant only for Edm.String)
      returnType - the class of the returned value; it must be one of the list in the documentation of EdmPrimitiveType
      Returns:
      the value as an instance of the class the parameter returnType indicates
      Throws:
      EdmPrimitiveTypeException
    • valueToString

      public final String valueToString(Object value, Boolean isNullable, Integer maxLength, Integer precision, Integer scale, Boolean isUnicode) throws EdmPrimitiveTypeException
      Description copied from interface: EdmPrimitiveType
      Converts system data type to literal representation of value.

      Returns null if value is null and null is an allowed value.

      Specified by:
      valueToString in interface EdmPrimitiveType
      Parameters:
      value - the Java value as Object; its type must be one of the list in the documentation of EdmPrimitiveType
      isNullable - whether the null value is allowed
      maxLength - the maximum length
      precision - the precision
      scale - the scale
      isUnicode - whether non-ASCII characters are allowed (relevant only for Edm.String)
      Returns:
      literal representation as String
      Throws:
      EdmPrimitiveTypeException
    • toUriLiteral

      public String toUriLiteral(String literal)
      Description copied from interface: EdmPrimitiveType
      Converts default literal representation to URI literal representation.

      Returns null if the literal is null. Does not perform any validation.

      Specified by:
      toUriLiteral in interface EdmPrimitiveType
      Parameters:
      literal - the literal in default representation
      Returns:
      URI literal representation as String
    • fromUriLiteral

      public String fromUriLiteral(String literal) throws EdmPrimitiveTypeException
      Description copied from interface: EdmPrimitiveType
      Converts URI literal representation to default literal representation.

      Returns null if the literal is null. Checks the presence of a required prefix and of required surrounding quotation marks but does not perform any further validation.

      Specified by:
      fromUriLiteral in interface EdmPrimitiveType
      Parameters:
      literal - the literal in URI representation
      Returns:
      default literal representation as String
      Throws:
      EdmPrimitiveTypeException - if a required prefix or required surrounding quotation marks are missing
    • toString

      public String toString()
      Overrides:
      toString in class Object