本文整理汇总了Java中jodd.bean.BeanUtil.setDeclaredProperty方法的典型用法代码示例。如果您正苦于以下问题:Java BeanUtil.setDeclaredProperty方法的具体用法?Java BeanUtil.setDeclaredProperty怎么用?Java BeanUtil.setDeclaredProperty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类jodd.bean.BeanUtil
的用法示例。
在下文中一共展示了BeanUtil.setDeclaredProperty方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: instanceFirstInit
import jodd.bean.BeanUtil; //导入方法依赖的package包/类
public static <T extends Object> T instanceFirstInit(final Class<T> klass) {
try {
T _xblockexpression = null;
{
final T instance = klass.newInstance();
Field[] _declaredFields = klass.getDeclaredFields();
final Consumer<Field> _function = (Field field) -> {
String _name = field.getName();
String _name_1 = field.getName();
Object _firstInitFrom = MockHelper.firstInitFrom(_name_1);
BeanUtil.setDeclaredProperty(instance, _name, _firstInitFrom);
};
((List<Field>)Conversions.doWrapArray(_declaredFields)).forEach(_function);
_xblockexpression = instance;
}
return _xblockexpression;
} catch (Throwable _e) {
throw Exceptions.sneakyThrow(_e);
}
}
示例2: instanceSecondInit
import jodd.bean.BeanUtil; //导入方法依赖的package包/类
public static <T extends Object> T instanceSecondInit(final T instance) {
T _xblockexpression = null;
{
Class<?> _class = instance.getClass();
Field[] _declaredFields = _class.getDeclaredFields();
final Consumer<Field> _function = (Field field) -> {
String _name = field.getName();
String _name_1 = field.getName();
Object _secondInitFrom = MockHelper.secondInitFrom(_name_1, instance);
BeanUtil.setDeclaredProperty(instance, _name, _secondInitFrom);
};
((List<Field>)Conversions.doWrapArray(_declaredFields)).forEach(_function);
_xblockexpression = instance;
}
return _xblockexpression;
}
示例3: getHystrixThreadPoolPropertiesSetter
import jodd.bean.BeanUtil; //导入方法依赖的package包/类
private HystrixThreadPoolProperties.Setter getHystrixThreadPoolPropertiesSetter(
com.netflix.hystrix.contrib.javanica.annotation.HystrixCommand hystrixCommand) {
HystrixThreadPoolProperties.Setter commandPropertiesDefaults = HystrixThreadPoolProperties.defaultSetter();
if (hystrixCommand.threadPoolProperties() == null || hystrixCommand.threadPoolProperties().length == 0) {
return commandPropertiesDefaults;
}
Map<String, Object> commandProperties = new HashMap<String, Object>();
for (HystrixProperty commandProperty : hystrixCommand.threadPoolProperties()) {
commandProperties.put(commandProperty.name(), commandProperty.value());
BeanUtil.setDeclaredProperty(commandPropertiesDefaults, commandProperty.name(),
commandProperty.value());
}
return commandPropertiesDefaults;
}