com.esri.adf.web.data.results
Class ResultDescriptor

java.lang.Object
  extended by java.beans.FeatureDescriptor
      extended by com.esri.adf.web.data.results.ResultDescriptor
All Implemented Interfaces:
Serializable

public class ResultDescriptor
extends FeatureDescriptor
implements Serializable

The ResultDescriptor contains the metadata for the result object wrapped by the ResultNode object. The metadata includes methods on the result object for the display name, details, actions and on-remove.

The ResultNode uses this metadata to invoke the appropriate methods on the wrapped result object.

When one calls the addXXX() methods on the WebResults, the ResultDescriptor objects are internally created for the caller. However, you can always create the ResultDescriptor object yourself and set it on the associated ResultNode.

See Also:
Serialized Form

Field Summary
static ResultDescriptor STRING_RESULT_DESCRIPTOR
           A convenience ResultDescriptor for string results.
 
Constructor Summary
ResultDescriptor(Class resultClass, String displayNameMethodName, String detailsMethodName, Map<String,String> actionMethodNames, String onRemoveMethodName)
           Creates a new ResultDescriptor object for the given resultClass and the designated method names.
 
Method Summary
 Method getActionMethod(String actionName)
           Returns the Method corresponding to the given actionName.
 Map<String,Method> getActionMethods()
           Returns the java.util.Map of <action name>-<action method> pairs associated with this result.
 List<String> getActionNames()
           Returns the List of action names associated with this result.
 Map<String,Object> getDetails(Object result)
           Returns the details for the given result.
 Method getDetailsMethod()
           Returns the details Method associated with this result.
 String getDisplayName(Object result)
           Returns the display name for the given result.
 Method getDisplayNameMethod()
           Returns the display name Method associated with this result.
 Method getOnRemoveMethod()
           Returns the on-remove Method associated with this result.
 Object onRemove(Object result)
           Invokes the designated on-remove method on the given result.
 Object processAction(Object result, String actionName)
           Invokes the action on the given result corresponding to the given actionName.
 String toString()
           
 
Methods inherited from class java.beans.FeatureDescriptor
attributeNames, getDisplayName, getName, getShortDescription, getValue, isExpert, isHidden, isPreferred, setDisplayName, setExpert, setHidden, setName, setPreferred, setShortDescription, setValue
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

STRING_RESULT_DESCRIPTOR

public static ResultDescriptor STRING_RESULT_DESCRIPTOR

A convenience ResultDescriptor for string results.

Constructor Detail

ResultDescriptor

public ResultDescriptor(Class resultClass,
                        String displayNameMethodName,
                        String detailsMethodName,
                        Map<String,String> actionMethodNames,
                        String onRemoveMethodName)

Creates a new ResultDescriptor object for the given resultClass and the designated method names.

Parameters:
resultClass - the Class of the result object
displayNameMethodName - the name of the method which returns the display text for the result
detailsMethodName - the name of the method which returns the result details as a java.util.Map of name-value pairs
actionMethodNames - an array of names of methods for performing actions on the result
onRemoveMethodName - the name of the method to be called when the result is removed
Throws:
ADFException - if the given method names do not conform with the set rules for the designated methods
Method Detail

getDisplayName

public String getDisplayName(Object result)

Returns the display name for the given result.

The display name is retrieved by invoking the desginated method name on the result.

Parameters:
result - the result for which the display name is to be returned
Returns:
the display name for the given result
Throws:
ADFException - if an exception occurred while getting the display name

getDetails

public Map<String,Object> getDetails(Object result)

Returns the details for the given result. The details are represented as a java.util.Map of name-value pairs.

The details are retrieved by invoking the desginated method name on the result.

Parameters:
result - the result for which the details are to be returned
Returns:
a java.util.Map of name-value pairs
Throws:
ADFException - if an exception occurred while getting the details

processAction

public Object processAction(Object result,
                            String actionName)

Invokes the action on the given result corresponding to the given actionName.

Parameters:
result - the result on which the action is to be invoked
actionName - the name corresponding to which the action is to be invoked
Returns:
the object returned by the action method invoked

onRemove

public Object onRemove(Object result)

Invokes the designated on-remove method on the given result.

Parameters:
result - the result on which the on-remove method is to be invoked
Returns:
the object returned by the on-remove method invoked

getActionMethod

public Method getActionMethod(String actionName)

Returns the Method corresponding to the given actionName.

Parameters:
actionName - the name for which the associated Method is to be returned
Returns:
the Method corresponding to the given actionName

getActionNames

public List<String> getActionNames()

Returns the List of action names associated with this result.

Returns:
the List of action names associated with this result

getActionMethods

public Map<String,Method> getActionMethods()

Returns the java.util.Map of <action name>-<action method> pairs associated with this result.

Returns:
a java.util.Map of <action name>-<action method> pairs

getDetailsMethod

public Method getDetailsMethod()

Returns the details Method associated with this result.

Returns:
the details Method associated with this result

getDisplayNameMethod

public Method getDisplayNameMethod()

Returns the display name Method associated with this result.

Returns:
the display name Method associated with this result

getOnRemoveMethod

public Method getOnRemoveMethod()

Returns the on-remove Method associated with this result.

Returns:
the on-remove Method associated with this result

toString

public String toString()
Overrides:
toString in class Object