{"id":1159,"date":"2016-03-09T13:22:34","date_gmt":"2016-03-09T13:22:34","guid":{"rendered":"http:\/\/codethataint.com\/blog\/?p=1159"},"modified":"2016-03-09T13:22:34","modified_gmt":"2016-03-09T13:22:34","slug":"string-bean-in-java","status":"publish","type":"post","link":"https:\/\/codethataint.com\/blog\/string-bean-in-java\/","title":{"rendered":"String Bean in Java"},"content":{"rendered":"<p><strong>Java Bean Class &#8211; EmployeeBean<\/strong><\/p>\n<pre class=\"brush: java; title: ; notranslate\" title=\"\">\r\nimport java.util.ArrayList;\r\nimport java.util.Iterator;\r\nimport java.util.List;\r\n\r\npublic class EmployeeBean {\r\n\tprivate String Name;\r\n\tprivate int EmpNo;\r\n\tprivate int Age;\r\n\tprivate float Weight;\r\n\t\r\n\tpublic String getName() {\r\n\t\treturn Name;\r\n\t}\r\n\tpublic void setName(String name) {\r\n\t\tName = name;\r\n\t}\r\n\tpublic int getEmpNo() {\r\n\t\treturn EmpNo;\r\n\t}\r\n\tpublic void setEmpNo(int empNo) {\r\n\t\tEmpNo = empNo;\r\n\t}\r\n\tpublic int getAge() {\r\n\t\treturn Age;\r\n\t}\r\n\tpublic void setAge(int age) {\r\n\t\tAge = age;\r\n\t}\r\n\tpublic float getWeight() {\r\n\t\treturn Weight;\r\n\t}\r\n\tpublic void setWeight(float weight) {\r\n\t\tWeight = weight;\r\n\t}\r\n\t\r\n\t\r\n\t\r\n\tpublic EmployeeStringBean getStringBean() {\r\n\t\t\r\n\t\tEmployeeStringBean objEmpBean = new EmployeeStringBean();\r\n\t\t\r\n\t\tobjEmpBean.setName(getName() == null?null:getName().toString());\r\n\t\tobjEmpBean.setEmpNo(Integer.toString(getEmpNo()));\r\n\t\tobjEmpBean.setAge(Integer.toString(getAge()));\t\t\r\n\t\tobjEmpBean.setWeight(getWeight()+&quot;&quot;);\r\n\t\t\r\n\t\treturn objEmpBean;\r\n\t}\r\n\t\r\n\t\r\n\tpublic static List getStringBeanList(List beanList) {\r\n\t\t List stringBeanList = new ArrayList();\r\n\r\n\t        if (beanList != null) {\r\n\t            Iterator itr = beanList.iterator();\r\n\r\n\t            while (itr.hasNext()) {\r\n\t            \tEmployeeBean bean = (EmployeeBean) itr.next();\r\n\t                stringBeanList.add(bean.getStringBean());\r\n\t            }\r\n\t        }\r\n\r\n\t        return stringBeanList;\r\n\t}\r\n}\r\n\r\n<\/pre>\n<p><strong>String Bean Class &#8211; EmployeeStringBean<\/strong><\/p>\n<pre class=\"brush: java; title: ; notranslate\" title=\"\">\r\npublic class EmployeeStringBean {\r\n\tprivate String Name;\r\n\tprivate String EmpNo;\r\n\tprivate String Age;\r\n\tprivate String Weight;\r\n\t\r\n\tpublic String getName() {\r\n\t\treturn Name;\r\n\t}\r\n\tpublic void setName(String name) {\r\n\t\tName = name;\r\n\t}\r\n\tpublic String getEmpNo() {\r\n\t\treturn EmpNo;\r\n\t}\r\n\tpublic void setEmpNo(String empNo) {\r\n\t\tEmpNo = empNo;\r\n\t}\r\n\tpublic String getAge() {\r\n\t\treturn Age;\r\n\t}\r\n\tpublic void setAge(String age) {\r\n\t\tAge = age;\r\n\t}\r\n\tpublic String getWeight() {\r\n\t\treturn Weight;\r\n\t}\r\n\tpublic void setWeight(String weight) {\r\n\t\tWeight = weight;\r\n\t}\t\r\n\t\r\n\tpublic EmployeeBean getBean()\r\n\t{\r\n\t\tEmployeeBean objEmployeeBean = new EmployeeBean();\r\n\t\t\r\n\t\tobjEmployeeBean.setName(getName());\r\n\t\tobjEmployeeBean.setEmpNo(Integer.parseInt(getEmpNo()));\r\n\t\tobjEmployeeBean.setAge(Integer.parseInt(getAge()));\r\n\t\tobjEmployeeBean.setWeight(Float.parseFloat((getWeight())));\r\n\t\t\r\n\t\treturn objEmployeeBean;\r\n\t}\t\r\n}\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Java Bean Class &#8211; EmployeeBean import java.util.ArrayList; import java.util.Iterator; import java.util.List; public class EmployeeBean { private String Name; private int EmpNo; private int Age; private float Weight; public String getName() { return Name; } public void setName(String name) { Name = name; } public int getEmpNo() { return EmpNo; } public void setEmpNo(int empNo) {&hellip; <a href=\"https:\/\/codethataint.com\/blog\/string-bean-in-java\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[99],"tags":[],"class_list":["post-1159","post","type-post","status-publish","format-standard","hentry","category-classes-and-objects"],"_links":{"self":[{"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/posts\/1159","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/comments?post=1159"}],"version-history":[{"count":1,"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/posts\/1159\/revisions"}],"predecessor-version":[{"id":1160,"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/posts\/1159\/revisions\/1160"}],"wp:attachment":[{"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/media?parent=1159"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/categories?post=1159"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/codethataint.com\/blog\/wp-json\/wp\/v2\/tags?post=1159"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}