本文整理汇总了Java中com.fasterxml.jackson.annotation.JsonAnySetter类的典型用法代码示例。如果您正苦于以下问题:Java JsonAnySetter类的具体用法?Java JsonAnySetter怎么用?Java JsonAnySetter使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
JsonAnySetter类属于com.fasterxml.jackson.annotation包,在下文中一共展示了JsonAnySetter类的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: initAny
import com.fasterxml.jackson.annotation.JsonAnySetter; //导入依赖的package包/类
private void initAny() {
final Method jsonAnyGetter = ClassUtils.findMethodWith(resourceClass, JsonAnyGetter.class);
final Method jsonAnySetter = ClassUtils.findMethodWith(resourceClass, JsonAnySetter.class);
if (absentAnySetter(jsonAnyGetter, jsonAnySetter)) {
throw new InvalidResourceException(
String.format("A resource %s has to have both methods annotated with @JsonAnySetter and @JsonAnyGetter",
resourceClass.getCanonicalName()));
}
if (jsonAnyGetter != null) {
anyFieldAccessor = new AnyResourceFieldAccessor() {
@Override
public Object getValue(Object resource, String name) {
try {
return jsonAnyGetter.invoke(resource, name);
} catch (IllegalAccessException | InvocationTargetException e) {
throw new ResourceException(
String.format("Exception while reading %s.%s due to %s", resource, name, e.getMessage()), e);
}
}
@Override
public void setValue(Object resource, String name, Object fieldValue) {
try {
jsonAnySetter.invoke(resource, name, fieldValue);
} catch (IllegalAccessException | InvocationTargetException e) {
throw new ResourceException(
String.format("Exception while writting %s.%s=%s due to %s", resource, name, fieldValue, e.getMessage()), e);
}
}
};
}
}
示例2: setValue
import com.fasterxml.jackson.annotation.JsonAnySetter; //导入依赖的package包/类
@JsonAnySetter
public void setValue(String name, Object value) {
if (this.properties == null) {
this.properties = new HashMap<>();
}
this.properties.put(name, value);
}
示例3: setProperty
import com.fasterxml.jackson.annotation.JsonAnySetter; //导入依赖的package包/类
@JsonAnySetter
public void setProperty(String key, List<String> values){
if(CollectionUtils.isEmpty(values)){
removeProperty(key);
} else {
properties.put(key, values);
}
}
示例4: setAdditionalProperty
import com.fasterxml.jackson.annotation.JsonAnySetter; //导入依赖的package包/类
@JsonAnySetter
public void setAdditionalProperty(String name, Object value) {
this.additionalProperties.put(name, value);
}
示例5: add
import com.fasterxml.jackson.annotation.JsonAnySetter; //导入依赖的package包/类
@JsonAnySetter
abstract void add(String key, Object value);
示例6: anySetter
import com.fasterxml.jackson.annotation.JsonAnySetter; //导入依赖的package包/类
@Override
public void anySetter(JMethod setter) {
setter.annotate(JsonAnySetter.class);
}
示例7: set
import com.fasterxml.jackson.annotation.JsonAnySetter; //导入依赖的package包/类
@JsonAnySetter
public void set(String name, String value) {
properties.put( name, value );
}
示例8: setAdditionalMap
import com.fasterxml.jackson.annotation.JsonAnySetter; //导入依赖的package包/类
@JsonAnySetter
public void setAdditionalMap(String name, Object value) {
additionalMap.put(name, value);
}
示例9: setAdditionalProperties
import com.fasterxml.jackson.annotation.JsonAnySetter; //导入依赖的package包/类
@JsonAnySetter
public void setAdditionalProperties(String name, Object value) {
this.additionalProperties.put(name, value);
}
示例10: set
import com.fasterxml.jackson.annotation.JsonAnySetter; //导入依赖的package包/类
@JsonAnySetter
public void set(final String name, final Object value) {
properties.put(name, value);
}
示例11: set
import com.fasterxml.jackson.annotation.JsonAnySetter; //导入依赖的package包/类
@JsonAnySetter
public void set(String key, Object value)
{
extras.put(key, value);
}
示例12: setConfigParam
import com.fasterxml.jackson.annotation.JsonAnySetter; //导入依赖的package包/类
@JsonAnySetter
protected void setConfigParam(String name, Object value) {
configuration.put(name, value);
}