com.sapportals.wcm.util.factories

Class ReflectionUtils

java.lang.Object
  extended bycom.sapportals.wcm.util.factories.ReflectionUtils

public class ReflectionUtils
extends Object

A wrapper for reflection methods with an WcmException .

Copyright (c) SAP AG 2001-2002


Field Summary
static String CONFIG_CLASSNAME_TAG
          Property tag for the classname parameter in the configuration data.
 
Constructor Summary
ReflectionUtils()
           
 
Method Summary
static Object callMethod(String logName, Object object, Method method, Object[] parameters)
          Call an object's / classes' method.
static Object callStaticMethod(String logName, Method method, Object[] parameters)
          Call a classes' static method.
static String getDefaultGetInstanceMethodName()
          Get the default name for the getInstance method.
static Properties getSubProperties(Properties properties, String base)
          Get a part of the configuration for specific base-prefix from the properties (extract only those properties prefixed by base ).
static Class loadClass(String logName, String className)
          Deprecated. as of NW04. Use CrtClassLoaderRegistry instead.
static Constructor loadConstructor(String logName, Class classObject, Class[] parameterTypes)
          Get a classes' constructor.
static Method loadMethod(String logName, Class classObject, String methodName, Class[] parameterTypes)
          Get a classes' method.
static Object newObject(String logName, Constructor constructor, 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 String CONFIG_CLASSNAME_TAG
Property tag for the classname parameter in the configuration data.

See Also:
Constant Field Values
Constructor Detail

ReflectionUtils

public ReflectionUtils()
Method Detail

getDefaultGetInstanceMethodName

public static String getDefaultGetInstanceMethodName()
Get the default name for the getInstance method.

Returns:
a String with the default name of the getInstance() method.

loadClass

public static Class loadClass(String logName,
                              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 Constructor loadConstructor(String logName,
                                          Class classObject,
                                          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 Method loadMethod(String logName,
                                Class classObject,
                                String methodName,
                                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 Object callMethod(String logName,
                                Object object,
                                Method method,
                                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 Object callStaticMethod(String logName,
                                      Method method,
                                      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 Object newObject(String logName,
                               Constructor constructor,
                               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 Properties getSubProperties(Properties properties,
                                          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.


Copyright 2006 SAP AG. All rights reserved. No part of this publication may be reproduced or transmitted in any form or for any purpose without the express permission of SAP AG. The information contained herein may be changed without prior notice. Microsoft, Windows, Outlook, and PowerPoint are registered trademarks of Microsoft Corporation. Oracle is a registered trademark of Oracle Corporation. UNIX, X/Open, OSF/1, and Motif are registered trademarks of the Open Group. Citrix, ICA, Program Neighborhood, MetaFrame, WinFrame, VideoFrame, and MultiWin are trademarks or registered trademarks of Citrix Systems, Inc. HTML, XML, XHTML and W3C are trademarks or registered trademarks of W3C, World Wide Web Consortium, Massachusetts Institute of Technology. Java is a registered trademark of Sun Microsystems, Inc. JavaScript is a registered trademark of Sun Microsystems, Inc., used under license for technology invented and implemented by Netscape. MaxDB is a trademark of MySQL AB, Sweden. 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.