JavaのWebアプリケーション開発フレームワークによる、Webサイト開発の顛末記です。

EclipseのMavenを使った、Spring-MVC、Thymeleaf、MyBatis 等のプログラミングテクニックを、
備忘録的に記録しています。実際に動くソースコードを多用して説明していますので、
これからEclipseや、Spring-MVCを始めたいと思っている人にとって、少しでも参考になれば幸いです。
Spring-MVCの散歩道 > SpringMVC の小径 > 第8歩 あと一歩 DB連携 > 邂逅の頂

package jp.dip.arimodoki.model;

import javax.validation.constraints.AssertTrue;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;

import jp.dip.arimodoki.model.dto.UserIf;

@Scope("prototype")         //魔よけのお札
@Component              //コンポーネントスキャン用のおまじない
public class PromenadeForm implements PromenadeFormIf {
    @Autowired
    @Valid    //userのプロパティに対する入力検証を行います
    private UserIf      user;       //User情報ビジネスモデルをDIする

    /**
     * DB処理タイプ
     */
    private int dbcommandType = 0;

    /**
     * CheckBox選択 必須チェック
     */
    private  String[] checkVals = new String[0];

    /**
     * checkBox の選択必須チェック
     */
    @AssertTrue(message = "どれか選ばんか~ぃ!")
    public boolean isCheckValsSelect() {
        return checkVals.length==0 ? false : true;
    }

    /**
     * 私のお気に入り
     */
    private String favorite = "";

    public UserIf getUser() {
        return user;
    }

    public void setUser(UserIf user) {
        this.user = user;
    }

    public int getDbcommandType() {
        return dbcommandType;
    }

    public void setDbcommandType(int dbcommandType) {
        this.dbcommandType = dbcommandType;
    }

    public String[] getCheckVals() {
        return checkVals;
    }

    public void setCheckVals(String[] checkVals) {
        this.checkVals = checkVals;
    }

    public String getFavorite() {
        return favorite;
    }

    public void setFavorite(String favorite) {
        this.favorite = favorite;
    }

}