use of org.lastaflute.di.helper.beans.PropertyDesc in project lastaflute by lastaflute.
the class Lato method resolveBeanExpression.
protected static String resolveBeanExpression(Object obj, Map<Object, String> alreadyAppearedSet) {
if (obj == null) {
throw new IllegalArgumentException("The argument 'obj' should not be null.");
}
final Class<? extends Object> targetType = obj.getClass();
final BeanDesc beanDesc = BeanDescFactory.getBeanDesc(targetType);
final int propertySize = beanDesc.getPropertyDescSize();
final StringBuilder sb = new StringBuilder();
sb.append("{");
for (int i = 0; i < propertySize; i++) {
final PropertyDesc pd = beanDesc.getPropertyDesc(i);
final String propertyName = pd.getPropertyName();
final Object propertyValue = pd.getValue(obj);
final String exp = deriveExpression(propertyValue, alreadyAppearedSet, () -> {
return resolveObjectString(propertyValue, alreadyAppearedSet);
});
sb.append(i > 0 ? ", " : "").append(propertyName).append("=").append(exp);
}
sb.append("}");
return sb.toString();
}
Aggregations