Dieser Inhalt ist in der von Ihnen ausgewählten Sprache nicht verfügbar.

29.2. Annotations for bijection


The next two annotations control bijection. These attributes occur on component instance variables or property accessor methods.
@In
@In
Copy to Clipboard Toggle word wrap
Specifies that a component attribute is to be injected from a context variable at the beginning of each component invocation. If the context variable is null, an exception will be thrown.
@In(required=false)
Copy to Clipboard Toggle word wrap
Specifies that a component attribute is to be injected from a context variable at the beginning of each component invocation. The context variable may be null.
@In(create=true)
Copy to Clipboard Toggle word wrap
Specifies that a component attribute is to be injected from a context variable at the beginning of each component invocation. If the context variable is null, an instance of the component is instantiated by Seam.
@In(value="contextVariableName")
Copy to Clipboard Toggle word wrap
Specifies the name of the context variable explicitly, instead of using the annotated instance variable name.
@In(value="#{customer.addresses['shipping']}")
Copy to Clipboard Toggle word wrap
Specifies that a component attribute is to be injected by evaluating a JSF EL expression at the beginning of each component invocation.
  • value — specifies the name of the context variable. Defaults to the name of the component attribute. Alternatively, specifies a JSF EL expression, surrounded by #{...}.
  • create — specifies that Seam should instantiate the component with the same name as the context variable, if the context variable is undefined (null) in all contexts. Defaults to false.
  • required — specifies that Seam should throw an exception if the context variable is undefined in all contexts.
@Out
@Out
Copy to Clipboard Toggle word wrap
Specifies that a component attribute that is a Seam component is to be outjected to its context variable at the end of the invocation. If the attribute is null, an exception is thrown.
@Out(required=false)
Copy to Clipboard Toggle word wrap
Specifies that a component attribute that is a Seam component is to be outjected to its context variable at the end of the invocation. The attribute can be null.
@Out(scope=ScopeType.SESSION)
Copy to Clipboard Toggle word wrap
Specifies that a component attribute that is not a Seam component type is to be outjected to a specific scope at the end of the invocation.
Alternatively, if no scope is explicitly specified, the scope of the component with the @Out attribute isused (or the EVENT scope if the component is stateless).
@Out(value="contextVariableName")
Copy to Clipboard Toggle word wrap
Specifies the name of the context variable explicitly, instead of using the annotated instance variable name.
  • value — specifies the name of the context variable. Default to the name of the component attribute.
  • required — specifies that Seam should throw an exception if the component attribute is null during outjection.
These annotations commonly occur together, as in the following example:
@In(create=true) 
@Out private User currentUser;
Copy to Clipboard Toggle word wrap
The next annotation supports the manager component pattern, where a Seam component manages the lifecycle of an instance of some other class that is to be injected. It appears on a component getter method.
@Unwrap
@Unwrap
Copy to Clipboard Toggle word wrap
Specifies that the object returned by the annotated getter method will be injected instead of the component.
The next annotation supports the factory component pattern, in which a Seam component is responsible for initializing the value of a context variable. This is especially useful for initializing any state required to render a response to a non-Faces request. It appears on a component method.
@Factory
@Factory("processInstance") 
public void createProcessInstance() { ... }
Copy to Clipboard Toggle word wrap
Specifies that the component method be used to initialize the value of the named context variable, when the context variable has no value. This style is used with methods that return void.
@Factory("processInstance", scope=CONVERSATION) 
public ProcessInstance createProcessInstance() { ... }
Copy to Clipboard Toggle word wrap
Specifies that the value returned by the method should be used to initialize the value of the named context variable, if the context variable has no value. This style is used with methods that return a value. If no scope is explicitly specified, the scope of the component with the @Factory method is used (unless the component is stateless, in which case the EVENT context is used).
  • value — specifies the name of the context variable. If the method is a getter method, this defaults to the JavaBeans property name.
  • scope — specifies the scope to which Seam should bind the returned value. Only meaningful for factory methods that return a value.
  • autoCreate — specifies that this factory method should be automatically called whenever the variable is asked for, even if @In does not specify create=true.
The following annotation lets you inject a Log:
@Logger
@Logger("categoryName")
Copy to Clipboard Toggle word wrap
Specifies that a component field is to be injected with an instance of org.jboss.seam.log.Log. For entity beans, the field must be declared as static.
  • value — specifies the name of the log category. Defaults to the name of the component class.
The final annotation lets you inject a request parameter value:
@RequestParameter
@RequestParameter("parameterName")
Copy to Clipboard Toggle word wrap
Specifies that a component attribute is to be injected with the value of a request parameter. Basic type conversions are performed automatically.
  • value — specifies the name of the request parameter. Defaults to the name of the component attribute.
Nach oben
Red Hat logoGithubredditYoutubeTwitter

Lernen

Testen, kaufen und verkaufen

Communitys

Über Red Hat Dokumentation

Wir helfen Red Hat Benutzern, mit unseren Produkten und Diensten innovativ zu sein und ihre Ziele zu erreichen – mit Inhalten, denen sie vertrauen können. Entdecken Sie unsere neuesten Updates.

Mehr Inklusion in Open Source

Red Hat hat sich verpflichtet, problematische Sprache in unserem Code, unserer Dokumentation und unseren Web-Eigenschaften zu ersetzen. Weitere Einzelheiten finden Sie in Red Hat Blog.

Über Red Hat

Wir liefern gehärtete Lösungen, die es Unternehmen leichter machen, plattform- und umgebungsübergreifend zu arbeiten, vom zentralen Rechenzentrum bis zum Netzwerkrand.

Theme

© 2025 Red Hat