diff --git a/guide/english/java/java-bean/index.md b/guide/english/java/java-bean/index.md index 726734fdb9..dd196d7c04 100644 --- a/guide/english/java/java-bean/index.md +++ b/guide/english/java/java-bean/index.md @@ -2,12 +2,55 @@ title: Java Bean --- ## Java Bean +Java Beans are Java classes that follow the following rules: -This is a stub. Help our community expand it. +1) implement the `java.io.Serializable` interface +2) have private properties with public getters and setters +3) have a public no-argument constructor -This quick style guide will help ensure your pull request gets accepted. +A simple Java Bean is implemented below: +``` java +public class ExampleBean implements java.io.Serializable { - + // private properties + private String name; + private Boolean programmer; + + // no-argument constructor + public ExampleBean() { + } + + // public getters and setters + public String getName(){ + return this.name; + } + + public void setName(String name){ + this.name = name; + } + + public Boolean isProgrammer(){ + return this.age; + } + + public void setProgrammer(Boolean programmer){ + this.programmer = programmer; + } +} +``` + +Java Beans, frequently refered as beans, are meant to be reusable software components that anyone can use without having to know and understand their inner implementation. They can be used by a bean editor in order to be customized and assemble an application. + +The advantages: + * standardized way that enforces reusability + * customization with bean editors + * persistence and ability to be transfered within network + +The disadvantages: + * lots of boilerplate with getters and setters + * lack of immutability by design #### More Information: - +- Oracle docs +- What Serializable means +- Java Beans usage