jadex.webservice.examples.rs.banking.BeanToHTMLMapper Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jadex-applications-webservice Show documentation
Show all versions of jadex-applications-webservice Show documentation
The Jadex web service applications package contains several example applications, benchmarks and testcases using web service integration.
package jadex.webservice.examples.rs.banking;
import java.util.Iterator;
import java.util.Map;
import jadex.commons.SReflect;
import jadex.commons.SUtil;
import jadex.commons.transformation.traverser.BeanProperty;
import jadex.commons.transformation.traverser.DefaultBeanIntrospector;
import jadex.extension.rs.publish.mapper.IValueMapper;
/**
*
*/
public class BeanToHTMLMapper implements IValueMapper
{
protected static final DefaultBeanIntrospector in = new DefaultBeanIntrospector();
/**
*
*/
public Object convertValue(Object result) throws Exception
{
StringBuffer ret = new StringBuffer();
ret.append("");
ret.append("");
ret.append("").append(SReflect.getUnqualifiedClassName(result.getClass())).append("
");
Map props = in.getBeanProperties(result.getClass(), true, false);
for(Iterator it=props.keySet().iterator(); it.hasNext(); )
{
String name = it.next();
BeanProperty prop = props.get(name);
if (prop.isReadable())
{
// Method getter = props.get(name).getGetter();
// Object value = getter.invoke(result, new Object[0]);
Object value = props.get(name).getPropertyValue(result);
ret.append("");
ret.append(name).append(" = ");
ret.append(SUtil.arrayToString(value));
ret.append("");
}
}
ret.append("");
ret.append("");
return ret.toString();
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy