首页>代码>spring mvc-showcase,便于学习springmvc,maven工程,建议使用谷歌浏览器>/spring-mvc-showcase/src/main/java/org/springframework/samples/mvc/convert/JavaBean.java
package org.springframework.samples.mvc.convert;

import java.util.Date;
import java.util.List;
import java.util.Map;

import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.format.annotation.DateTimeFormat.ISO;

public class JavaBean {
	
	private Integer primitive;
	
	@DateTimeFormat(iso=ISO.DATE)
	private Date date;

	@MaskFormat("(###) ###-####")
	private String masked;

	// list will auto-grow as its dereferenced e.g. list[0]=value
	private List<Integer> list;

	// annotation type conversion rule will be applied to each list element
	@DateTimeFormat(iso=ISO.DATE)
	private List<Date> formattedList;

	// map will auto-grow as its dereferenced e.g. map[key]=value
	private Map<Integer, String> map;

	// nested will be set when it is referenced e.g. nested.foo=value
	private NestedBean nested;

    public Integer getPrimitive() {
		return primitive;
	}

	public void setPrimitive(Integer primitive) {
		this.primitive = primitive;
	}

	public Date getDate() {
		return date;
	}

	public void setDate(Date date) {
		this.date = date;
	}

	public String getMasked() {
		return masked;
	}

	public void setMasked(String masked) {
		this.masked = masked;
	}

	public List<Integer> getList() {
		return list;
	}

	public void setList(List<Integer> list) {
		this.list = list;
	}

	public List<Date> getFormattedList() {
		return formattedList;
	}

	public void setFormattedList(List<Date> formattedList) {
		this.formattedList = formattedList;
	}

	public Map<Integer, String> getMap() {
		return map;
	}

	public void setMap(Map<Integer, String> map) {
		this.map = map;
	}

	public NestedBean getNested() {
		return nested;
	}

	public void setNested(NestedBean nested) {
		this.nested = nested;
	}

	public String toString() {
        StringBuilder sb = new StringBuilder();
        sb.append("JavaBean");
        if (primitive != null) {
        	sb.append(" primitive=").append(primitive);
        }
        if (date != null) {
            sb.append(" date=").append(date);        	
        }
        if (masked != null) {
        	sb.append(" masked=").append(masked);
        }
        if (list != null) {
            sb.append(" list=").append(list);        	
        }
        if (formattedList != null) {
            sb.append(" formattedList=").append(formattedList);        	
        }
        if (map != null) {
            sb.append(" map=").append(map);       	
        }
        if (nested != null) {        	
            sb.append(" nested=").append(nested);
        }
        return sb.toString();
    }
}
最近下载更多
lwp011  LV27 2020年7月7日
truenoakina123  LV3 2019年10月17日
其他昵称  LV10 2018年8月31日
chinafjfzlj  LV31 2017年9月7日
shifukuan  LV10 2017年9月1日
sevenvsky  LV27 2016年12月29日
huangguoqiang  LV1 2016年8月19日
huachen  LV2 2016年5月29日
luoshaoke  LV1 2016年4月14日
jefferyqjy  LV1 2015年12月13日
最近浏览更多
a1677596408  LV23 2022年7月1日
twedss 2022年6月17日
暂无贡献等级
anbangchen89  LV2 2022年3月3日
535871265 2022年1月10日
暂无贡献等级
HCY666  LV2 2021年12月22日
1727779658  LV7 2021年12月20日
Hadoop_CPU  LV6 2021年11月29日
fengzhou888  LV5 2021年11月26日
2532467971  LV2 2021年10月14日
王东东  LV17 2021年3月21日
顶部 客服 微信二维码 底部
>扫描二维码关注最代码为好友扫描二维码关注最代码为好友