本文整理匯總了Java中org.yaml.snakeyaml.introspector.Property.set方法的典型用法代碼示例。如果您正苦於以下問題:Java Property.set方法的具體用法?Java Property.set怎麽用?Java Property.set使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.yaml.snakeyaml.introspector.Property
的用法示例。
在下文中一共展示了Property.set方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: setProperties
import org.yaml.snakeyaml.introspector.Property; //導入方法依賴的package包/類
protected void setProperties(Object bean, Map<String, Object> data) throws Exception {
if (data == null) {
throw new NullPointerException("Data for Compact Object Notation cannot be null.");
}
for (Map.Entry<String, Object> entry : data.entrySet()) {
String key = entry.getKey();
Property property = getPropertyUtils().getProperty(bean.getClass(), key);
try {
property.set(bean, entry.getValue());
} catch (IllegalArgumentException e) {
throw new YAMLException("Cannot set property='" + key + "' with value='"
+ data.get(key) + "' (" + data.get(key).getClass() + ") in " + bean);
}
}
}
示例2: applySequence
import org.yaml.snakeyaml.introspector.Property; //導入方法依賴的package包/類
protected void applySequence(Object bean, List<?> value) {
try {
Property property = getPropertyUtils().getProperty(bean.getClass(),
getSequencePropertyName(bean.getClass()));
property.set(bean, value);
} catch (Exception e) {
throw new YAMLException(e);
}
}
示例3: setProperties
import org.yaml.snakeyaml.introspector.Property; //導入方法依賴的package包/類
protected void setProperties(final Object bean, final Map<String, Object> data) throws Exception {
if (data == null) {
throw new NullPointerException("Data for Compact Object Notation cannot be null.");
}
for (Map.Entry<String, Object> entry : data.entrySet()) {
String key = entry.getKey();
Property property = getPropertyUtils().getProperty(bean.getClass(), key);
try {
property.set(bean, entry.getValue());
} catch (IllegalArgumentException e) {
throw new YAMLException("Cannot set property='" + key + "' with value='" + data.get(key) + "' (" + data.get(key).getClass()
+ ") in " + bean);
}
}
}
示例4: applySequence
import org.yaml.snakeyaml.introspector.Property; //導入方法依賴的package包/類
protected void applySequence(final Object bean, final List<?> value) {
try {
Property property = getPropertyUtils().getProperty(bean.getClass(), getSequencePropertyName(bean.getClass()));
property.set(bean, value);
} catch (Exception e) {
throw new YAMLException(e);
}
}