Class CastFunction
- All Implemented Interfaces:
ADQLObject,ADQLOperand,UnknownType
- Since:
- 2.0
-
Nested Class Summary
Nested classes/interfaces inherited from class adql.query.operand.function.ADQLFunction
ADQLFunction.ParameterIterator -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected FunctionTranslatorHow to translate this CAST function.protected final StringConstant name of this function.static final LanguageFeatureDescription of this ADQL Feature.protected TargetTypeThe type into which the value must be cast.protected ADQLOperandThe value to cast. -
Constructor Summary
ConstructorsConstructorDescriptionCastFunction(ADQLOperand value, TargetType type) CastFunction(CastFunction toCopy) -
Method Summary
Modifier and TypeMethodDescriptiongetCopy()Gets a (deep) copy of this ADQL object.charGet the type expected by the syntactic parser according to the context.Get the description of this ADQL's Language Feature.final FunctionTranslatorGet the specialized translator to translate this CAST function.getName()Gets the name of this object in ADQL.intGets the number of parameters this function has.getParameter(int index) Gets the index-th parameter.Gets the list of all parameters of this function.Get the database type actually returned by this function.final TargetTypeGet the type into which the given value is going to be casted.getValue()booleanTell whether this operand is a geometrical region or not.booleanTell whether this operand is numeric or not.booleanisString()Tell whether this operand is a string or not.voidsetExpectedType(char c) Set the type expected for this operand.final voidsetFunctionTranslator(FunctionTranslator customTranslation) Set a specialized translator to translate this CAST function.setParameter(int index, ADQLOperand replacer) Replaces the index-th parameter by the given one.protected voidsetTargetType(TargetType type) Set the type into which the given value must be casted.toADQL()Gets the ADQL expression of this object.Methods inherited from class adql.query.operand.function.ADQLFunction
adqlIterator, getPosition, paramIterator, setPositionMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface adql.query.ADQLObject
adqlIterator, getPosition
-
Field Details
-
FEATURE
Description of this ADQL Feature. -
FCT_NAME
Constant name of this function.- See Also:
-
value
The value to cast. -
targetType
The type into which the value must be cast. -
customTranslation
How to translate this CAST function.This is by default NULL. It is useful when the target type is not a standard one.
-
-
Constructor Details
-
CastFunction
-
CastFunction
- Throws:
Exception
-
-
Method Details
-
isNumeric
public boolean isNumeric()Description copied from interface:ADQLOperandTell whether this operand is numeric or not.- Specified by:
isNumericin interfaceADQLOperand- Returns:
- true if this operand is numeric, false otherwise.
-
isString
public boolean isString()Description copied from interface:ADQLOperandTell whether this operand is a string or not.- Specified by:
isStringin interfaceADQLOperand- Returns:
- true if this operand is a string, false otherwise.
-
isGeometry
public boolean isGeometry()Description copied from interface:ADQLOperandTell whether this operand is a geometrical region or not.- Specified by:
isGeometryin interfaceADQLOperand- Returns:
- true if this operand is a geometry, false otherwise.
-
getExpectedType
public char getExpectedType()Description copied from interface:UnknownTypeGet the type expected by the syntactic parser according to the context.- Specified by:
getExpectedTypein interfaceUnknownType- Returns:
- Expected type: 'n' or 'N' for numeric, 's' or 'S' for string, 'g' or 'G' for geometry.
-
setExpectedType
public void setExpectedType(char c) Description copied from interface:UnknownTypeSet the type expected for this operand.- Specified by:
setExpectedTypein interfaceUnknownType- Parameters:
c- Expected type: 'n' or 'N' for numeric, 's' or 'S' for string, 'g' or 'G' for geometry.
-
getName
Description copied from interface:ADQLObjectGets the name of this object in ADQL.- Specified by:
getNamein interfaceADQLObject- Returns:
- The name of this ADQL object.
-
getValue
-
getReturnType
Get the database type actually returned by this function.Implementation note: This function is just a convenient access to
getTargetType().getReturnType().- Returns:
- Type returned by this function.
- See Also:
-
getTargetType
Get the type into which the given value is going to be casted.- Returns:
- The target type.
-
setTargetType
Set the type into which the given value must be casted.Note: If the given target type is custom (i.e. not a
StandardTargetType), it may be useful to provide a specific translation. In such case,setFunctionTranslator(FunctionTranslator)should be used.- Parameters:
type- The new target type.- Throws:
NullPointerException- If the given type is NULL.
-
getFunctionTranslator
Get the specialized translator to translate this CAST function.Note: It is generally useful to give a such translator when the target type is not a standard one.
- Returns:
- The function translator to use,
or NULL for the default
CastFunctiontranslation.
-
setFunctionTranslator
Set a specialized translator to translate this CAST function.Note: It is generally useful to give a such translator when the target type is not a standard one.
- Parameters:
customTranslation- The new translator to use, or NULL for the default translation.
-
getFeatureDescription
Description copied from interface:ADQLObjectGet the description of this ADQL's Language Feature.Note: Getting this description is generally only useful when discovery optional features so that determining if they are allowed to be used in ADQL queries.
- Specified by:
getFeatureDescriptionin interfaceADQLObject- Returns:
- Description of this ADQL object as an ADQL's feature.
-
getCopy
Description copied from interface:ADQLObjectGets a (deep) copy of this ADQL object.- Specified by:
getCopyin interfaceADQLObject- Returns:
- The copy of this ADQL object.
- Throws:
Exception- If there is any error during the copy.
-
getNbParameters
public int getNbParameters()Description copied from class:ADQLFunctionGets the number of parameters this function has.- Specified by:
getNbParametersin classADQLFunction- Returns:
- Number of parameters.
-
getParameters
Description copied from class:ADQLFunctionGets the list of all parameters of this function.- Specified by:
getParametersin classADQLFunction- Returns:
- Its parameters list.
-
getParameter
Description copied from class:ADQLFunctionGets the index-th parameter.- Specified by:
getParameterin classADQLFunction- Parameters:
index- Parameter number.- Returns:
- The corresponding parameter.
- Throws:
ArrayIndexOutOfBoundsException- If the index is incorrect (index invalid input: '<' 0 || index >= getNbParameters()).
-
setParameter
public ADQLOperand setParameter(int index, ADQLOperand replacer) throws ArrayIndexOutOfBoundsException, NullPointerException, Exception Description copied from class:ADQLFunctionReplaces the index-th parameter by the given one.- Specified by:
setParameterin classADQLFunction- Parameters:
index- Index of the parameter to replace.replacer- The replacer.- Returns:
- The replaced parameter.
- Throws:
ArrayIndexOutOfBoundsException- If the index is incorrect (index invalid input: '<' 0 || index >= getNbParameters()).NullPointerException- If a required parameter must be replaced by a NULL object.Exception- If another error occurs.
-
toADQL
Description copied from interface:ADQLObjectGets the ADQL expression of this object.- Specified by:
toADQLin interfaceADQLObject- Overrides:
toADQLin classADQLFunction- Returns:
- The corresponding ADQL expression.
-