Java Reference
In-Depth Information
Now we can use our stereotype in our own code.
package com.ensode.beans;
import com.ensode.stereotype.NamedSessionScoped;
import java.io.Serializable;
@NamedSessionScoped
public class StereotypeClient implements Serializable {
private String property1;
private String property2;
public String getProperty1() {
return property1;
}
public void setProperty1(String property1) {
this.property1 = property1;
}
public String getProperty2() {
return property2;
}
public void setProperty2(String property2) {
this.property2 = property2;
}
}
We annotated the above class with our NamedSessionScoped stereotype, which is
equivalent to using the @Named and @SessionScoped annotations.
Interceptor Binding Types
One of the advantages of EJBs is that they allow us to easily do Aspect Oriented
Programming ( AOP ) via interceptors. CDI allows us to write Interceptor Binding
Types, which let us bind interceptors to beans without having the beans depend
directly on the interceptor. Interceptor Binding Types are annotations which
themselves are annotated with @InterceptorBinding .
 
Search WWH ::




Custom Search