Java Code Examples for org.springframework.expression.spel.SpelMessage#METHOD_NOT_FOUND

The following examples show how to use org.springframework.expression.spel.SpelMessage#METHOD_NOT_FOUND . 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: MethodReference.java    From lams with GNU General Public License v2.0 6 votes vote down vote up
private MethodExecutor findAccessorForMethod(String name, List<TypeDescriptor> argumentTypes,
		Object targetObject, EvaluationContext evaluationContext) throws SpelEvaluationException {

	List<MethodResolver> methodResolvers = evaluationContext.getMethodResolvers();
	if (methodResolvers != null) {
		for (MethodResolver methodResolver : methodResolvers) {
			try {
				MethodExecutor methodExecutor = methodResolver.resolve(
						evaluationContext, targetObject, name, argumentTypes);
				if (methodExecutor != null) {
					return methodExecutor;
				}
			}
			catch (AccessException ex) {
				throw new SpelEvaluationException(getStartPosition(), ex,
						SpelMessage.PROBLEM_LOCATING_METHOD, name, targetObject.getClass());
			}
		}
	}

	throw new SpelEvaluationException(getStartPosition(), SpelMessage.METHOD_NOT_FOUND,
			FormatHelper.formatMethodForMessage(name, argumentTypes),
			FormatHelper.formatClassNameForMessage(
					targetObject instanceof Class ? ((Class<?>) targetObject) : targetObject.getClass()));
}
 
Example 2
Source File: MethodReference.java    From spring4-understanding with Apache License 2.0 6 votes vote down vote up
private MethodExecutor findAccessorForMethod(String name, List<TypeDescriptor> argumentTypes,
		Object targetObject, EvaluationContext evaluationContext) throws SpelEvaluationException {

	List<MethodResolver> methodResolvers = evaluationContext.getMethodResolvers();
	if (methodResolvers != null) {
		for (MethodResolver methodResolver : methodResolvers) {
			try {
				MethodExecutor methodExecutor = methodResolver.resolve(
						evaluationContext, targetObject, name, argumentTypes);
				if (methodExecutor != null) {
					return methodExecutor;
				}
			}
			catch (AccessException ex) {
				throw new SpelEvaluationException(getStartPosition(), ex,
						SpelMessage.PROBLEM_LOCATING_METHOD, name, targetObject.getClass());
			}
		}
	}

	throw new SpelEvaluationException(getStartPosition(), SpelMessage.METHOD_NOT_FOUND,
			FormatHelper.formatMethodForMessage(name, argumentTypes),
			FormatHelper.formatClassNameForMessage(
					targetObject instanceof Class ? ((Class<?>) targetObject) : targetObject.getClass()));
}
 
Example 3
Source File: MethodReference.java    From spring-analysis-note with MIT License 5 votes vote down vote up
private MethodExecutor findAccessorForMethod(List<TypeDescriptor> argumentTypes, Object targetObject,
		EvaluationContext evaluationContext) throws SpelEvaluationException {

	AccessException accessException = null;
	List<MethodResolver> methodResolvers = evaluationContext.getMethodResolvers();
	for (MethodResolver methodResolver : methodResolvers) {
		try {
			MethodExecutor methodExecutor = methodResolver.resolve(
					evaluationContext, targetObject, this.name, argumentTypes);
			if (methodExecutor != null) {
				return methodExecutor;
			}
		}
		catch (AccessException ex) {
			accessException = ex;
			break;
		}
	}

	String method = FormatHelper.formatMethodForMessage(this.name, argumentTypes);
	String className = FormatHelper.formatClassNameForMessage(
			targetObject instanceof Class ? ((Class<?>) targetObject) : targetObject.getClass());
	if (accessException != null) {
		throw new SpelEvaluationException(
				getStartPosition(), accessException, SpelMessage.PROBLEM_LOCATING_METHOD, method, className);
	}
	else {
		throw new SpelEvaluationException(getStartPosition(), SpelMessage.METHOD_NOT_FOUND, method, className);
	}
}
 
Example 4
Source File: MethodReference.java    From java-technology-stack with MIT License 5 votes vote down vote up
private MethodExecutor findAccessorForMethod(List<TypeDescriptor> argumentTypes, Object targetObject,
		EvaluationContext evaluationContext) throws SpelEvaluationException {

	AccessException accessException = null;
	List<MethodResolver> methodResolvers = evaluationContext.getMethodResolvers();
	for (MethodResolver methodResolver : methodResolvers) {
		try {
			MethodExecutor methodExecutor = methodResolver.resolve(
					evaluationContext, targetObject, this.name, argumentTypes);
			if (methodExecutor != null) {
				return methodExecutor;
			}
		}
		catch (AccessException ex) {
			accessException = ex;
			break;
		}
	}

	String method = FormatHelper.formatMethodForMessage(this.name, argumentTypes);
	String className = FormatHelper.formatClassNameForMessage(
			targetObject instanceof Class ? ((Class<?>) targetObject) : targetObject.getClass());
	if (accessException != null) {
		throw new SpelEvaluationException(
				getStartPosition(), accessException, SpelMessage.PROBLEM_LOCATING_METHOD, method, className);
	}
	else {
		throw new SpelEvaluationException(getStartPosition(), SpelMessage.METHOD_NOT_FOUND, method, className);
	}
}