What's Annotation?

  • View
    10.115

  • Download
    2

Embed Size (px)

DESCRIPTION

社内勉強会「アノテーションについて」講義資料(改訂版)

Transcript

  • 1. Whats Annotation?HASUNUMA KenjiVice president, GlassFish Users Group Japank.hasunuma@coppermine.jpTwitter: @btnrouge

2. ? Java ( =) Java EE (XML) 3. 4. @Deprecated@OverrideJava () SevletEJBJSFJPAJAXBJAX-WS JAX-RS (: XMLJavaBeans) JPAJAXB( JAX-WSJAX-RS) 5. CDIDIDependency CDIJNDI Injection AOP Bean Validation XML Java EE 5 API 6. 7. @AnnotationName(parameters list) : 8. @Deprecated 9. (1) @Table(name = tbl, schema = app) : String 10. (2) @Table(name = tbl) 11. (3) @HttpMethod(value = GET) @HttpMethod(GET) value 12. @XmlType(propOrder = {a, b}) { } @XmlType(propOrder = c) 1 { } 13. 14. Java@Target @Retention(@Documented) @Inherited@Deprecated API() @Override 15. Servlet @WebServlet @WebFilter@WebListener @WebInitParam @MultpartCong @Resource 16. Enterprise JavaBeans@ManagedBean Bean @StatelessStateless Bean@StatefulStateful Bean @SingletonSingleton Bean @Resources@PostConstruct @PreDestroy 17. Java Persistence API@PersistenceContext Entity Manager@EntityEntity@Table DB @Id Entity @Column DB@Temporal @NamedQuery 18. JavaServer Faces@ManagedBean JSFBean@ManagedProperty JSF@ApplicationScoped JSFBean@SessionScoped @RequestScoped @ViewScoped 19. JAX-WS@WebService Web@WebMethodWeb@WebParam @WebResult 20. JAX-RS@Path URI@GETGET @POSTPOST@PUTPUT@DELETE DELETE@Consumes (MIME)@Produces (MIME) 21. JAXB@XmlType XML@XmlRootElement XML @XmlElement XML @XmlAttribute XML@XmlAccessType XMLJava@XmlEnum XMLJavaenum@XmlEnumValue 22. Contexts and Dependency Injection@Inject @Named@Qualier @Scope @Singleton (@Scope) 23. Examples 24. /** 1: JPA */@Entity // JPA(=)@Table(name = emp) // emppublic class Employee {@Id // (=)@Column(name = id) // emp.idprivate long id;@Column(name = name) // emp.nameprivate String name;// getter/setter} 25. /** 2: Dependency Injection (CDI) */@Stateless // Stateless EJB(=)public class SomeBean {// CDIbeanAnotherBean// @Inject // Dependency Injectionprivate AnotherBean bean;/* [In Action] * AOPAnotherBean* (=)JNDI@Inject* */public String getMessage() {return bean.sayHello();}} 26. Java EE XML 27. JPAJAX-RS CDIAPI 28. Whats Annotation? HASUNUMA Kenji k.hasunuma@coppermine.jp Twitter: @btnrouge