當前位置: 首頁>>代碼示例>>Java>>正文


Java JsonAnySetter類代碼示例

本文整理匯總了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 + ".");
  }
}
 
開發者ID:naver,項目名稱:hadoop,代碼行數:9,代碼來源:LoggedJob.java

示例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 + ".");
  }
}
 
開發者ID:naver,項目名稱:hadoop,代碼行數:11,代碼來源:LoggedSingleRelativeRanking.java

示例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;
    }
}
 
開發者ID:AgarwalNeha1,項目名稱:gluu,代碼行數:32,代碼來源:Extension.java

示例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;
}
 
開發者ID:AgarwalNeha1,項目名稱:gluu,代碼行數:27,代碼來源:Extension.java

示例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;
}
 
開發者ID:HydAu,項目名稱:Camel,代碼行數:14,代碼來源:SummaryValue.java


注:本文中的org.codehaus.jackson.annotate.JsonAnySetter類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。