Java Code Examples for org.springframework.web.bind.annotation.ValueConstants#DEFAULT_NONE

The following examples show how to use org.springframework.web.bind.annotation.ValueConstants#DEFAULT_NONE . 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: RequestAttributeMethodArgumentResolver.java    From java-technology-stack with MIT License 4 votes vote down vote up
@Override
protected NamedValueInfo createNamedValueInfo(MethodParameter parameter) {
	RequestAttribute ann = parameter.getParameterAnnotation(RequestAttribute.class);
	Assert.state(ann != null, "No RequestAttribute annotation");
	return new NamedValueInfo(ann.name(), ann.required(), ValueConstants.DEFAULT_NONE);
}
 
Example 2
Source File: SessionAttributeMethodArgumentResolver.java    From lams with GNU General Public License v2.0 4 votes vote down vote up
@Override
protected NamedValueInfo createNamedValueInfo(MethodParameter parameter) {
	SessionAttribute ann = parameter.getParameterAnnotation(SessionAttribute.class);
	return new NamedValueInfo(ann.name(), ann.required(), ValueConstants.DEFAULT_NONE);
}
 
Example 3
Source File: RequestParamMethodArgumentResolver.java    From spring4-understanding with Apache License 2.0 4 votes vote down vote up
public RequestParamNamedValueInfo() {
	super("", false, ValueConstants.DEFAULT_NONE);
}
 
Example 4
Source File: MvcAnnotationPredicates.java    From java-technology-stack with MIT License 4 votes vote down vote up
public MatrixVariablePredicate noPathVar() {
	this.pathVar = ValueConstants.DEFAULT_NONE;
	return this;
}
 
Example 5
Source File: RequestParamMethodArgumentResolver.java    From java-technology-stack with MIT License 4 votes vote down vote up
public RequestParamNamedValueInfo() {
	super("", false, ValueConstants.DEFAULT_NONE);
}
 
Example 6
Source File: PathVariableMethodArgumentResolver.java    From java-technology-stack with MIT License 4 votes vote down vote up
public PathVariableNamedValueInfo(PathVariable annotation) {
	super(annotation.name(), annotation.required(), ValueConstants.DEFAULT_NONE);
}
 
Example 7
Source File: ApiClientMethod.java    From onetwo with Apache License 2.0 4 votes vote down vote up
protected void handleArg(MultiValueMap<String, Object> values, ApiClientMethodParameter mp, final Object pvalue, boolean parameterNameAsPrefix){
		if(pvalue instanceof ApiArgumentTransformer){
			Object val = ((ApiArgumentTransformer)pvalue).asApiValue();
			values.add(mp.getParameterName(), val);
			return ;
		}
		
		String prefix = "";
		Object paramValue = pvalue;
		//下列情况,强制使用名称作为前缀
		if(mp.hasParameterAnnotation(RequestParam.class)){
			RequestParam params = mp.getParameterAnnotation(RequestParam.class);
			if(pvalue==null && params.required() && (paramValue=params.defaultValue())==ValueConstants.DEFAULT_NONE){
				throw new BaseException("parameter["+params.name()+"] must be required : " + mp.getParameterName());
			}
			parameterNameAsPrefix = true;
		}else if(isUriVariables(mp) || mp.hasParameterAnnotation(FieldName.class)){
			parameterNameAsPrefix = true;
		}else if(beanToMapConvertor.isMappableValue(pvalue)){//可直接映射为值的参数
			parameterNameAsPrefix = true;
		}
		
		if(parameterNameAsPrefix){
			prefix = mp.getParameterName();
		}
		beanToMapConvertor.flatObject(prefix, paramValue, (k, v, ctx)->{
			values.add(k, v);
		});
		
		/*if(falatable){
//			beanToMapConvertor.flatObject(mp.getParameterName(), paramValue, (k, v, ctx)->{
			beanToMapConvertor.flatObject(mp.getParameterName(), paramValue, (k, v, ctx)->{
				if(v instanceof Enum){
					Enum<?> e = (Enum<?>)v;
					if(e instanceof ValueEnum){
						v = ((ValueEnum<?>)e).getValue();
					}else{//默认使用name
						v = e.name();
					}
				}else if(v instanceof Resource){
					//ignore,忽略,不转为string
				}else{
					v = v.toString();
				}
				if(ctx!=null){
//					System.out.println("ctx.getName():"+ctx.getName());
					values.add(ctx.getName(), v);
				}else{
					values.add(k, v);
				}
//				values.add(k, v);
			});
		}else{
			values.add(mp.getParameterName(), pvalue);
		}*/
	}
 
Example 8
Source File: SessionAttributeMethodArgumentResolver.java    From java-technology-stack with MIT License 4 votes vote down vote up
@Override
protected NamedValueInfo createNamedValueInfo(MethodParameter parameter) {
	SessionAttribute ann = parameter.getParameterAnnotation(SessionAttribute.class);
	Assert.state(ann != null, "No SessionAttribute annotation");
	return new NamedValueInfo(ann.name(), ann.required(), ValueConstants.DEFAULT_NONE);
}
 
Example 9
Source File: PathVariableMethodArgumentResolver.java    From java-technology-stack with MIT License 4 votes vote down vote up
public PathVariableNamedValueInfo(PathVariable annotation) {
	super(annotation.name(), annotation.required(), ValueConstants.DEFAULT_NONE);
}
 
Example 10
Source File: RequestParamMethodArgumentResolver.java    From java-technology-stack with MIT License 4 votes vote down vote up
RequestParamNamedValueInfo() {
	super("", false, ValueConstants.DEFAULT_NONE);
}
 
Example 11
Source File: RequestParamMethodArgumentResolver.java    From lams with GNU General Public License v2.0 4 votes vote down vote up
public RequestParamNamedValueInfo() {
	super("", false, ValueConstants.DEFAULT_NONE);
}
 
Example 12
Source File: SessionAttributeMethodArgumentResolver.java    From java-technology-stack with MIT License 4 votes vote down vote up
@Override
protected NamedValueInfo createNamedValueInfo(MethodParameter parameter) {
	SessionAttribute ann = parameter.getParameterAnnotation(SessionAttribute.class);
	Assert.state(ann != null, "No SessionAttribute annotation");
	return new NamedValueInfo(ann.name(), ann.required(), ValueConstants.DEFAULT_NONE);
}
 
Example 13
Source File: MvcAnnotationPredicates.java    From spring-analysis-note with MIT License 4 votes vote down vote up
public MatrixVariablePredicate noPathVar() {
	this.pathVar = ValueConstants.DEFAULT_NONE;
	return this;
}
 
Example 14
Source File: RequestAttributeMethodArgumentResolver.java    From lams with GNU General Public License v2.0 4 votes vote down vote up
@Override
protected NamedValueInfo createNamedValueInfo(MethodParameter parameter) {
	RequestAttribute ann = parameter.getParameterAnnotation(RequestAttribute.class);
	return new NamedValueInfo(ann.name(), ann.required(), ValueConstants.DEFAULT_NONE);
}
 
Example 15
Source File: PathVariableMethodArgumentResolver.java    From spring-analysis-note with MIT License 4 votes vote down vote up
public PathVariableNamedValueInfo(PathVariable annotation) {
	super(annotation.name(), annotation.required(), ValueConstants.DEFAULT_NONE);
}
 
Example 16
Source File: RequestAttributeMethodArgumentResolver.java    From spring-analysis-note with MIT License 4 votes vote down vote up
@Override
protected NamedValueInfo createNamedValueInfo(MethodParameter parameter) {
	RequestAttribute ann = parameter.getParameterAnnotation(RequestAttribute.class);
	Assert.state(ann != null, "No RequestAttribute annotation");
	return new NamedValueInfo(ann.name(), ann.required(), ValueConstants.DEFAULT_NONE);
}
 
Example 17
Source File: SessionAttributeMethodArgumentResolver.java    From spring-analysis-note with MIT License 4 votes vote down vote up
@Override
protected NamedValueInfo createNamedValueInfo(MethodParameter parameter) {
	SessionAttribute ann = parameter.getParameterAnnotation(SessionAttribute.class);
	Assert.state(ann != null, "No SessionAttribute annotation");
	return new NamedValueInfo(ann.name(), ann.required(), ValueConstants.DEFAULT_NONE);
}
 
Example 18
Source File: PathVariableMethodArgumentResolver.java    From spring-analysis-note with MIT License 4 votes vote down vote up
public PathVariableNamedValueInfo(PathVariable annotation) {
	super(annotation.name(), annotation.required(), ValueConstants.DEFAULT_NONE);
}
 
Example 19
Source File: RequestParamMethodArgumentResolver.java    From spring-analysis-note with MIT License 4 votes vote down vote up
RequestParamNamedValueInfo() {
	super("", false, ValueConstants.DEFAULT_NONE);
}
 
Example 20
Source File: RequestAttributeMethodArgumentResolver.java    From spring-analysis-note with MIT License 4 votes vote down vote up
@Override
protected NamedValueInfo createNamedValueInfo(MethodParameter parameter) {
	RequestAttribute ann = parameter.getParameterAnnotation(RequestAttribute.class);
	Assert.state(ann != null, "No RequestAttribute annotation");
	return new NamedValueInfo(ann.name(), ann.required(), ValueConstants.DEFAULT_NONE);
}