Java Code Examples for org.apache.velocity.util.introspection.VelMethod

The following examples show how to use org.apache.velocity.util.introspection.VelMethod. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: ApprovalTests.Java   Source File: TestableUberspect.java    License: Apache License 2.0 6 votes vote down vote up
public VelMethod getMethod(Object obj, String methodName, Object[] args, Info i) throws Exception
{
  if (obj == null)
  {
    if (beKindToNulls)
    {
      return null;
    }
    else
    {
      throw new VelocityParsingError("tried " + getMethodText("null", methodName, args), i);
    }
  }
  Method m = introspector.getMethod(obj.getClass(), methodName, args);
  if (m == null)
  {
    throw new VelocityParsingError(
        "Method " + getMethodText(obj.getClass().getName(), methodName, args) + " does not exist.", i);
  }
  return new VelMethodImpl(m);
}
 
Example 2
@Override
public VelMethod getMethod(Object obj, String methodName, Object[] args, Info info) throws Exception {
	
	if( isRuntimeCheckEnabled()) {
		checkRestrictedPackage( obj);

		if( this.packageChecker.includePackage( obj.getClass().getPackage())) {
			checkMethodAccess( obj, methodName, args, info);
		}
	}
	
	return super.getMethod(obj, methodName, args, info);
}
 
Example 3
Source Project: velocity-engine   Source File: UberspectTestImpl.java    License: Apache License 2.0 5 votes vote down vote up
public VelMethod getMethod(Object obj, String methodName, Object[] args, Info i)
{
    VelMethod method = super.getMethod(obj, methodName, args, i);

    if (method == null)
    {
        if (obj == null)
            throw new UberspectTestException("Can't call method '" + methodName + "' on null object",i);
        else
            throw new UberspectTestException("Did not find method "+ obj.getClass().getName()+"."+methodName, i);
    }

    return method;
}
 
Example 4
@Override
public VelMethod getMethod(Object obj, String method, Object[] args, Info info) throws Exception {
	return uberspector.getMethod( obj, method, args, info);
}
 
Example 5
Source Project: ApprovalTests.Java   Source File: TestableUberspect.java    License: Apache License 2.0 4 votes vote down vote up
public VelSetterImpl(VelMethod velmethod)
{
  this.vm = velmethod;
}
 
Example 6
Source Project: ApprovalTests.Java   Source File: TestableUberspect.java    License: Apache License 2.0 4 votes vote down vote up
public VelSetterImpl(VelMethod velmethod, String key)
{
  this.vm = velmethod;
  putKey = key;
}