Package org.rumbledb.types
Class AtomicItemType
java.lang.Object
org.rumbledb.types.AtomicItemType
- All Implemented Interfaces:
com.esotericsoftware.kryo.KryoSerializable
,Serializable
,ItemType
public class AtomicItemType
extends Object
implements ItemType, com.esotericsoftware.kryo.KryoSerializable
This class describes all the primitive built-in atomic types in the JSONiq data model and the derived DayTimeDuration
and YearMonthDuration item types that are derived, but whose derivation cannot be expressed through JSound facets
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionboolean
canBePromotedTo
(ItemType other) boolean
Tests for itemType equality.getName()
Returns the SparkSQL type of the item type for use in a query.int
boolean
hasName()
Tests for QName.boolean
boolean
isCompatibleWithDataFrames
(RumbleRuntimeConfiguration configuration) Checks compatibility with DataFrames.boolean
boolean
boolean
boolean
isStaticallyCastableAs
(ItemType other) Check at static time if [this] could be casted to [other] item type, requires [this] to be an atomic typevoid
read
(com.esotericsoftware.kryo.Kryo kryo, com.esotericsoftware.kryo.io.Input input) toString()
void
write
(com.esotericsoftware.kryo.Kryo kryo, com.esotericsoftware.kryo.io.Output output) Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.rumbledb.types.ItemType
findLeastCommonSuperTypeWith, getArrayContentFacet, getClosedFacet, getIdentifierString, getObjectContentFacet, getSignature, getUnionContentFacet, isArrayItemType, isEqualTo, isFunctionItemType, isJsonItemType, isObjectItemType, isSubtypeOf, isTopmostItemType, isUnionType, isUserDefined, resolve, resolve
-
Constructor Details
-
AtomicItemType
public AtomicItemType()
-
-
Method Details
-
write
public void write(com.esotericsoftware.kryo.Kryo kryo, com.esotericsoftware.kryo.io.Output output) - Specified by:
write
in interfacecom.esotericsoftware.kryo.KryoSerializable
-
read
public void read(com.esotericsoftware.kryo.Kryo kryo, com.esotericsoftware.kryo.io.Input input) - Specified by:
read
in interfacecom.esotericsoftware.kryo.KryoSerializable
-
equals
Description copied from interface:ItemType
Tests for itemType equality. -
isAtomicItemType
public boolean isAtomicItemType()- Specified by:
isAtomicItemType
in interfaceItemType
- Returns:
- true it [this] is a subtype of an atomic item type.
-
hasName
public boolean hasName()Description copied from interface:ItemType
Tests for QName. -
getName
-
getTypeTreeDepth
public int getTypeTreeDepth()- Specified by:
getTypeTreeDepth
in interfaceItemType
- Returns:
- an int representing the depth of the item type in the type tree ('item' is the root with depth 0)
-
getBaseType
- Specified by:
getBaseType
in interfaceItemType
- Returns:
- the base type for a type, return null for the topmost item type
-
isPrimitive
public boolean isPrimitive()- Specified by:
isPrimitive
in interfaceItemType
- Returns:
- [true] if it is a primitive type
-
getPrimitiveType
- Specified by:
getPrimitiveType
in interfaceItemType
- Returns:
- the primitive type for a derived type, throw an error for primitive types
-
isStaticallyCastableAs
Description copied from interface:ItemType
Check at static time if [this] could be casted to [other] item type, requires [this] to be an atomic type- Specified by:
isStaticallyCastableAs
in interfaceItemType
- Parameters:
other
- a strict subtype of atomic item type to which we are trying to cast- Returns:
- true if it is possible at static time to cast [this] to [other], false otherwise
-
isNumeric
public boolean isNumeric() -
canBePromotedTo
- Specified by:
canBePromotedTo
in interfaceItemType
- Parameters:
other
- another item type- Returns:
- true if [this] can be promoted to [itemType]
-
getAllowedFacets
- Specified by:
getAllowedFacets
in interfaceItemType
- Returns:
- a set containing the allowed facets for restricting the type
-
getEnumerationFacet
- Specified by:
getEnumerationFacet
in interfaceItemType
- Returns:
- the list of possible values for [this] item type or null if the enumeration facet is not set
-
getConstraintsFacet
- Specified by:
getConstraintsFacet
in interfaceItemType
- Returns:
- the list of constraints in the implementation-defined language for [this] item type (note that this facet is cumulative) or an empty list if the constraints facet is not set
-
getMinLengthFacet
- Specified by:
getMinLengthFacet
in interfaceItemType
- Returns:
- the minimum length facet value for [this] item type or null if the restriction is not set
-
getLengthFacet
- Specified by:
getLengthFacet
in interfaceItemType
- Returns:
- the length facet value for [this] item type or null if the restriction is not set
-
getMaxLengthFacet
- Specified by:
getMaxLengthFacet
in interfaceItemType
- Returns:
- the maximum length facet value for [this] item type or null if the restriction is not set
-
getMinExclusiveFacet
- Specified by:
getMinExclusiveFacet
in interfaceItemType
- Returns:
- an item representing the minimum possible value (excluded) for [this] item type or null if the restriction is not set
-
getMinInclusiveFacet
- Specified by:
getMinInclusiveFacet
in interfaceItemType
- Returns:
- an item representing the minimum possible value (included) for [this] item type or null if the restriction is not set
-
getMaxExclusiveFacet
- Specified by:
getMaxExclusiveFacet
in interfaceItemType
- Returns:
- an item representing the maximum possible value (excluded) for [this] item type or null if the restriction is not set
-
getMaxInclusiveFacet
- Specified by:
getMaxInclusiveFacet
in interfaceItemType
- Returns:
- an item representing the maximum possible value (included) for [this] item type or null if the restriction is not set
-
getTotalDigitsFacet
- Specified by:
getTotalDigitsFacet
in interfaceItemType
- Returns:
- the total digits facet value for [this] item type or null if the restriction is not set
-
getFractionDigitsFacet
- Specified by:
getFractionDigitsFacet
in interfaceItemType
- Returns:
- the fraction digits facet value for [this] item type or null if the restriction is not set
-
getExplicitTimezoneFacet
- Specified by:
getExplicitTimezoneFacet
in interfaceItemType
- Returns:
- the explicit timezone facet value for [this] item type or null if the restriction is not set
-
toString
-
isResolved
public boolean isResolved()- Specified by:
isResolved
in interfaceItemType
-
isCompatibleWithDataFrames
Description copied from interface:ItemType
Checks compatibility with DataFrames.- Specified by:
isCompatibleWithDataFrames
in interfaceItemType
- Returns:
- true if compatible with DataFrames and false otherwise.
-
getSparkSQLType
Description copied from interface:ItemType
Returns the SparkSQL type of the item type for use in a query.- Specified by:
getSparkSQLType
in interfaceItemType
- Returns:
- String representing the SparkSQL type of the item type.
-