MethodElement

The method element is used to denote a method of an enterprise bean's home or remote interface, or a set of methods. The ejb-name elementmust be the name of one of the enterprise beans in declared in thedeployment descriptor; the optional method-intf element allows todistinguish between a method with the same signature that is defined inboth the home and remote interface; the method-name element specifiesthe method name; and the optional method-params elements identify asingle method among multiple methods with an overloaded method name.There are three possible styles of the method element syntax:

  1. This style is used to refer to all the methods of the specified enterprise bean's home and remote interfaces.

    <method>  
        <ejb-name>EJBNAME </ejb-name>     
        <method-name>* </method-name> 
    </method>   
    

  2. This style is used to refer to the specified method of the specified enterprise bean. If there are multiple methods with the same overloaded name, the element of this style refers to all the methods with the overloaded name.

    <method>  
        <ejb-name>EJBNAME </ejb-name>     
        <method-name>METHOD </method-name> 
    </method>>   
    

  3. This style is used to refer to a single method within a set of methods with an overloaded name. PARAM-1 through PARAM-n are the fully-qualified Java types of the method's input parameters (if the method has no input arguments, the method-params element contains no method-param elements). Arrays are specified by the array element's type, followed by one or more pair of square brackets (e.g. int[][]).Used in: method-permission and container-transactionExamples:

    <method>  
        <ejb-name>EJBNAME </ejb-name>     
        <method-name>METHOD </method-name>  
        <method-params>      
            <method-param>PARAM-1 </method-param>      
            <method-param>PARAM-2 </method-param>             ...      
            <method-param>PARAM-n </method-param>  
        </method-params> 
    <method>    
    

    Style 1: The following method element refers to all the methods of the EmployeeService bean's home and remote interfaces:

    <method>   
    <ejb-name>EmployeeService
    </ejb-name>   
    <method-name>*
    </method-name>  
    </method> 
    

    Style 2: The following method element refers to all the create methods of the EmployeeService bean's home interface:

    <method>   
    <ejb-name>EmployeeService
    </ejb-name>   
    <method-name>create
    </method-name>  
    </method> 
    

    Style 3: The following method element refers to the create(String firstName, String LastName) method of the EmployeeService bean's home interface.

    <method>   
    <ejb-name>EmployeeService
    </ejb-name>   
    <method-name>create
    </method-name>   
    <method-params>    
    <method-param>java.lang.String
    </method-param>    
    <method-param>java.lang.String
    </method-param>   
    </method-params>  
    </method>  
    

    The following example illustrates a Style 3 element with more complex parameter types. The method foobar(char s, int i, int[] iar, mypackage.MyClass mycl, mypackage.MyClass[][] myclaar) would be specified as:

    <method>   
    <ejb-name>EmployeeService
    </ejb-name>   
    <method-name>foobar
    </method-name>   
    <method-params>    
    <method-param>char
    </method-param>    
    <method-param>int
    </method-param>    
    <method-param>int[]
    </method-param>    
    <method-param>mypackage.MyClass
    </method-param>    
    <method-param>mypackage.MyClass[][]
    </method-param>   
    </method-params>  
    </method> 
    

    The optional method-intf element can be used when it becomes necessary to differentiate between a method defined in the home interface and a method with the same name and signature that is defined in the remote interface. For example, the method element

    <method>   
    <ejb-name>EmployeeService
    </ejb-name>   
    <method-intf>Remote
    </method-intf>   
    <method-name>create
    </method-name>   
    <method-params>    
    <method-param>java.lang.String
    </method-param>    
    <method-param>java.lang.String
    </method-param>   
    </method-params>  
    </method> 
    

    can be used to differentiate the create(String, String) method defined in the remote interface from the create(String, String) method defined in the home interface, which would be defined as

    <method>   
    <ejb-name>EmployeeService
    </ejb-name>   
    <method-intf>Home
    </method-intf>   
    <method-name>create
    </method-name>   
    <method-params>    
    <method-param>java.lang.String
    </method-param>    
    <method-param>java.lang.String
    </method-param>   
    </method-params>  
    </method>
    


    Attributes Summary

    name The method-name element contains a name of an enterprise bean method,or the asterisk (*) character.
    parms The method-params element contains a list of the fully-qualified Java type names of the method parameters.
    params @deprecated Not supported yet; planned for future drivers.
    isZeroParams @deprecated Not supported yet; planned for future drivers.
    type
    description The description element is used by the ejb-jar file producer to provide text describing the parent element.
    enterpriseBean

    Attribute Details

    name

    The method-name element contains a name of an enterprise bean method,or the asterisk (*) character. The asterisk is used when the elementdenotes all the methods of an enterprise bean's remote and homeinterfaces.

    Data type: String
    Default value: unspecified


    parms

    The method-params element contains a list of the fully-qualified Java type names of the method parameters. In the current implementation this is a space delimitted String. A null string indicates a generic method element that can apply to multiple methods with the same name. An empty string indicates a method with zero parameters. In future implementations (post V5), this field will be deprecated and migrated to use the multi-valued params field and the isZeroParams flag.

    Data type: String
    Default value: unspecified


    params

    @deprecated Not supported yet; planned for future drivers. Use {@link #getMethodParams()}, {@link #addMethodParams()} and {@link #removeMethodParams()}

    Data type: String
    Default value: unspecified


    isZeroParams

    @deprecated Not supported yet; planned for future drivers. Use {@link #hasMethodParams()} and {@link #applyZeroParams()}if the params is emty, it could mean one of two things:1) This method element applies to all methods having the name2) This method element applies to a specific method which takes no parametersThis flag, when false, indicates the first condition.

    Data type: Boolean
    Default value: unspecified


    type

    Data type: MethodElementKind
    Default value: unspecified
    Allowed Values: Unspecified Remote Home Local LocalHome


    description

    The description element is used by the ejb-jar file producer to provide text describing the parent element. The description element should include any information that the ejb-jar file producer wants to provide to the consumer of the ejb-jar file (i.e. to the Deployer). Typically, the tools used by the ejb-jar file consumer will display the description when processing the parent element.

    Data type: String
    Default value: unspecified


    enterpriseBean

    Data type: EnterpriseBean