S2Dxoã¨Beans(S2BeanUtils)ãã©ã£ã¡ãã©ããªã®ï¼
SAStrutsã§ã¯ããS2DXOã¯ããã¯ã使ç¨ããªããã¨ããè¦åããã¤ãããã¦ãã¾ã£ã¦ãããããªã®ã§ãããã©ããã¦ãã®ããã«è¦åã£ãã®ããã¨ãããã¨ã¯ãã¾ã ãå ¬éãããå ´æã§ã¯èª¬æããã¦ãªãããã«ãæãã¾ããæ¡å¤ãListã®å¤æã«ä½¿ç¨ããã¨S2DXOã®å¦çã¯éããã®ã«ãªã£ã¦ãã¾ã£ã¦ããã®ã§ããããã
ç§ã¯ãããã¯ãã®éçºè ã§ã¯ãªãã®ã§ããã
S2Dxoã¨Beans(S2BeanUtils)ã«ã¤ãã¦ã®èªåãªãã®èãã¯ä»¥ä¸ã®ã¨ããã§ãã
S2DxoãBeansãåãå½¹å²ã®ã¦ã¼ãã£ãªãã£ã§ãå®éã«ãç°¡åãªã±ã¼ã¹ã ã¨ä¸¡æ¹ã¨ã大差ãªãã¨æã£ã¦ãã¾ãããã ããè¤éãªãã¼ã¿å¤æã®å ´åã ã¨ãBeansã®æ¹ãåªãã¦ããããã«æãã¾ãã
ãã®çç±ã¨ãã¦Beansã¯ã
- ç°¡åãªã±ã¼ã¹ã¯Beansãç¨ãã¦èªåå¤æ
- è¤éãªã±ã¼ã¹ã¯ã´ãªã´ãªææ¸ãå¤æ
ã®ï¼ã¤ã®å¦çãåä¸ã¡ã½ããå ã«æ軽ã«ä½µç¨ã§ãã¦ãã¾ããã§ãããã®å°å³ãªå©ç¹ãä½æ°ã«å¤§ããªã¢ããã³ãã¼ã¸ã ã¨æã£ã¦ãã¾ãã
ã¡ã½ããå ã§ä½µç¨ã§ããã®ã§ãã©ã¡ãã®ããæ¹ã§ãè¯ããã¡ã½ããããå®ç¾©ãã¦ããã°ããã®å é¨å¦çæ¹éãããããå¤æ´ãã¦ãããæ軽ãããèªåçã«ã¯å¤§ãããã§ããã
ï¼ãã¾ãè¯ãä¾ã§ã¯ãªãã§ããï¼ã³ã¼ãã®ã¤ã¡ã¼ã¸ã¯ãããªæãã§ãã
public EmployeeDto createEmployeeDto(Employee emp) { /* ç°¡åãªã±ã¼ã¹(Beansãç¨ããèªåå¤æ) */ EmployeeDto dto = Beans.createAndCopy(EmployeeDto.class, emp); /* è¤éãªã±ã¼ã¹(ææ¸ãã§å¤æ) */ dto.employeeId = emp.id; dto.employeeName = emp.name; dto.departmenName = emp.department.name; return dto; }
å®éã«Beans触ã£ã¦ã¿ã¦ãç°¡åãªå¦çã¯å¾¹åºçã«èªååããã¦ãè¤éãªå¦çã¯ãã¬ã¼ã ã¯ã¼ã¯ãé å¼µããããã«æ示çã«ã½ã¼ã¹ã³ã¼ããæ¸ããã¨ãã£ãã³ã³ã»ããããã®ã¾ã¾ã³ã¼ãã«åæ ã§ããæãããã¾ããã
è¤éãªè©°ãæ¿ãå¦çãå«ãã±ã¼ã¹ã§ããç°¡åãªç®æã¯èªåå¤æã¨ä½µç¨ã§ããã®ã§é©åº¦ã«çç£æ§ãé«ãã¦ãã½ã¼ã¹ã³ã¼ãã®å¯èªæ§ãé«ããããã¦ããã¹ãããããã¨ããå°è±¡ãåãã¾ããã
ä¸æ¹ãS2Dxoã ã¨ãè¤éãªå¤æã«ããã¦ãèªåå¤æã¨ææ¸ãå¤æãï¼ã¤ã®ã¡ã½ããã«åãããã¨ããã¨ãã¡ãã£ã¨ç¡çãããã¨ãããããã大æããã«ãªã£ã¦ãã¾ãã¾ããã ããã¨ãã£ã¦ãèªåå¤æã使ããã«å ¨ã¦ææ¸ãã§å¤æããã®ã大å¤ã ããã¢ããã¼ã·ã§ã³ãé§ä½¿ãã¾ãã£ã¦èªåå¤æãããã®ã大å¤ã ã¨æãã¾ãã
ã¶ã£ã¡ãããç§ã®é ã®ã¤ã¡ã¼ã¸ã¯ãããªæãã§ãã
- S2Dxo
- ããããå°ç¨ã®ã¤ã³ã¿ã¼ãã§ã¼ã¹ã¯ã©ã¹ãä½æããå¾ã«ãã¿ã¤ãã»ã¼ããããªãã¢ããã¼ã·ã§ã³ã®å±æ§ã«è¦æ¦ãå¼·ãããã
- Beans
- æµãããããªã¤ã³ã¿ã¼ãã§ã¼ã¹ã§ãµã¯ãµã¯æãåºãããããããä½ãªãã°æã§ã´ãªã´ãªå¤æããã
ãããªè¨³ã§ãS2DxoãããBeansã¯å¾çºã ããã£ã¦ããããã¨ã¢ããã³ãã¼ã¸ãããã®ã§ãç§ã¯ãã¡ãããªã¹ã¹ã¡ãã¾ãã