当前位置: 首页>>代码示例>>Java>>正文


Java JsonAutoDetect类代码示例

本文整理汇总了Java中org.codehaus.jackson.annotate.JsonAutoDetect的典型用法代码示例。如果您正苦于以下问题:Java JsonAutoDetect类的具体用法?Java JsonAutoDetect怎么用?Java JsonAutoDetect使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


JsonAutoDetect类属于org.codehaus.jackson.annotate包,在下文中一共展示了JsonAutoDetect类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getNewRowFromDb

import org.codehaus.jackson.annotate.JsonAutoDetect; //导入依赖的package包/类
public byte[] getNewRowFromDb() {
    boolean isFirstElement = mainId == null;
    Row row = inflateRow();
    if (row != null) {
        try {
            ObjectMapper mapper = new ObjectMapper();
            mapper.getSerializationConfig().withSerializationInclusion(JsonSerialize.Inclusion.NON_NULL);
            mapper.setVisibility(JsonMethod.ALL, JsonAutoDetect.Visibility.NONE);
            mapper.setVisibility(JsonMethod.FIELD, JsonAutoDetect.Visibility.ANY);
            String json = mapper.writerWithDefaultPrettyPrinter().writeValueAsString(row);
            json = isFirstElement ? "" + json : "," + json;
            return json.getBytes();
        } catch (Exception e) {
            throw new AqlException("Failed to convert Aql Result to JSON", e);
        }
    }
    return null;
}
 
开发者ID:alancnet,项目名称:artifactory,代码行数:19,代码来源:AqlJsonStreamer.java

示例2: JacksonContextResolver

import org.codehaus.jackson.annotate.JsonAutoDetect; //导入依赖的package包/类
public JacksonContextResolver() throws Exception {
    this.mapper = new ObjectMapper()
            .setDefaultTyping(new OvirtTypeResolverBuilder())

            .configure(SerializationConfig.Feature.FAIL_ON_EMPTY_BEANS, false)
            .configure(SerializationConfig.Feature.WRITE_DATES_AS_TIMESTAMPS, false)

            .configure(DeserializationConfig.Feature.FAIL_ON_NULL_FOR_PRIMITIVES, false)
            .configure(DeserializationConfig.Feature.FAIL_ON_UNKNOWN_PROPERTIES, false);

    mapper.setVisibilityChecker(mapper.getSerializationConfig().getDefaultVisibilityChecker()
            .withFieldVisibility(JsonAutoDetect.Visibility.NON_PRIVATE)
            .withGetterVisibility(JsonAutoDetect.Visibility.NONE)
            .withSetterVisibility(JsonAutoDetect.Visibility.NONE)
            .withCreatorVisibility(JsonAutoDetect.Visibility.DEFAULT));

    mapper.registerModule(new OvirtSdkEnhancer());

}
 
开发者ID:oVirt,项目名称:ovirt-optimizer,代码行数:20,代码来源:JacksonContextResolver.java

示例3: with

import org.codehaus.jackson.annotate.JsonAutoDetect; //导入依赖的package包/类
public Std with(JsonAutoDetect ann)
{
    if (ann == null) return this;
    Std curr = this;

    JsonMethod[] incl = ann.value();
    Visibility v;

    v = hasMethod(incl, JsonMethod.GETTER) ? ann.getterVisibility() : Visibility.NONE;
    curr = curr.withGetterVisibility(v);
    v = hasMethod(incl, JsonMethod.IS_GETTER) ? ann.isGetterVisibility() : Visibility.NONE;
    curr = curr.withIsGetterVisibility(v);
    v = hasMethod(incl, JsonMethod.SETTER) ? ann.setterVisibility() : Visibility.NONE;
           curr  = curr.withSetterVisibility(v);
           v = hasMethod(incl, JsonMethod.CREATOR) ? ann.creatorVisibility() : Visibility.NONE;
           curr = curr.withCreatorVisibility(v);
           v = hasMethod(incl, JsonMethod.FIELD) ? ann.fieldVisibility() : Visibility.NONE;
           curr = curr.withFieldVisibility(v);
    return curr;
}
 
开发者ID:r00li,项目名称:RHome,代码行数:21,代码来源:VisibilityChecker.java

示例4: tokenAuthen

import org.codehaus.jackson.annotate.JsonAutoDetect; //导入依赖的package包/类
public SlackInfo tokenAuthen(String token, String proxyUrl, int proxyPort) {
    HttpClient client = new HttpClient();
    if (proxyUrl != null) {
        HostConfiguration hostConfiguration = new HostConfiguration();
        hostConfiguration.setProxyHost(new ProxyHost(proxyUrl, proxyPort));
        client.setHostConfiguration(hostConfiguration);
    }

    GetMethod getMethod = new GetMethod(SLACK_RTM_AUTHEN_URL + token);
    SlackInfo slackInfo = new SlackInfo();

    try {
        int httpStatus = client.executeMethod(getMethod);
        if (httpStatus == HttpStatus.SC_OK) {
            ObjectMapper mapper = new ObjectMapper().setVisibility(JsonMethod.FIELD, JsonAutoDetect.Visibility.ANY);
            mapper.configure(DeserializationConfig.Feature.FAIL_ON_UNKNOWN_PROPERTIES, false);

            return mapper.readValue(getMethod.getResponseBodyAsStream(), SlackInfo.class);
        } else {
            slackInfo.setError("http_status_" + httpStatus);
            return slackInfo;
        }
    } catch (IOException ex) {
        slackInfo.setError("exception " + ex.getMessage());
        Logger.getLogger(SlackAuthen.class.getName()).log(Level.SEVERE, null, ex);
    } finally {
        getMethod.releaseConnection();
    }
    return slackInfo;
}
 
开发者ID:mockupcode,项目名称:slack-rtm-api,代码行数:31,代码来源:SlackAuthen.java

示例5: generateRangeJson

import org.codehaus.jackson.annotate.JsonAutoDetect; //导入依赖的package包/类
private String generateRangeJson() throws IOException {
    Range range = new Range(offset, rowsCount, rowsCount, limit);
    ObjectMapper mapper = new ObjectMapper();
    mapper.getSerializationConfig().withSerializationInclusion(JsonSerialize.Inclusion.NON_NULL);
    mapper.setVisibility(JsonMethod.ALL, JsonAutoDetect.Visibility.NONE);
    mapper.setVisibility(JsonMethod.FIELD, JsonAutoDetect.Visibility.ANY);
    return mapper.writerWithDefaultPrettyPrinter().writeValueAsString(range);
}
 
开发者ID:alancnet,项目名称:artifactory,代码行数:9,代码来源:AqlJsonStreamer.java

示例6: findAutoDetectVisibility

import org.codehaus.jackson.annotate.JsonAutoDetect; //导入依赖的package包/类
public VisibilityChecker<?> findAutoDetectVisibility(AnnotatedClass paramAnnotatedClass, VisibilityChecker<?> paramVisibilityChecker)
{
  JsonAutoDetect localJsonAutoDetect = (JsonAutoDetect)paramAnnotatedClass.getAnnotation(JsonAutoDetect.class);
  if (localJsonAutoDetect == null)
    return paramVisibilityChecker;
  return paramVisibilityChecker.with(localJsonAutoDetect);
}
 
开发者ID:zhangjianying,项目名称:12306-android-Decompile,代码行数:8,代码来源:JacksonAnnotationIntrospector.java

示例7: Std

import org.codehaus.jackson.annotate.JsonAutoDetect; //导入依赖的package包/类
public Std(JsonAutoDetect.Visibility paramVisibility1, JsonAutoDetect.Visibility paramVisibility2, JsonAutoDetect.Visibility paramVisibility3, JsonAutoDetect.Visibility paramVisibility4, JsonAutoDetect.Visibility paramVisibility5)
{
  this._getterMinLevel = paramVisibility1;
  this._isGetterMinLevel = paramVisibility2;
  this._setterMinLevel = paramVisibility3;
  this._creatorMinLevel = paramVisibility4;
  this._fieldMinLevel = paramVisibility5;
}
 
开发者ID:zhangjianying,项目名称:12306-android-Decompile,代码行数:9,代码来源:VisibilityChecker.java

示例8: withCreatorVisibility

import org.codehaus.jackson.annotate.JsonAutoDetect; //导入依赖的package包/类
public Std withCreatorVisibility(JsonAutoDetect.Visibility paramVisibility)
{
  if (paramVisibility == JsonAutoDetect.Visibility.DEFAULT)
    paramVisibility = DEFAULT._creatorMinLevel;
  if (this._creatorMinLevel == paramVisibility)
    return this;
  JsonAutoDetect.Visibility localVisibility1 = this._getterMinLevel;
  JsonAutoDetect.Visibility localVisibility2 = this._isGetterMinLevel;
  JsonAutoDetect.Visibility localVisibility3 = this._setterMinLevel;
  JsonAutoDetect.Visibility localVisibility4 = this._fieldMinLevel;
  return new Std(localVisibility1, localVisibility2, localVisibility3, paramVisibility, localVisibility4);
}
 
开发者ID:zhangjianying,项目名称:12306-android-Decompile,代码行数:13,代码来源:VisibilityChecker.java

示例9: withFieldVisibility

import org.codehaus.jackson.annotate.JsonAutoDetect; //导入依赖的package包/类
public Std withFieldVisibility(JsonAutoDetect.Visibility paramVisibility)
{
  if (paramVisibility == JsonAutoDetect.Visibility.DEFAULT)
    paramVisibility = DEFAULT._fieldMinLevel;
  if (this._fieldMinLevel == paramVisibility)
    return this;
  return new Std(this._getterMinLevel, this._isGetterMinLevel, this._setterMinLevel, this._creatorMinLevel, paramVisibility);
}
 
开发者ID:zhangjianying,项目名称:12306-android-Decompile,代码行数:9,代码来源:VisibilityChecker.java

示例10: withGetterVisibility

import org.codehaus.jackson.annotate.JsonAutoDetect; //导入依赖的package包/类
public Std withGetterVisibility(JsonAutoDetect.Visibility paramVisibility)
{
  if (paramVisibility == JsonAutoDetect.Visibility.DEFAULT)
    paramVisibility = DEFAULT._getterMinLevel;
  if (this._getterMinLevel == paramVisibility)
    return this;
  JsonAutoDetect.Visibility localVisibility1 = this._isGetterMinLevel;
  JsonAutoDetect.Visibility localVisibility2 = this._setterMinLevel;
  JsonAutoDetect.Visibility localVisibility3 = this._creatorMinLevel;
  JsonAutoDetect.Visibility localVisibility4 = this._fieldMinLevel;
  return new Std(paramVisibility, localVisibility1, localVisibility2, localVisibility3, localVisibility4);
}
 
开发者ID:zhangjianying,项目名称:12306-android-Decompile,代码行数:13,代码来源:VisibilityChecker.java

示例11: withIsGetterVisibility

import org.codehaus.jackson.annotate.JsonAutoDetect; //导入依赖的package包/类
public Std withIsGetterVisibility(JsonAutoDetect.Visibility paramVisibility)
{
  if (paramVisibility == JsonAutoDetect.Visibility.DEFAULT)
    paramVisibility = DEFAULT._isGetterMinLevel;
  if (this._isGetterMinLevel == paramVisibility)
    return this;
  JsonAutoDetect.Visibility localVisibility1 = this._getterMinLevel;
  JsonAutoDetect.Visibility localVisibility2 = this._setterMinLevel;
  JsonAutoDetect.Visibility localVisibility3 = this._creatorMinLevel;
  JsonAutoDetect.Visibility localVisibility4 = this._fieldMinLevel;
  return new Std(localVisibility1, paramVisibility, localVisibility2, localVisibility3, localVisibility4);
}
 
开发者ID:zhangjianying,项目名称:12306-android-Decompile,代码行数:13,代码来源:VisibilityChecker.java

示例12: withSetterVisibility

import org.codehaus.jackson.annotate.JsonAutoDetect; //导入依赖的package包/类
public Std withSetterVisibility(JsonAutoDetect.Visibility paramVisibility)
{
  if (paramVisibility == JsonAutoDetect.Visibility.DEFAULT)
    paramVisibility = DEFAULT._setterMinLevel;
  if (this._setterMinLevel == paramVisibility)
    return this;
  JsonAutoDetect.Visibility localVisibility1 = this._getterMinLevel;
  JsonAutoDetect.Visibility localVisibility2 = this._isGetterMinLevel;
  JsonAutoDetect.Visibility localVisibility3 = this._creatorMinLevel;
  JsonAutoDetect.Visibility localVisibility4 = this._fieldMinLevel;
  return new Std(localVisibility1, localVisibility2, paramVisibility, localVisibility3, localVisibility4);
}
 
开发者ID:zhangjianying,项目名称:12306-android-Decompile,代码行数:13,代码来源:VisibilityChecker.java

示例13: Std

import org.codehaus.jackson.annotate.JsonAutoDetect; //导入依赖的package包/类
/**
        * Constructor used for building instance that has minumum visibility
        * levels as indicated by given annotation instance
        * 
        * @param ann Annotations to use for determining minimum visibility levels
        */
public Std(JsonAutoDetect ann)
{
    JsonMethod[] incl = ann.value();
    // let's combine checks for enabled/disabled, with minimimum level checks:
    _getterMinLevel = hasMethod(incl, JsonMethod.GETTER) ? ann.getterVisibility() : Visibility.NONE;
           _isGetterMinLevel = hasMethod(incl, JsonMethod.IS_GETTER) ? ann.isGetterVisibility() : Visibility.NONE;
           _setterMinLevel = hasMethod(incl, JsonMethod.SETTER) ? ann.setterVisibility() : Visibility.NONE;
           _creatorMinLevel = hasMethod(incl, JsonMethod.CREATOR) ? ann.creatorVisibility() : Visibility.NONE;
           _fieldMinLevel = hasMethod(incl, JsonMethod.FIELD) ? ann.fieldVisibility() : Visibility.NONE;
}
 
开发者ID:r00li,项目名称:RHome,代码行数:17,代码来源:VisibilityChecker.java

示例14: DefaultObjectMapper

import org.codehaus.jackson.annotate.JsonAutoDetect; //导入依赖的package包/类
public DefaultObjectMapper() {
    configure(SerializationConfig.Feature.INDENT_OUTPUT, true);
    configure(SerializationConfig.Feature.FAIL_ON_EMPTY_BEANS, false);
    setSerializationInclusion(JsonSerialize.Inclusion.ALWAYS);
    configure(DeserializationConfig.Feature.FAIL_ON_UNKNOWN_PROPERTIES, false);
    setVisibility(JsonMethod.ALL, JsonAutoDetect.Visibility.PUBLIC_ONLY);
}
 
开发者ID:blacklocus,项目名称:jersey-jump,代码行数:8,代码来源:DefaultObjectMapper.java

示例15: JacksonObjectMapperWithOptions

import org.codehaus.jackson.annotate.JsonAutoDetect; //导入依赖的package包/类
public JacksonObjectMapperWithOptions() {
    super();
    this.getJsonFactory().setCharacterEscapes(new HTMLCharacterEscapes());
    configure(JsonParser.Feature.ALLOW_SINGLE_QUOTES, true);
    configure(JsonParser.Feature.ALLOW_UNQUOTED_FIELD_NAMES, true);
    configure(DeserializationConfig.Feature.FAIL_ON_UNKNOWN_PROPERTIES, false);
    configure(DeserializationConfig.Feature.CAN_OVERRIDE_ACCESS_MODIFIERS, true);
    configure(DeserializationConfig.Feature.AUTO_DETECT_FIELDS, true);
    setVisibilityChecker(VisibilityChecker.Std.defaultInstance().withFieldVisibility(JsonAutoDetect.Visibility.ANY));
}
 
开发者ID:inbloom,项目名称:secure-data-service,代码行数:11,代码来源:JacksonObjectMapperWithOptions.java


注:本文中的org.codehaus.jackson.annotate.JsonAutoDetect类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。