import java.util.HashMap;
import java.util.Map;
import org.apache.commons.lang.ArrayUtils;
public class TestOfMap {
/** 対応コード : XX1 */
private static final Map<String, String> cdValOfXx1 = new HashMap<String, String>() {
{
put("new01", "old01");
put("new02", "old01");
put("new03", "old01");
put("new04", "old01");
put("new05", "old01");
}
};
/** 対応コード:XX2 */
private static final Map<String, String> cdValOfXx2 = new HashMap<String, String>() {
{
put("new11", "old11");
put("new12", "old11");
put("new13", "old11");
put("new14", "old11");
put("new15", "old11");
}
};
/** コード */
private static final Map<String, Map<String, String>> cdOfXx1 = new HashMap<String, Map<String, String>>() {
{
put("101", cdValOfXx1);
put("201", cdValOfXx2);
}
};
/** データリストXxx1 */
private static final String[] tblListOfXx1 = {
Tbl1Entity.class.getSimpleName(), Tbl2Entity.class.getSimpleName(),
Tbl3Entity.class.getSimpleName(), };
/** データリストXxx2「 */
public static final String[] tblListOfXx2 = {
Tbl1Entity.class.getSimpleName(), Tbl2Entity.class.getSimpleName(),
Tbl3Entity.class.getSimpleName(), };
/**
* Testメソッド
*/
public void test(){
boolean isRegistOfTbl1 = ArrayUtils.contains(tblListOfXx1, Tbl1Entity.class.getSimpleName());
if (isRegistOfTbl1) {
// Mapから値取得、デフォルートは空
cdValOfXx1.getOrDefault("new11", "");
// TODO 登録処理など
}
}
}
댓글 없음:
댓글 쓰기