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

EclipseのMavenを使った、Spring-MVC、Thymeleaf、MyBatis 等のプログラミングテクニックを、
備忘録的に記録しています。実際に動くソースコードを多用して説明していますので、
これからEclipseや、Spring-MVCを始めたいと思っている人にとって、少しでも参考になれば幸いです。
Spring-MVCの散歩道 > 応用の森(JSON編) > JSONデータ構造から動的クラス生成

package jp.dip.arimodoki.model;

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

/**
 * 都道府県情報のサーブレットリクエスト/レスポンス情報を格納するデータモデルクラス
 */
@Scope("prototype")
@Component
public final class FormZip implements FormZipIf {
	/**
	 * リクエストパラメータ格納クラス
	 * 画面で指定された地域コードが格納される
	 */
	@Autowired
	private JsonReqAreaIf		jsonReqArea;

	public JsonReqAreaIf getJsonReqArea() {
		return jsonReqArea;
	}

	public void setJsonReqArea(JsonReqAreaIf jsonReqArea) {
		this.jsonReqArea = jsonReqArea;
	}

	/**
	 * レスポンス用 都道府県情報リスト
	 * どのような型でも保持できるようにObject型とする
	 * ここでは、prefcd/prefnm/areacdのプロパティを持つクラスの配列を期待している
	 */
	private Object prefList;

	public Object getPrefList() {
		return prefList;
	}

	public void setPrefList(Object prefList) {
		this.prefList = prefList;
	}
}