Annotations used for Bidirectional injection in JBoss Seam

Source: Internet
Author: User

Annotation for Bidirectional Injection

Annotation

Usage

Description

@ In

 

● Value-specifies the context variable name. The default value is component property name. (Optional) specify a jsf el expression and place it in the # {...} symbol.

● Create-specifies that if the context variable name is not defined in all contexts, Seam should create a component as the context variable, and the name is the required name. The default value is false.

● Required-specifies that if the context variable name is not defined in all contexts, Seam should throw an exception.

@ In

At the beginning of each component call, the component attributes are injected from the context variable. If the context variable is null, an exception is thrown.

@ In (required = false)

At the beginning of each component call, the component attributes are injected from the context variable. The context variable can be null.

@ In (create = true)

At the beginning of each component call, the component attributes are injected from the context variable. If the context variable is null, Seam instantiates this component.

@ In (value = "contextVariableName ")

Explicitly specify the name of the context variable, instead of the instance variable name defined by the annotation.

@ In (value = "# {customer. addresses ['shipping']}")

When each component call starts, a jsf el expression is used to inject component attributes.

@ Out

 

● Value-specifies the context variable name. The default value is component property name.

● Required-specify that Seam should throw an exception if the component property is null during injection.

@ Out

After the call is completed, the Seam component attributes are injected into the context variable. If the attribute is null, an exception is thrown.

@ Out (required = false)

After the call is completed, the Seam component attributes are injected into the context variable. The property can be null.

@ Out (scope = ScopeType. SESSION)

After the call ends, the non-Seam component attributes are injected to the specified scope. Alternatively, if the scope is not explicitly specified, use the scope of the component to which the @ Out attribute belongs. (If this component is stateless, use EVENTscope .)

@ Out (value = "contextVariableName ")

Explicitly specify the context variable name instead of the instance variable name specified in the annotation.

@ Unwrap

 

The manager component Mode is supported. In this mode, a Seam component manages the lifecycle of some other class instances to be injected. It appears in the getter method of the component.

@ Unwrap

Objects returned by the getter method of the specified annotation are injected, not the component instance itself.

@ Factory

 

Factory component mode is supported. In this mode, a Seam component initializes the context variable value. If a request is not faces, it is particularly useful when rendering response for initialization. It appears in the component method.

● Value-specifies the context variable value. If the getter method is used, the JavaBean attribute name is used by default.

● Scope-specify the scope of the Seam value to be bound. It is only meaningful for the factory method that returns a value.

● AutoCreate-this factory method is automatically called no matter when a variable is requested, even if @ In does not specify create = true.

@ Factory ("processInstance ")

Public void createProcessInstance (){...}

 

 

It indicates that when the context variable has no value, the method of this component is used to initialize the context variable value. It is used to return the void method.

 

@ Factory ("processInstance", scope = CONVERSATION)

Public ProcessInstance createProcessInstance (){...}

The declaration method returns a value. When the context variable has no value, Seam should use this value to initialize the value of the name context variable. It is used to return a value. If no scope is specified, use the scope of the component where the @ Factory method is located (unless the component is stateless, use EVENT context ).

@ Logger

 

This annotation injects a Log)

@ Logger ("categoryName ")

 

Value-specify the log category. The default value is component class name.

Use the instance org. jboss. seam. log. Log to inject a component Field. For Entity Bean, this field must be declared as static.

@ RequestParameter

 

This annotation allows you to inject a request parameter value

@ RequestParameter ("parameterName ")

 

Value-specify the request parameter name. The default value is component property name.

Inject the request parameter value into component attributes. The conversion of basic types is automatically completed.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.