1.1.Java Bean
A Java Bean is a class that conforms to a particular rule. At least the following rules are met:
(1) class itself is Public modified.
(2) class has Public no parameter constructor.
(3) class through some kind of normalized GetXXX () and the setxxx () method to expose its properties XXX .
Main rules:
(a) properties are generally Private , while Get and the Set method is Public .
(b) 1 get set is the property's get set method name. Property xxx corresponding method is getxxx () Setxxx () xyz corresponding method is getxyz () SETXYZ ()
(c) Property Type is Boolean when you use the isxxx () Replace GetXXX () .
here is a rule-compliant Java Bean.
/*** @Title: samplebean.java* @Package com.test.javatechnology.introspection* @Description:*@author http://www.cnblogs.com/coe2coe/* @date March 25, 2017 PM 4:51:30*@versionV1.0*/ Packagecom.test.javatechnology.introspection;/*** @ClassName: samplebean* @Description:*@author http://www.cnblogs.com/coe2coe/* @date March 25, 2017 PM 4:51:30**/ Public classSamplebean {/*** No parameter constructor*/ PublicSamplebean () {}/*** Get Age *@return */ Public intGetage () {returnAge ;}/*** Set Age *@param Age*/ Public voidSetage (intAge ) { This. Age =Age ;}/*** Get name *@return */ PublicString GetName () {returnname;}/*** Set name *@paramname*/ Public voidsetName (String name) { This. Name =name;} /*** Get Turn *@return */ Public BooleanIsturn () {returnturn;}/*** Set Turn *@paramTurn*/ Public voidSetturn (Booleanturn) { This. turn =turn;} Private intAge ;PrivateString name;Private Booleanturn;}
Key Java Technologies (12) The JavaBean of introspection