本文整理匯總了Java中org.codehaus.jackson.annotate.JsonAnySetter類的典型用法代碼示例。如果您正苦於以下問題:Java JsonAnySetter類的具體用法?Java JsonAnySetter怎麽用?Java JsonAnySetter使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
JsonAnySetter類屬於org.codehaus.jackson.annotate包,在下文中一共展示了JsonAnySetter類的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: setUnknownAttribute
import org.codehaus.jackson.annotate.JsonAnySetter; //導入依賴的package包/類
@JsonAnySetter
public void setUnknownAttribute(String attributeName, Object ignored) {
if (!alreadySeenAnySetterAttributes.contains(attributeName)) {
alreadySeenAnySetterAttributes.add(attributeName);
System.err.println("In LoggedJob, we saw the unknown attribute "
+ attributeName + ".");
}
}
示例2: setUnknownAttribute
import org.codehaus.jackson.annotate.JsonAnySetter; //導入依賴的package包/類
@SuppressWarnings("unused")
// for input parameter ignored.
@JsonAnySetter
public void setUnknownAttribute(String attributeName, Object ignored) {
if (!alreadySeenAnySetterAttributes.contains(attributeName)) {
alreadySeenAnySetterAttributes.add(attributeName);
System.err.println("In LoggedJob, we saw the unknown attribute "
+ attributeName + ".");
}
}
示例3: setFieldAsList
import org.codehaus.jackson.annotate.JsonAnySetter; //導入依賴的package包/類
@JsonAnySetter
public Builder setFieldAsList(String fieldName, List<?> values) throws Exception {
ObjectMapper mapper = new ObjectMapper();
mapper.disable(DeserializationConfig.Feature.FAIL_ON_UNKNOWN_PROPERTIES);
Date[] dateArray = null;
boolean isDateArray = false;
try {
dateArray = (Date[])values.toArray();
isDateArray = true;
} catch (Exception e) {
}
if (isDateArray) {
DateTimeFormatter dateTimeFormatter = ISODateTimeFormat.dateTime().withZoneUTC();
List<String> stringDateList = new ArrayList<String>();
for (Date date : dateArray) {
stringDateList.add(dateTimeFormatter.print(date.getTime()));
}
setField(fieldName, mapper.writeValueAsString(stringDateList), ExtensionFieldType.STRING, true);
return this;
} else {
setField(fieldName, mapper.writeValueAsString(values), ExtensionFieldType.STRING, true);
return this;
}
}
示例4: setField
import org.codehaus.jackson.annotate.JsonAnySetter; //導入依賴的package包/類
/**
* Sets the field specified by the given field name with the given value of the given type. <br>
* Can only be set and saved if extension field is registered in the database
*
* @param fieldName
* the field name
* @param value
* the new value
* @param type
* the scim2 type of the field
* @return the builder itself
*/
@JsonAnySetter
public <T> Builder setField(String fieldName, T value, ExtensionFieldType<T> type, boolean isMultiValued) {
if (fieldName == null || fieldName.isEmpty()) {
throw new IllegalArgumentException("The field name can't be null or empty.");
}
if (value == null) {
throw new IllegalArgumentException("The value can't be null.");
}
if (type == null) {
throw new IllegalArgumentException("The type can't be null.");
}
fields.put(fieldName, new Field(type, type.toString(value), isMultiValued));
return this;
}
示例5: setAny
import org.codehaus.jackson.annotate.JsonAnySetter; //導入依賴的package包/類
/**
* Helper method for JSON un-marshaling.
* @param name field name, MUST be "value"
* @param value field value
* @throws java.lang.IllegalArgumentException if field name is not "value"
*/
@JsonAnySetter
public void setAny(String name, Object value) throws IllegalArgumentException {
if (!VALUE_FIELD.equals(name)) {
throw new IllegalArgumentException(name);
}
this.value = value;
}