本文整理汇总了Java中org.springframework.beans.PropertyAccessor.setPropertyValue方法的典型用法代码示例。如果您正苦于以下问题:Java PropertyAccessor.setPropertyValue方法的具体用法?Java PropertyAccessor.setPropertyValue怎么用?Java PropertyAccessor.setPropertyValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.springframework.beans.PropertyAccessor
的用法示例。
在下文中一共展示了PropertyAccessor.setPropertyValue方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: writeValueToEntity
import org.springframework.beans.PropertyAccessor; //导入方法依赖的package包/类
/**
* Write normal value to entity.
*
* @param accessor The accessor for the existing entity
* @param key The fields name we are overwriting
* @param value The new value
*/
private void writeValueToEntity(final PropertyAccessor accessor,
final String key,
final Object value) {
final ResolvableType type = accessor.getPropertyTypeDescriptor(key).getResolvableType();
accessor.setPropertyValue(key, parseValue(value, type));
}
示例2: getDirectoryService
import org.springframework.beans.PropertyAccessor; //导入方法依赖的package包/类
private Directory getDirectoryService() {
HttpTransport httpTransport = new NetHttpTransport();
JacksonFactory jacksonFactory = new JacksonFactory();
GoogleCredential credential = getGoogleCredential();
PropertyAccessor accessor = PropertyAccessorFactory.forDirectFieldAccess(credential);
accessor.setPropertyValue("serviceAccountUser", config.getAdminUsername());
accessor.setPropertyValue("serviceAccountScopes", SERVICE_ACCOUNT_SCOPES);
return new Directory.Builder(httpTransport, jacksonFactory, credential)
.setApplicationName("Spinnaker-Fiat")
.build();
}
示例3: deserializeNonTemplate
import org.springframework.beans.PropertyAccessor; //导入方法依赖的package包/类
private CompositionElement deserializeNonTemplate(JsonNode node, Map<String, Object> valueMap)
throws JsonProcessingException {
CompositionElement result = new CompositionElement();
PropertyAccessor beanAccessor = PropertyAccessorFactory.forDirectFieldAccess(result);
for (Iterator<Entry<String, JsonNode>> iter = node.fields(); iter.hasNext();) {
Entry<String, JsonNode> subNode = iter.next();
if (consumedListProperties.contains(subNode.getKey())) {
result.getProperties().put(subNode.getKey(), mapper.treeToValue(subNode.getValue(), List.class));
} else if (consumedMapProperties.contains(subNode.getKey())) {
processMapProperty(result, subNode, valueMap);
} else if (consumedIntProperties.contains(subNode.getKey())) {
result.getProperties().put(subNode.getKey(), mapper.treeToValue(subNode.getValue(), Integer.class));
} else if (consumedProperties.contains(subNode.getKey())) {
processConsumedProperty(result, subNode, valueMap);
} else if (supportedTextProperties.contains(subNode.getKey())) {
beanAccessor.setPropertyValue(subNode.getKey(), subNode.getValue().asText());
} else if (supportedIntProperties.contains(subNode.getKey())) {
beanAccessor.setPropertyValue(subNode.getKey(), subNode.getValue().asInt());
} else {
throw new IllegalArgumentException("Unknown property: " + subNode.getKey());
// result.getProperties().put(subNode.getKey(),
// subNode.getValue().asText());
}
}
return result;
}
示例4: writeObjectToEntity
import org.springframework.beans.PropertyAccessor; //导入方法依赖的package包/类
/**
* Write object to the entity
*
* @param accessor The accessor for the existing entity
* @param key The fields name we are overwriting
* @param value The new value
* @throws JSONException the json exception
*/
private void writeObjectToEntity(final PropertyAccessor accessor,
final String key,
final JSONObject value) throws JSONException {
final ResolvableType type = accessor.getPropertyTypeDescriptor(key).getResolvableType();
accessor.setPropertyValue(key, parseObject(value, type));
}
示例5: writeArrayMapToEntity
import org.springframework.beans.PropertyAccessor; //导入方法依赖的package包/类
/**
* Write an array map to an entity
* an array map is an object, but is meant to represent an array
*
* @param accessor The accessor for the existing entity
* @param key The fields name we are overwriting
* @param value The new value
* @throws JSONException the json exception
*/
private void writeArrayMapToEntity(final PropertyAccessor accessor,
final String key,
final JSONObject value) throws JSONException {
final ResolvableType type = accessor.getPropertyTypeDescriptor(key).getResolvableType();
accessor.setPropertyValue(key, parseArrayMap(value, type));
}
示例6: writeArrayToEntity
import org.springframework.beans.PropertyAccessor; //导入方法依赖的package包/类
/**
* Write array to entity.
*
* @param accessor The accessor for the existing entity
* @param key The fields name we are overwriting
* @param value The new value
* @throws JSONException the json exception
*/
private void writeArrayToEntity(final PropertyAccessor accessor,
final String key,
final JSONArray value) throws JSONException {
final ResolvableType type = accessor.getPropertyTypeDescriptor(key).getResolvableType();
accessor.setPropertyValue(key, parseArray(value, type));
}