org.rhq.scripting
Interface MetadataProvider


public interface MetadataProvider

The scripting implementations don't have to supply an implementation of this interface but rather one is provided to the CodeCompletion.

The code completion can ask this implementation for various metadata on methods or classes.

The CodeCompletion implementations can use this information to format more meaningful completion hints.

Author:
Lukas Krejci

Method Summary
 String getDocumentation(Class<?> clazz)
           
 String getDocumentation(Method method)
           
 String getParameterName(Method method, int parameterIndex)
          Tries to determine the name of a parameter on a method.
 String getTypeName(Type type, boolean fullNames)
          This is a utility method for determining the type name including the type parameters.
 Method getUnproxiedMethod(Method method)
          Many of the objects that RHQ exposes in the scripting environment are implemented using proxies.
 

Method Detail

getUnproxiedMethod

Method getUnproxiedMethod(Method method)
Many of the objects that RHQ exposes in the scripting environment are implemented using proxies. But proxies don't seem to maintain the generic types on them.

This method tries to find out if given method comes from a proxy class and if it is, it tries to find the method in one of the interfaces that the proxy implements that corresponds to it. That method is going to have all the metadata - i.e. annotations, generics, etc.

Parameters:
method - the method to inspect
Returns:
the method from one of the interfaces implemented by the given method's declaring class or the given method itself if it is not proxied.

getParameterName

String getParameterName(Method method,
                        int parameterIndex)
Tries to determine the name of a parameter on a method.

Parameters:
method - the method
parameterIndex - the index of the method parameter
Returns:
The name of the parameter or null if it could not be determined

getDocumentation

String getDocumentation(Class<?> clazz)
Parameters:
clazz -
Returns:
the (java)doc on a class or null if none could be determined

getDocumentation

String getDocumentation(Method method)
Parameters:
method -
Returns:
the (java)doc on a method or null if none could be determined

getTypeName

String getTypeName(Type type,
                   boolean fullNames)
This is a utility method for determining the type name including the type parameters.

Parameters:
type - the type to determine the name for
fullNames - if true, all the types and type parameters will be the full class names, otherwise only the simple name of the class / type parameter will be used.
Returns:
the name of the type including type parameters


Copyright © 2008-2012 Red Hat, Inc.. All Rights Reserved.