SAP NetWeaver '04

com.sapportals.wcm.util.factories
Class ReflectionUtils

[contained in: com.sap.netweaver.bc.util.par - bc.util.public_api.jar]
java.lang.Object
  |
  +--com.sapportals.wcm.util.factories.ReflectionUtils

public class ReflectionUtils
extends java.lang.Object

A wrapper for reflection methods with an WcmException .

Copyright (c) SAP AG 2001-2002


Field Summary
static java.lang.String CONFIG_CLASSNAME_TAG
          Property tag for the classname parameter in the configuration data.
 
Constructor Summary
ReflectionUtils()
           
 
Method Summary
static java.lang.Object callMethod(java.lang.String logName, java.lang.Object object, java.lang.reflect.Method method, java.lang.Object[] parameters)
          Call an object's / classes' method.
static java.lang.Object callStaticMethod(java.lang.String logName, java.lang.reflect.Method method, java.lang.Object[] parameters)
          Call a classes' static method.
static java.lang.String getDefaultGetInstanceMethodName()
          Get the default name for the getInstance method.
static java.util.Properties getSubProperties(java.util.Properties properties, java.lang.String base)
          Get a part of the configuration for specific base-prefix from the properties (extract only those properties prefixed by base ).
static java.lang.Class loadClass(java.lang.String logName, java.lang.String className)
          Deprecated. as of NW04. Use CrtClassLoaderRegistry instead.
static java.lang.reflect.Constructor loadConstructor(java.lang.String logName, java.lang.Class classObject, java.lang.Class[] parameterTypes)
          Get a classes' constructor.
static java.lang.reflect.Method loadMethod(java.lang.String logName, java.lang.Class classObject, java.lang.String methodName, java.lang.Class[] parameterTypes)
          Get a classes' method.
static java.lang.Object newObject(java.lang.String logName, java.lang.reflect.Constructor constructor, java.lang.Object[] parameters)
          Create a new object from a class.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CONFIG_CLASSNAME_TAG

public static final java.lang.String CONFIG_CLASSNAME_TAG
Property tag for the classname parameter in the configuration data.
Constructor Detail

ReflectionUtils

public ReflectionUtils()
Method Detail

getDefaultGetInstanceMethodName

public static java.lang.String getDefaultGetInstanceMethodName()
Get the default name for the getInstance method.
Returns:
a String with the default name of the getInstance() method.

loadClass

public static java.lang.Class loadClass(java.lang.String logName,
                                        java.lang.String className)
                                 throws WcmException
Deprecated. as of NW04. Use CrtClassLoaderRegistry instead.

Load the class for a given name.
Parameters:
logName - a String with a short name for logging.
className - a String with the name of the class to load.
Returns:
the Class object loaded.
Throws:
WcmException - Exception raised in failure situation
WcmException - if the class cannot be loaded.

loadConstructor

public static java.lang.reflect.Constructor loadConstructor(java.lang.String logName,
                                                            java.lang.Class classObject,
                                                            java.lang.Class[] parameterTypes)
                                                     throws WcmException
Get a classes' constructor.
Parameters:
logName - a String with a short name for logging.
classObject - the Class object of the class to get the constructor for.
parameterTypes - an array of Class es defining the constructor's signature.
Returns:
a Constructor object with the specified constructor.
Throws:
WcmException - if the constructor cannot be loaded.

loadMethod

public static java.lang.reflect.Method loadMethod(java.lang.String logName,
                                                  java.lang.Class classObject,
                                                  java.lang.String methodName,
                                                  java.lang.Class[] parameterTypes)
                                           throws WcmException
Get a classes' method.
Parameters:
logName - a String with a short name for logging.
classObject - the Class object of the class to get the method for.
methodName - a String s with the name of the method.
parameterTypes - an array of Class es defining the method's signature.
Returns:
a Method object with the specified method.
Throws:
WcmException - if the method cannot be loaded.

callMethod

public static java.lang.Object callMethod(java.lang.String logName,
                                          java.lang.Object object,
                                          java.lang.reflect.Method method,
                                          java.lang.Object[] parameters)
                                   throws WcmException
Call an object's / classes' method.
Parameters:
logName - a String with a short name for logging.
object - the Object to call the method for or null if it's a static method.
method - the Method to call.
parameters - an array of Object s with the parameters to pass to the method.
Returns:
an Object with the result of the method or null if void.
Throws:
WcmException - if the method cannot be called.

callStaticMethod

public static java.lang.Object callStaticMethod(java.lang.String logName,
                                                java.lang.reflect.Method method,
                                                java.lang.Object[] parameters)
                                         throws WcmException
Call a classes' static method.
Parameters:
logName - a String with a short name for logging.
method - the Method to call.
parameters - an array of Object s with the parameters to pass to the method.
Returns:
an Object with the result of the method or null if void.
Throws:
WcmException - if the method cannot be called.

newObject

public static java.lang.Object newObject(java.lang.String logName,
                                         java.lang.reflect.Constructor constructor,
                                         java.lang.Object[] parameters)
                                  throws WcmException
Create a new object from a class.
Parameters:
logName - a String with a short name for logging.
constructor - the Constructor to use.
parameters - an array of Object s with the parameters to pass to the constructor.
Returns:
an Object with the newly created object.
Throws:
WcmException - Exception raised in failure situation
WcmException - if the object cannot be created.

getSubProperties

public static java.util.Properties getSubProperties(java.util.Properties properties,
                                                    java.lang.String base)
Get a part of the configuration for specific base-prefix from the properties (extract only those properties prefixed by base ).
Parameters:
base - a String with the prefix for the desired properties.
properties - TBD: Description of the incoming method parameter
Returns:
the Properties from configuration for the given base . -prefix. The keys of the returned properties are without the base-prefix.

SAP NetWeaver '04

Copyright © 2004 by SAP AG. All Rights Reserved.
SAP, R/3, mySAP, mySAP.com, xApps, xApp, SAP NetWeaver, and other SAP products and services mentioned herein as well as their respective logos are trademarks or registered trademarks of SAP AG in Germany and in several other countries all over the world. All other product and service names mentioned are the trademarks of their respective companies. Data contained in this document serves informational purposes only. National product specifications may vary.

These materials are subject to change without notice. These materials are provided by SAP AG and its affiliated companies ("SAP Group") for informational purposes only, without representation or warranty of any kind, and SAP Group shall not be liable for errors or omissions with respect to the materials. The only warranties for SAP Group products and services are those that are set forth in the express warranty statements accompanying such products and services, if any. Nothing herein should be construed as constituting an additional warranty.