本文整理汇总了Java中org.codehaus.jackson.annotate.JsonAnyGetter类的典型用法代码示例。如果您正苦于以下问题:Java JsonAnyGetter类的具体用法?Java JsonAnyGetter怎么用?Java JsonAnyGetter使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
JsonAnyGetter类属于org.codehaus.jackson.annotate包,在下文中一共展示了JsonAnyGetter类的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getField
import org.codehaus.jackson.annotate.JsonAnyGetter; //导入依赖的package包/类
/**
* Return the value for the field with a given name and type.
*
* @param field
* The name of the field to retrieve the value of.
* @param extensionFieldType
* The type of the field.
* @return The value for the field with the given name.
* @throws NoSuchElementException
* if this schema does not contain a field of the given name.
* @throws IllegalArgumentException
* if the given field is null or an empty string or if the extensionFieldType is null.
*/
@JsonAnyGetter
public <T> T getField(String field, ExtensionFieldType<T> extensionFieldType) {
if (field == null || field.isEmpty()) {
throw new IllegalArgumentException("Invalid field name");
}
if (extensionFieldType == null) {
throw new IllegalArgumentException("Invalid field type");
}
if (!isFieldPresent(field)) {
throw new NoSuchElementException("Field " + field + " not valid in this extension");
}
return extensionFieldType.fromString(fields.get(field).value);
}
示例2: jsonVerbatimFields
import org.codehaus.jackson.annotate.JsonAnyGetter; //导入依赖的package包/类
/**
* This private method is only for serialization via jackson and not exposed anywhere else!
* It maps the verbatimField terms into properties with their full qualified name.
*/
@JsonAnyGetter
private Map<String, String> jsonVerbatimFields() {
Map<String, String> extendedProps = Maps.newHashMap();
for (Map.Entry<Term, String> prop : fields.entrySet()) {
extendedProps.put(prop.getKey().qualifiedName(), prop.getValue());
}
return extendedProps;
}
示例3: jsonVerbatimFields
import org.codehaus.jackson.annotate.JsonAnyGetter; //导入依赖的package包/类
/**
* This private method is only for serialization via jackson and not exposed anywhere else!
* It maps the verbatimField terms into properties with their full qualified name.
*/
@JsonAnyGetter
private Map<String, String> jsonVerbatimFields() { // note: for 1.6.0 MUST use non-getter name; otherwise doesn't matter
Map<String, String> extendedProps = Maps.newHashMap();
for (Map.Entry<Term, String> prop : verbatimFields.entrySet()) {
extendedProps.put(prop.getKey().qualifiedName(), prop.getValue());
}
return extendedProps;
}
示例4: jsonVerbatimFields
import org.codehaus.jackson.annotate.JsonAnyGetter; //导入依赖的package包/类
/**
* This private method is only for serialization via jackson and not exposed anywhere else!
* It maps the verbatimField terms into properties with their simple name or qualified names for UnknownTerms.
*/
@JsonAnyGetter
private Map<String, String> jsonVerbatimFields() {
Map<String, String> extendedProps = Maps.newHashMap();
for (Map.Entry<Term, String> prop : getVerbatimFields().entrySet()) {
Term t = prop.getKey();
if (t instanceof UnknownTerm || PROPERTIES.contains(t.simpleName())) {
extendedProps.put(t.qualifiedName(), prop.getValue());
} else {
// render all terms in controlled enumerations as simple names only - unless we have a property of that name already!
extendedProps.put(t.simpleName(), prop.getValue());
}
}
return extendedProps;
}
示例5: anyGetter
import org.codehaus.jackson.annotate.JsonAnyGetter; //导入依赖的package包/类
@Override
public void anyGetter(JMethod getter) {
getter.annotate(JsonAnyGetter.class);
}
示例6: getAdditionalProperties
import org.codehaus.jackson.annotate.JsonAnyGetter; //导入依赖的package包/类
@JsonAnyGetter
public Map<String, Object> getAdditionalProperties() {
return this.additionalProperties;
}
示例7: getAny
import org.codehaus.jackson.annotate.JsonAnyGetter; //导入依赖的package包/类
/**
* @return the map for holding unspecified (user) attributes
*/
@XmlAnyAttribute
@JsonAnyGetter
public Map<QName,Object> getAny() {
return attrs;
}