本文整理匯總了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);
}