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

The following examples show how to use org.apache.velocity.util.introspection.VelMethod. 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 File: TestableUberspect.java    From ApprovalTests.Java with 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
Source File: AgnVelocityUberspector.java    From openemm with GNU Affero General Public License v3.0 5 votes vote down vote up
@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 File: UberspectTestImpl.java    From velocity-engine with 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
Source File: UberspectDelegate.java    From openemm with GNU Affero General Public License v3.0 4 votes vote down vote up
@Override
public VelMethod getMethod(Object obj, String method, Object[] args, Info info) throws Exception {
	return uberspector.getMethod( obj, method, args, info);
}
 
Example #5
Source File: TestableUberspect.java    From ApprovalTests.Java with Apache License 2.0 4 votes vote down vote up
public VelSetterImpl(VelMethod velmethod)
{
  this.vm = velmethod;
}
 
Example #6
Source File: TestableUberspect.java    From ApprovalTests.Java with Apache License 2.0 4 votes vote down vote up
public VelSetterImpl(VelMethod velmethod, String key)
{
  this.vm = velmethod;
  putKey = key;
}