tl  tr
  Home | Tutorials | Articles | Videos | Products | Tools | Search
Open Source | Tag Cloud | Follow Us | Bookmark | Contact   
 Tools and Libs > Jodd > Beans > How to print bean properties

How to print bean properties 

Jodd is an open-source java library with lot of reusable components and feature rich utilities. This requires the library jodd-3.3.2.jar to be in classpath. The following example shows how to print bean properties as per their scoope using BeanTool.attributesToString() API.

File Name  :  
package com.bethecoder.tutorials.jodd.common;

public class AttributeBean {

  private String privateProp;
  protected Long protectedProp;
  public Double publicProp;
  public AttributeBean(String privateProp, Long protectedProp,
      Double publicProp) {
    this.privateProp = privateProp;
    this.protectedProp = protectedProp;
    this.publicProp = publicProp;

File Name  :  
Author  :  Sudhakar KV
Email  :  [email protected]
package com.bethecoder.tutorials.jodd.beans;

import jodd.bean.BeanTool;

import com.bethecoder.tutorials.jodd.common.AttributeBean;

public class AttributesToStringTest {

   @param args
  public static void main(String[] args) {
    AttributeBean bean = new AttributeBean("ABCD"1234L56.789);
    String attribString = BeanTool.attributesToString(bean);


It gives the following output,



Books Recommendation

bl  br