Class FeatureSet
- All Implemented Interfaces:
Iterable<LanguageFeature>
With this class it is possible to declare which language features are
supported. If a LanguageFeature is not part of this set, it must be
considered as unsupported.
(Un-)Support individual features
To support a feature, use the function
support(LanguageFeature) while unsupport(LanguageFeature)
lets remove a feature from this set.
Warning:
Features with or
which are not declared as optional can never be supported by this set. In
such case, type = NULLsupport(LanguageFeature) will return false.
Note:
You do not have to create any new instance of LanguageFeature. All
ADQLObject provides a function for this
purpose: ADQLObject.getFeatureDescription().
Unfortunately, this function can not be static. That's why, the library
declared a static attribute in every ADQLObject
called FEATURE.
Example:
To support the optional function LOWER:
myFeatureSet.support(LowerFunction.FEATURE);
And for the geometric function POLYGON:
myFeatureSet.support(PolygonFunction.FEATURE);
(Un-)Support all available features
It is also possible to support or un-support all optional features with the
functions supportAll() and unsupportAll().
Note:
The list of all standard optional features can be discovered with
getAvailableFeatures().
(Un-)Support a specific type of feature
You can also support or un-support all optional features of a given type
with supportAll(String) and unsupportAll(String). You can
find all standard types of feature in LanguageFeature as public
static attributes whose the name starts with TYPE_.
Example:
To un-support all geometric functions:
myFeatureSet.unsupportAll(LanguageFeature.TYPE_ADQL_GEO);
Warning:
Both functions will not work for User Defined Functions that has to be
added individually in the FeatureSet.
- Since:
- 2.0
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final Map<String, Set<LanguageFeature>> Set of all supported features. -
Constructor Summary
ConstructorsConstructorDescriptionCreate a feature set with all available features supported by default.FeatureSet(boolean allSupported) Create a feature set will all available features supported or not, depending of the given boolean parameter. -
Method Summary
Modifier and TypeMethodDescriptionstatic Iterator<LanguageFeature> List all available language features.List all features marked in this set as supported.getSupportedFeatures(String type) List only features of the given type that are marked in this set as supported.final Collection<FunctionDef> Get the list of the definition of all declared UDFs.List all available features not marked in this set as supported.booleanisSupporting(LanguageFeature feature) Tell whether the given optional feature is marked as supported by this set.final Iterator<LanguageFeature> iterator()List all features marked as supported in this set.booleansupport(LanguageFeature feature) Support the given optional feature.final voidSupport all available optional features.final booleansupportAll(String type) Support all the optional features of the given type.booleanunsupport(LanguageFeature feature) Un-support the given optional feature.final voidUn-support all available features.final booleanunsupportAll(String type) Un-support all the optional features of the given type.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.lang.Iterable
forEach, spliterator
-
Field Details
-
supportedFeatures
Set of all supported features.
-
-
Constructor Details
-
FeatureSet
public FeatureSet()Create a feature set with all available features supported by default. -
FeatureSet
public FeatureSet(boolean allSupported) Create a feature set will all available features supported or not, depending of the given boolean parameter.- Parameters:
allSupported-trueto support all available features,falseto not support any.
-
-
Method Details
-
support
Support the given optional feature.Warning: A feature can not be marked as supported in the following cases:
- it is NULL,
- no type is specified,
- it is not optional.
In any of this cases, this function will do nothing else than returning
false.- Parameters:
feature- The optional language feature to support.- Returns:
trueif this set already/from now supporting the given feature,falseif the given feature can not be supported.
-
supportAll
Support all the optional features of the given type.- Parameters:
type- The type of language features to support.- Returns:
trueif all the available features of the given type are already/from now supported by this set,falseif the given type is NULL or it does not match any available feature.- See Also:
-
supportAll
public final void supportAll()Support all available optional features.- See Also:
-
unsupport
Un-support the given optional feature.Warning: A feature can not be marked as un-supported in the following cases:
- it is NULL,
- no type is specified,
- it is not optional.
In any of this cases, this function will do nothing else than returning
false.- Parameters:
feature- The optional language feature to un-support.- Returns:
trueif this set already/from now un-supporting the given feature,falseif the given feature can not be supported any way.
-
unsupportAll
Un-support all the optional features of the given type.- Parameters:
type- The type of language features to un-support.- Returns:
trueif all the available features of the given type are already/from now un-supported by this set,falseif the given type is NULL or it does not match any available feature.- See Also:
-
unsupportAll
public final void unsupportAll()Un-support all available features.- See Also:
-
isSupporting
Tell whether the given optional feature is marked as supported by this set.Warning: A feature can not be marked as supported in the following cases:
- it is NULL,
- no type is specified,
- it is not optional.
In any of this cases, this function will do nothing else than returning
false.- Parameters:
feature- The optional feature to test.- Returns:
trueif supported according to this set,falseotherwise.
-
getSupportedFeatures
List all features marked in this set as supported.- Returns:
- An iterator over all supported features.
-
getUnsupportedFeatures
List all available features not marked in this set as supported.- Returns:
- An iterator over all un-supported features.
-
getSupportedFeatures
List only features of the given type that are marked in this set as supported.Note: If the given type is NULL or does not match the type of any supported feature, this function will return an empty iterator.
- Parameters:
type- Type of the features to test.- Returns:
- An iterator over all supported features of the given type.
-
iterator
List all features marked as supported in this set.- Specified by:
iteratorin interfaceIterable<LanguageFeature>- See Also:
-
getSupportedUDFList
Get the list of the definition of all declared UDFs.- Returns:
- List of all supported UDFs.
-
getAvailableFeatures
List all available language features.- Returns:
- An iterator over all available features.
-