Class GlobalContextRequirement


  • public class GlobalContextRequirement
    extends java.lang.Object
    Information about the requirements placed by a query or stylesheet on the global context item: whether it is mandatory or optional, what its type must be, and whether it has a default value. In XSLT, if more than one module specifies a global context item type, they must be the same. In XQuery, several modules can specify different required types, and the actual context item must satisfy them all.
    • Constructor Detail

      • GlobalContextRequirement

        public GlobalContextRequirement()
    • Method Detail

      • getRequiredItemType

        public ItemType getRequiredItemType()
        Get the required item type of the context item. If several required item types have been registered (which only happens in XQuery with multiple modules) then this returns the first.
        Returns:
        The first registered required item type
      • getRequiredItemTypes

        public java.util.List<ItemType> getRequiredItemTypes()
        Get all the required item types. In XSLT there can only be one, but in XQuery there can be several, one for each module (the actual context item must satisfy them all)
        Returns:
        the list of required item types
      • addRequiredItemType

        public void addRequiredItemType​(ItemType requiredItemType)
        Specify the required item type of the context item
        Parameters:
        requiredItemType - the required item type
      • getDefaultValue

        public Expression getDefaultValue()
        Get the expression that supplies the default value of the context item, if any. This is used only in XQuery.
        Returns:
        the expression used to compute the value of the context item, in the absence of an externally-supplied value
      • setDefaultValue

        public void setDefaultValue​(Expression defaultValue)
        Set the expression used to compute the default value of the global context item
        Parameters:
        defaultValue - the expression used to compute the default value.
      • setAbsentFocus

        public void setAbsentFocus​(boolean absent)
        Say whether the global context item for a query or stylesheet will be absent. This is relevant only for XSLT.
        Parameters:
        absent - true if there will be no context item (externally or internally supplied).
      • isAbsentFocus

        public boolean isAbsentFocus()
        Ask whether the global context item for a query or stylesheet will be absent. This is relevant only for XSLT.
        Returns:
        true if there will be no context item (externally or internally supplied).
      • setMayBeOmitted

        public void setMayBeOmitted​(boolean mayOmit)
        Say whether it is OK for the application to supply no context item
        Parameters:
        mayOmit - true if it is OK for the application to supply to context item
      • isMayBeOmitted

        public boolean isMayBeOmitted()
        Ask whether it is OK for the application to supply no context item
        Returns:
        true if it is OK for the application to supply to context item
      • setExternal

        public void setExternal​(boolean external)
        Say whether (in XQuery) the global context item is declared as external
        Parameters:
        external - true if the global context item is declared as external
      • isExternal

        public boolean isExternal()
        Ask whether (in XQuery) the global context item is declared as external
        Returns:
        true if the global context item is declared as external
      • makeGlobalContextInfo

        public ContextItemStaticInfo makeGlobalContextInfo​(Configuration config)
        Make a ContextItemStaticInfo object describing the global context item
        Parameters:
        config - the Configuration
        Returns:
        a suitable ContextItemStaticInfo