Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
 /*
  * Copyright 2004-2008 the original author or authors.
  * 
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
  * 
  *      http://www.apache.org/licenses/LICENSE-2.0
  * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.springframework.binding.method;
A named method parameter. Each parameter has an identifying name and is of a specified type (class).

Author(s):
Keith Donald
public class Parameter {

The class of the parameter, e.g "springbank.AccountNumber".
	private Class type;

The name of the parameter as an evaluatable expression, e.g "accountNumber".
	private Expression name;

Create a new named parameter definition. Named parameters are capable of resolving parameter values (arguments) from argument sources.

Parameters:
type the parameter type, may be null
name the name the method argument expression (required)
	public Parameter(Class typeExpression name) {
		Assert.notNull(name"The parameter name expression is required");
		this. = type;
		this. = name;
	}

Returns the parameter type. Could be null if no parameter type was specified.
	public Class getType() {
		return ;
	}

Returns the parameter name.
	public Expression getName() {
		return ;
	}

Evaluate this method parameter against the provided argument source, returning a single method argument value.

Parameters:
argumentSource the method argument source
Returns:
the method argument value
	public Object evaluateArgument(Object argumentSource) {
		return .getValue(argumentSource);
	}
	public boolean equals(Object obj) {
		if (!(obj instanceof Parameter)) {
			return false;
		}
		Parameter other = (Parameterobj;
		return ObjectUtils.nullSafeEquals(other.type) && .equals(other.name);
	}
	public int hashCode() {
		return ( != null ? .hashCode() : 0) + .hashCode();
	}
	public String toString() {
		return new ToStringCreator(this).append("type").append("name").toString();
	}
New to GrepCode? Check out our FAQ X