if ( attEval == null ) {
attEval = new XDefaultAttributeEvaluator( currentProject );
attEval.setCurrentProject( currentProject );
currentProject.setObject( "DefaultAttributeEvaluator", attEval );
}
XMethodReference methodRef = attEval.getMethodReference( (PageSupport)container, className + "." + methodName );
return methodRef;
}
else if ( className.startsWith( "Script" ) ) {
XMethodReference methodRef = null;
try {
XAttributeEvaluator attEval = (XAttributeEvaluator)currentProject.getObject( "ScriptAttributeEvaluator" );
if ( attEval == null ) {
attEval = (XAttributeEvaluator)XEventHandler.class.forName( "incubator.net.xoetrope.scripts.ScriptAttributeEvaluator" ).newInstance();
attEval.setCurrentProject( currentProject );
currentProject.setObject( "ScriptAttributeEvaluator", attEval );
}
methodRef = attEval.getMethodReference( methodName );
}
catch ( Throwable t ) {
}
return methodRef;
}
else {
Method method = null;
if ( clazz == null )
clazz = Class.forName( className.trim());
if ( methodName.endsWith( "}" ) )
methodName = methodName.substring( 0, methodName.length() - 1 );
if ( methodName.endsWith( "()" ) )
methodName = methodName.substring( 0, methodName.length() - 2 );
int pos;
if ( ( pos = methodName.indexOf( "(" ) ) > 0 ) {
String argValues = methodName.substring( pos + 1, methodName.indexOf( ')' ) );
int numArgs = 1 + XuiUtilities.count( argValues, ',' );
Object[] args = new Object[numArgs];
Class[] params = new Class[numArgs];
XuiUtilities.getArguments( argValues, params, args, ',' );
methodName = methodName.substring( 0, pos );
method = clazz.getMethod( methodName, params );
return new XMethodReference( clazz, container, method, args );
}
else
method = clazz.getMethod( methodName, (Class[])null );
return new XMethodReference( clazz, container, method, null );
}
}