|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.modeshape.graph.request.Request
org.modeshape.graph.request.FunctionRequest
public final class FunctionRequest
Constructor Summary | |
---|---|
FunctionRequest(Function function,
Location at,
String workspaceName,
Map<String,Serializable> inputs)
Create a request to execute the function at the supplied location. |
Method Summary | ||
---|---|---|
void |
addActualRequest(Request request)
Add an actual request created and executed by the invocation of this function. |
|
void |
addActualRequests(Iterable<Request> requests)
Add the actual requests created and executed by the invocation of this function. |
|
Location |
at()
Get the location defining the node that is to be read. |
|
void |
cancel()
Cancel this request. |
|
FunctionRequest |
clone()
This method does not clone the results. |
|
protected
|
convert(String name,
Class<T> type,
T defaultValue,
Map<String,Serializable> values,
ExecutionContext context)
|
|
protected
|
convert(String name,
PropertyType type,
T defaultValue,
Map<String,Serializable> values,
ExecutionContext context)
|
|
boolean |
equals(Object obj)
|
|
Function |
function()
Get the function implementation |
|
Location |
getActualLocationOfNode()
Get the actual location of the node whose children and properties were read. |
|
int |
getActualRequestCount()
Get the number of actual requests created and executed by the invocation of this function. |
|
Iterator<Request> |
getActualRequests()
Get the actual requests created and executed by the invocation of this function. |
|
RequestType |
getType()
Returns the type of the request |
|
int |
hashCode()
|
|
Object |
input(String name)
Get the value for the named input to this function. |
|
|
input(String name,
Class<T> type,
T defaultValue,
ExecutionContext context)
Get the value for the named input to this function. |
|
|
input(String name,
PropertyType type,
T defaultValue,
ExecutionContext context)
Get the value for the named input to this function. |
|
Map<String,Serializable> |
inputs()
The unmodifiable map of input parameter name to value. |
|
String |
inWorkspace()
Get the name of the workspace in which the function is being applied. |
|
boolean |
isReadOnly()
Return whether this request only reads information. |
|
Object |
output(String name)
Get the value for the named output to this function. |
|
|
output(String name,
Class<T> type,
ExecutionContext context)
Get the value for the named output to this function. |
|
|
output(String name,
Class<T> type,
T defaultValue,
ExecutionContext context)
Get the value for the named output to this function. |
|
|
output(String name,
PropertyType type,
T defaultValue,
ExecutionContext context)
Get the value for the named output to this function. |
|
Map<String,Serializable> |
outputs()
The unmodifiable map of input parameter name to value. |
|
void |
setActualLocationOfNode(Location actual)
Sets the actual and complete location of the node whose children and properties have been read. |
|
Serializable |
setOutput(String name,
Serializable value)
Set the value for the named output parameter for the function. |
|
String |
toString()
|
Methods inherited from class org.modeshape.graph.request.Request |
---|
checkNotFrozen, freeze, getError, hasError, isCancelled, isFrozen, printable, printable, setError, setLatchForFreezing |
Methods inherited from class java.lang.Object |
---|
finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public FunctionRequest(Function function, Location at, String workspaceName, Map<String,Serializable> inputs)
function
- the function to be performedat
- the location of the node to be readworkspaceName
- the name of the workspace containing the nodeinputs
- the immutable map of input names to values for the function invocation, or null if there are no inputs
IllegalArgumentException
- if the function, location or workspace name is nullMethod Detail |
---|
public boolean isReadOnly()
isReadOnly
in class Request
Request.isReadOnly()
public Location at()
public String inWorkspace()
public Map<String,Serializable> inputs()
public Object input(String name)
name
- the name of the input parameter
public <T> T input(String name, Class<T> type, T defaultValue, ExecutionContext context)
PropertyType
, then the
value will be converted to the specified type using the ExecutionContext
's ValueFactories
. Otherwise, the
value will simply be cast to the supplied type.
T
- the desired type of the valuename
- the name of the input parametertype
- the expected type of the valuedefaultValue
- the default value to use, if the input doesn't have the named parametercontext
- the execution context to be used for converting the value; may not be null
ValueFormatException
- if the conversion from to the expected value could not be performedpublic <T> T input(String name, PropertyType type, T defaultValue, ExecutionContext context)
ExecutionContext
's ValueFactories
.
T
- the desired type of the valuename
- the name of the input parametertype
- the expected type of the valuedefaultValue
- the default value to use, if the input doesn't have the named parametercontext
- the execution context to be used for converting the value; may not be null
ValueFormatException
- if the conversion from to the expected value could not be performedpublic Function function()
public Map<String,Serializable> outputs()
public Object output(String name)
name
- the name of the output parameter
public <T> T output(String name, Class<T> type, ExecutionContext context)
T
- the desired type of the valuename
- the name of the output parametertype
- the expected type of the value used to convert the actual value using thecontext
- the execution context to be used for converting the value; may not be null
ValueFormatException
- if the conversion from to the expected value could not be performedpublic <T> T output(String name, Class<T> type, T defaultValue, ExecutionContext context)
T
- the desired type of the valuename
- the name of the output parametertype
- the expected type of the value used to convert the actual value using thedefaultValue
- the default value for the output parameter, if there is no such named parametercontext
- the execution context to be used for converting the value; may not be null
ValueFormatException
- if the conversion from to the expected value could not be performedpublic <T> T output(String name, PropertyType type, T defaultValue, ExecutionContext context)
ExecutionContext
's ValueFactories
.
This is a convenience method, as the value would have already been set by the same function invocation using
setOutput(String, Serializable)
.
T
- the desired type of the valuename
- the name of the output parametertype
- the expected type of the valuedefaultValue
- the default value for the output parameter, if there is no such named parametercontext
- the execution context to be used for converting the value; may not be null
ValueFormatException
- if the conversion from to the expected value could not be performedpublic Serializable setOutput(String name, Serializable value)
name
- the name of the output parameter; may not be nullvalue
- the value for the named parameter; may be null
IllegalArgumentException
- if the name is null or empty
IllegalStateException
- if the request is frozenpublic void addActualRequest(Request request)
Processor
and should not be called elsewhere.
request
- the request
IllegalArgumentException
- if the request reference is nullpublic void addActualRequests(Iterable<Request> requests)
Processor
and should not be called elsewhere.
requests
- the requests
IllegalArgumentException
- if the requests reference is nullpublic int getActualRequestCount()
public Iterator<Request> getActualRequests()
change requests
.
public void setActualLocationOfNode(Location actual)
path
.
actual
- the actual location of the node being read, or null if the current location
should be used
IllegalArgumentException
- if the actual location is null or does not have a path.
IllegalStateException
- if the request is frozenpublic Location getActualLocationOfNode()
public void cancel()
cancellation flag
is set, and any current or
future processing of the request may be affected by the cancellation. (Note however, that processors may choose to not
respect this request.)
This method is safe to be called by different threads.
cancel
in class Request
Request.cancel()
public int hashCode()
hashCode
in class Object
Object.hashCode()
public boolean equals(Object obj)
equals
in class Object
Object.equals(java.lang.Object)
public String toString()
toString
in class Object
Object.toString()
public RequestType getType()
Request
getType
in class Request
public FunctionRequest clone()
This method does not clone the results.
clone
in class Object
protected final <T> T convert(String name, Class<T> type, T defaultValue, Map<String,Serializable> values, ExecutionContext context)
protected final <T> T convert(String name, PropertyType type, T defaultValue, Map<String,Serializable> values, ExecutionContext context)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |