public abstract class UserDefinedFunction extends ADQLFunction implements UnknownType
DefaultUDFADQLFunction.ParameterIterator| Constructor and Description |
|---|
UserDefinedFunction() |
| Modifier and Type | Method and Description |
|---|---|
char |
getExpectedType()
Get the type expected by the syntactic parser according to the context.
|
void |
setExpectedType(char c)
Set the type expected for this operand.
|
abstract java.lang.String |
translate(ADQLTranslator caller)
Translate this User Defined Function into the language supported by the given translator.
|
adqlIterator, getNbParameters, getParameter, getParameters, getPosition, paramIterator, setParameter, setPosition, toADQLclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitisGeometry, isNumeric, isStringadqlIterator, getCopy, getName, getPosition, toADQLpublic char getExpectedType()
UnknownTypegetExpectedType in interface UnknownTypepublic void setExpectedType(char c)
UnknownTypesetExpectedType in interface UnknownTypec - Expected type: 'n' or 'N' for numeric, 's' or 'S' for string, 'g' or 'G' for geometry.public abstract java.lang.String translate(ADQLTranslator caller) throws TranslationException
Translate this User Defined Function into the language supported by the given translator.
VERY IMPORTANT: This function MUST NOT use ADQLTranslator.translate(UserDefinedFunction) to translate itself.
The given ADQLTranslator must be used ONLY to translate UDF's operands.
Implementation example (extract of DefaultUDF.translate(ADQLTranslator)):
public String translate(final ADQLTranslator caller) throws TranslationException{
StringBuffer sql = new StringBuffer(functionName);
sql.append('(');
for(int i = 0; i < parameters.size(); i++){
if (i > 0)
sql.append(',').append(' ');
sql.append(caller.translate(parameters.get(i)));
}
sql.append(')');
return sql.toString();
}
caller - Translator to use in order to translate ONLY function parameters.TranslationException - If one of the parameters can not be translated.