Modeling Properties and Methods on Beans

Properties and methods can be added to modeled entity and session beans by either double-clicking the bean and adding the property or method using the EJB Module Editor or by creating the new property or method 'in-place' on the modeled bean itself. For more information, see About In-Place Creation and Editing.

Creating Properties on Modeled Beans

When creating a property in-place on a modeled bean, enter the name and datatype of the property. For example:

name : java.lang.String

A public (+ ) visibility symbol is automatically added to the start of the property.

Note: If a property type from the java.lang package is entered without a package prefix, for example, String or Long, a property type prefix of java.lang. is automatically added. If no type is given for a property, a default type of 'String' (java.lang.String) is used.

Creating Methods on Modeled Beans

Both local/remote and local/local home methods can be created on modeled beans on a class diagram. Modeling a method on a bean also creates the corresponding code in the implementing Java class.

When creating a method in-place on a modeled bean, enter the name, and optionally the parameter types and names, and return type of the method. The method return type must be preceded by a colon (: ). For example:

getName(String CustNumber) : java.lang.String

A public (+) visibility symbol is automatically added to the start of the method.

Note: If a return type from the java.lang package is entered without a package prefix, for example, String or Long, a return type prefix of java.lang. is automatically added to the Java in the method's class.

If no parameter types are provided, the method will be defined with no parameters. If no return type is specified, a default return type of void is used. To change an property of the method, double-click the class on the diagram, or on the Navigator pane, then change the details of the method using the EJB Editor.


Creating a Diagram of Enterprise JavaBeans

 

 

Copyright © 1997, 2004, Oracle. All rights reserved.