use of org.springframework.beans.BeanWrapperImpl in project walkmod-core by walkmod.
the class ConfigurationImpl method populate.
public void populate(Object element, Map<?, ?> parameters) {
if (element != null) {
BeanWrapper bw = new BeanWrapperImpl(element);
if (this.parameters != null) {
bw.setPropertyValues(this.parameters);
}
bw.setPropertyValues(parameters);
}
}
use of org.springframework.beans.BeanWrapperImpl in project syncope by apache.
the class KeyPropertyColumn method populateItem.
@Override
public void populateItem(final Item<ICellPopulator<T>> item, final String componentId, final IModel<T> rowModel) {
BeanWrapper bwi = new BeanWrapperImpl(rowModel.getObject());
Object obj = bwi.getPropertyValue(getPropertyExpression());
item.add(new Label(componentId, StringUtils.EMPTY));
item.add(new AttributeModifier("title", obj.toString()));
item.add(new AttributeModifier("class", "fa fa-key"));
item.add(new AttributeModifier("style", "display: table-cell; text-align: center;"));
}
use of org.springframework.beans.BeanWrapperImpl in project alien4cloud by alien4cloud.
the class EqualsAndHashCodeAutoTest method doTest.
private void doTest(Class<?> clazz, Object[][] allFieldValues, Object[][] testFieldValues, String[] fieldNames, int start, int end, int index) throws IllegalAccessException, InstantiationException {
if (index == fieldNames.length) {
Object instance = clazz.newInstance();
Object equalInstance = clazz.newInstance();
Object otherInstance = clazz.newInstance();
BeanWrapper instanceWrapper = new BeanWrapperImpl(instance);
BeanWrapper equalInstanceWrapper = new BeanWrapperImpl(equalInstance);
BeanWrapper otherInstanceWrapper = new BeanWrapperImpl(otherInstance);
// set field values
for (int i = 0; i < fieldNames.length; i++) {
String fieldName = fieldNames[i];
if (clazz.equals(PropertyDefinition.class) && fieldNames[i].equals("defaultValue")) {
fieldName = "default";
}
instanceWrapper.setPropertyValue(fieldName, testFieldValues[i][0]);
equalInstanceWrapper.setPropertyValue(fieldName, testFieldValues[i][0]);
otherInstanceWrapper.setPropertyValue(fieldName, testFieldValues[i][1]);
}
// Two instances that are the same must have the same hashcode (but two different instance may have the same hashcode).
Assert.assertEquals(instance.hashCode(), equalInstance.hashCode());
Assert.assertTrue(instance.equals(equalInstance));
} else {
// recursive prepare a set of field values to test so we test all combinations
for (int i = start; i < end && end - i + 1 >= fieldNames.length - index; i++) {
testFieldValues[index] = allFieldValues[i];
doTest(clazz, allFieldValues, testFieldValues, fieldNames, i + 1, end, index + 1);
}
}
}
use of org.springframework.beans.BeanWrapperImpl in project alien4cloud by alien4cloud.
the class RestStepsDefinitions method register.
@And("^I register \"(.*?)\" as \"(.*?)\"$")
public void register(String propertyPath, String key) throws Throwable {
RestResponse restResponse = JsonUtil.read(Context.getInstance().getRestResponse());
Object value = restResponse;
if (!"null".equals(propertyPath)) {
BeanWrapper beanWrapper = new BeanWrapperImpl(restResponse);
value = beanWrapper.getPropertyValue(propertyPath);
}
REGISTRY.put(key, value);
}
use of org.springframework.beans.BeanWrapperImpl in project alien4cloud by alien4cloud.
the class CollectionParser method objectFromTuple.
private T objectFromTuple(NodeTuple tuple, ParsingContextExecution context) {
String key = ParserUtils.getScalar(tuple.getKeyNode(), context);
T value;
value = valueParser.parse(tuple.getValueNode(), context);
if (value != null) {
BeanWrapper valueWrapper = new BeanWrapperImpl(value);
valueWrapper.setPropertyValue(keyPath, key);
}
return value;
}
Aggregations