📄 functionfactory.java
字号:
{
synchronized (registeredFactories) {
if (registeredFactories.containsKey(identifier))
throw new IllegalArgumentException("Identifier is already " +
"registered as " +
"FunctionFactory: " +
identifier);
registeredFactories.put(identifier, proxy);
}
}
/**
* Adds the function to the factory. Most functions have no state, so
* the singleton model used here is typically desireable. The factory will
* not enforce the requirement that a Target or Condition matching function
* must be boolean.
*
* @param function the <code>Function</code> to add to the factory
*
* @throws IllegalArgumentException if the function's identifier is already
* used
*/
public abstract void addFunction(Function function);
/**
* Adds the abstract function proxy to the factory. This is used for
* those functions which have state, or change behavior (for instance
* the standard map function, which changes its return type based on
* how it is used).
*
* @param proxy the <code>FunctionProxy</code> to add to the factory
* @param identity the function's identifier
*
* @throws IllegalArgumentException if the function's identifier is already
* used
*/
public abstract void addAbstractFunction(FunctionProxy proxy,
URI identity);
/**
* Adds a target function.
*
* @deprecated As of version 1.2, replaced by
* {@link #addFunction(Function)}.
* The new factory system requires you to get a factory
* instance and then call the non-static methods on that
* factory. The static versions of these methods have been
* left in for now, but are slower and will be removed in
* a future version.
*
* @param function the function to add
*
* @throws IllegalArgumentException if the name is already in use
*/
public static void addTargetFunction(Function function) {
getTargetInstance().addFunction(function);
}
/**
* Adds an abstract target function.
*
* @deprecated As of version 1.2, replaced by
* {@link #addAbstractFunction(FunctionProxy,URI)}.
* The new factory system requires you to get a factory
* instance and then call the non-static methods on that
* factory. The static versions of these methods have been
* left in for now, but are slower and will be removed in
* a future version.
*
* @param proxy the function proxy to add
* @param identity the name of the function
*
* @throws IllegalArgumentException if the name is already in use
*/
public static void addAbstractTargetFunction(FunctionProxy proxy,
URI identity) {
getTargetInstance().addAbstractFunction(proxy, identity);
}
/**
* Adds a condition function.
*
* @deprecated As of version 1.2, replaced by
* {@link #addFunction(Function)}.
* The new factory system requires you to get a factory
* instance and then call the non-static methods on that
* factory. The static versions of these methods have been
* left in for now, but are slower and will be removed in
* a future version.
*
* @param function the function to add
*
* @throws IllegalArgumentException if the name is already in use
*/
public static void addConditionFunction(Function function) {
getConditionInstance().addFunction(function);
}
/**
* Adds an abstract condition function.
*
* @deprecated As of version 1.2, replaced by
* {@link #addAbstractFunction(FunctionProxy,URI)}.
* The new factory system requires you to get a factory
* instance and then call the non-static methods on that
* factory. The static versions of these methods have been
* left in for now, but are slower and will be removed in
* a future version.
*
* @param proxy the function proxy to add
* @param identity the name of the function
*
* @throws IllegalArgumentException if the name is already in use
*/
public static void addAbstractConditionFunction(FunctionProxy proxy,
URI identity) {
getConditionInstance().addAbstractFunction(proxy, identity);
}
/**
* Adds a general function.
*
* @deprecated As of version 1.2, replaced by
* {@link #addFunction(Function)}.
* The new factory system requires you to get a factory
* instance and then call the non-static methods on that
* factory. The static versions of these methods have been
* left in for now, but are slower and will be removed in
* a future version.
*
* @param function the function to add
*
* @throws IllegalArgumentException if the name is already in use
*/
public static void addGeneralFunction(Function function) {
getGeneralInstance().addFunction(function);
}
/**
* Adds an abstract general function.
*
* @deprecated As of version 1.2, replaced by
* {@link #addAbstractFunction(FunctionProxy,URI)}.
* The new factory system requires you to get a factory
* instance and then call the non-static methods on that
* factory. The static versions of these methods have been
* left in for now, but are slower and will be removed in
* a future version.
*
* @param proxy the function proxy to add
* @param identity the name of the function
*
* @throws IllegalArgumentException if the name is already in use
*/
public static void addAbstractGeneralFunction(FunctionProxy proxy,
URI identity) {
getGeneralInstance().addAbstractFunction(proxy, identity);
}
/**
* Returns the function identifiers supported by this factory.
*
* @return a <code>Set</code> of <code>String</code>s
*/
public abstract Set getSupportedFunctions();
/**
* Tries to get an instance of the specified function.
*
* @param identity the name of the function
*
* @throws UnknownIdentifierException if the name isn't known
* @throws FunctionTypeException if the name is known to map to an
* abstract function, and should therefore
* be created through createAbstractFunction
*/
public abstract Function createFunction(URI identity)
throws UnknownIdentifierException, FunctionTypeException;
/**
* Tries to get an instance of the specified function.
*
* @param identity the name of the function
*
* @throws UnknownIdentifierException if the name isn't known
* @throws FunctionTypeException if the name is known to map to an
* abstract function, and should therefore
* be created through createAbstractFunction
*/
public abstract Function createFunction(String identity)
throws UnknownIdentifierException, FunctionTypeException;
/**
* Tries to get an instance of the specified abstract function.
*
* @param identity the name of the function
* @param root the DOM root containing info used to create the function
*
* @throws UnknownIdentifierException if the name isn't known
* @throws FunctionTypeException if the name is known to map to a
* concrete function, and should therefore
* be created through createFunction
* @throws ParsingException if the function can't be created with the
* given inputs
*/
public abstract Function createAbstractFunction(URI identity, Node root)
throws UnknownIdentifierException, ParsingException,
FunctionTypeException;
/**
* Tries to get an instance of the specified abstract function.
*
* @param identity the name of the function
* @param root the DOM root containing info used to create the function
* @param xpathVersion the version specified in the contianing policy, or
* null if no version was specified
*
* @throws UnknownIdentifierException if the name isn't known
* @throws FunctionTypeException if the name is known to map to a
* concrete function, and should therefore
* be created through createFunction
* @throws ParsingException if the function can't be created with the
* given inputs
*/
public abstract Function createAbstractFunction(URI identity, Node root,
String xpathVersion)
throws UnknownIdentifierException, ParsingException,
FunctionTypeException;
/**
* Tries to get an instance of the specified abstract function.
*
* @param identity the name of the function
* @param root the DOM root containing info used to create the function
*
* @throws UnknownIdentifierException if the name isn't known
* @throws FunctionTypeException if the name is known to map to a
* concrete function, and should therefore
* be created through createFunction
* @throws ParsingException if the function can't be created with the
* given inputs
*/
public abstract Function createAbstractFunction(String identity, Node root)
throws UnknownIdentifierException, ParsingException,
FunctionTypeException;
/**
* Tries to get an instance of the specified abstract function.
*
* @param identity the name of the function
* @param root the DOM root containing info used to create the function
* @param xpathVersion the version specified in the contianing policy, or
* null if no version was specified
*
* @throws UnknownIdentifierException if the name isn't known
* @throws FunctionTypeException if the name is known to map to a
* concrete function, and should therefore
* be created through createFunction
* @throws ParsingException if the function can't be created with the
* given inputs
*/
public abstract Function createAbstractFunction(String identity, Node root,
String xpathVersion)
throws UnknownIdentifierException, ParsingException,
FunctionTypeException;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -