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


Java Feature.config方法代码示例

本文整理汇总了Java中com.alibaba.fastjson.parser.Feature.config方法的典型用法代码示例。如果您正苦于以下问题:Java Feature.config方法的具体用法?Java Feature.config怎么用?Java Feature.config使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.alibaba.fastjson.parser.Feature的用法示例。


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

示例1: parseObject

import com.alibaba.fastjson.parser.Feature; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
public static <T> T parseObject(String input, Type clazz, int featureValues, Feature... features) {
    if (input == null) {
        return null;
    }

    for (Feature feature : features) {
        featureValues = Feature.config(featureValues, feature, true);
    }

    DefaultJSONParser parser = new DefaultJSONParser(input, ParserConfig.getGlobalInstance(), featureValues);
    T value = (T) parser.parseObject(clazz);

    parser.handleResovleTask(value);

    parser.close();

    return (T) value;
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:20,代码来源:JSON.java

示例2: parseObject

import com.alibaba.fastjson.parser.Feature; //导入方法依赖的package包/类
public static final <T> T parseObject(String input, Type clazz, ParserConfig config, ParseProcess processor, int featureValues, Feature... features) {
    if (input == null) {
        return null;
    }
    for (Feature featrue : features) {
        featureValues = Feature.config(featureValues, featrue, true);
    }
    DefaultJSONParser parser = new DefaultJSONParser(input, config, featureValues);
    if (processor instanceof ExtraTypeProvider) {
        parser.getExtraTypeProviders().add((ExtraTypeProvider) processor);
    }
    if (processor instanceof ExtraProcessor) {
        parser.getExtraProcessors().add((ExtraProcessor) processor);
    }
    T value = parser.parseObject(clazz);
    parser.handleResovleTask(value);
    parser.close();
    return value;
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:20,代码来源:JSON.java

示例3: parse

import com.alibaba.fastjson.parser.Feature; //导入方法依赖的package包/类
public static Object parse(byte[] input, int off, int len, CharsetDecoder charsetDecoder, Feature... features) {
    if (input == null || input.length == 0) {
        return null;
    }

    int featureValues = DEFAULT_PARSER_FEATURE;
    for (Feature feature : features) {
        featureValues = Feature.config(featureValues, feature, true);
    }

    return parse(input, off, len, charsetDecoder, featureValues);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:13,代码来源:JSON.java

示例4: test_date_1

import com.alibaba.fastjson.parser.Feature; //导入方法依赖的package包/类
public void test_date_1() throws Exception {
    int features = JSON.DEFAULT_PARSER_FEATURE;
    features = Feature.config(features, Feature.AllowISO8601DateFormat, true);
    DefaultJSONParser parser = new DefaultJSONParser("\"2011-01-09T13:49:53.254\"", ParserConfig.getGlobalInstance(), features);

    java.util.Date date = parser.parseObject(java.util.Date.class);

    Assert.assertEquals(new java.util.Date(1294552193254L), date);
    parser.close();
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:11,代码来源:DateParserTest.java

示例5: test_date_4

import com.alibaba.fastjson.parser.Feature; //导入方法依赖的package包/类
public void test_date_4() throws Exception {
    int features = JSON.DEFAULT_PARSER_FEATURE;
    features = Feature.config(features, Feature.AllowISO8601DateFormat, true);
    DefaultJSONParser parser = new DefaultJSONParser("\"2011-01-09\"", ParserConfig.getGlobalInstance(), features);

    java.util.Date date = parser.parseObject(java.util.Date.class);

    Assert.assertEquals(new java.util.Date(1294502400000L), date);
    parser.close();
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:11,代码来源:DateParserTest.java

示例6: test_date_6

import com.alibaba.fastjson.parser.Feature; //导入方法依赖的package包/类
public void test_date_6() throws Exception {
    int features = JSON.DEFAULT_PARSER_FEATURE;
    features = Feature.config(features, Feature.AllowISO8601DateFormat, true);

    java.util.Date date = JSON.parseObject("{d:\"2011-01-09T13:49:53\"}", Entity.class, Feature.AllowISO8601DateFormat).getD();

    Assert.assertEquals(new java.util.Date(1294552193000L), date);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:9,代码来源:DateParserTest.java

示例7: parse

import com.alibaba.fastjson.parser.Feature; //导入方法依赖的package包/类
public static final Object parse(byte[] input, int off, int len, CharsetDecoder charsetDecoder, Feature... features) {
    if (input == null || input.length == 0) {
        return null;
    }

    int featureValues = DEFAULT_PARSER_FEATURE;
    for (Feature featrue : features) {
        featureValues = Feature.config(featureValues, featrue, true);
    }

    return parse(input, off, len, charsetDecoder, featureValues);
}
 
开发者ID:uavorg,项目名称:uavstack,代码行数:13,代码来源:JSON.java

示例8: test_date_1

import com.alibaba.fastjson.parser.Feature; //导入方法依赖的package包/类
public void test_date_1() throws Exception {
    int features = JSON.DEFAULT_PARSER_FEATURE;
    features = Feature.config(features, Feature.AllowISO8601DateFormat, true);
    DefaultJSONParser parser = new DefaultJSONParser("\"2011-01-09T13:49:53.254\"", ParserConfig.getGlobalInstance(), features);

    java.sql.Date date = parser.parseObject(java.sql.Date.class);

    Assert.assertEquals(new java.sql.Date(1294552193254L), date);
    parser.close();
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:11,代码来源:DateParserTest_sql.java

示例9: test_date_3

import com.alibaba.fastjson.parser.Feature; //导入方法依赖的package包/类
public void test_date_3() throws Exception {
    int features = JSON.DEFAULT_PARSER_FEATURE;
    features = Feature.config(features, Feature.AllowISO8601DateFormat, true);
    DefaultJSONParser parser = new DefaultJSONParser("\"2011-01-09T13:49:53\"", ParserConfig.getGlobalInstance(), features);

    java.sql.Date date = parser.parseObject(java.sql.Date.class);

    Assert.assertEquals(new java.sql.Date(1294552193000L), date);
    parser.close();
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:11,代码来源:DateParserTest_sql.java

示例10: test_date_4

import com.alibaba.fastjson.parser.Feature; //导入方法依赖的package包/类
public void test_date_4() throws Exception {
    int features = JSON.DEFAULT_PARSER_FEATURE;
    features = Feature.config(features, Feature.AllowISO8601DateFormat, true);
    DefaultJSONParser parser = new DefaultJSONParser("\"2011-01-09\"", ParserConfig.getGlobalInstance(), features);

    java.sql.Date date = parser.parseObject(java.sql.Date.class);

    Assert.assertEquals(new java.sql.Date(1294502400000L), date);
    parser.close();
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:11,代码来源:DateParserTest_sql.java

示例11: parseObject

import com.alibaba.fastjson.parser.Feature; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
public static final <T> T parseObject(String input, Type clazz, ParserConfig config, ParseProcess processor,
                                      int featureValues, Feature... features) {
    if (input == null) {
        return null;
    }

    for (Feature featrue : features) {
        featureValues = Feature.config(featureValues, featrue, true);
    }

    DefaultJSONParser parser = new DefaultJSONParser(input, config, featureValues);

    if (processor instanceof ExtraTypeProvider) {
        parser.getExtraTypeProviders().add((ExtraTypeProvider) processor);
    }

    if (processor instanceof ExtraProcessor) {
        parser.getExtraProcessors().add((ExtraProcessor) processor);
    }

    T value = (T) parser.parseObject(clazz);

    parser.handleResovleTask(value);

    parser.close();

    return (T) value;
}
 
开发者ID:uavorg,项目名称:uavstack,代码行数:30,代码来源:JSON.java

示例12: test_date_3

import com.alibaba.fastjson.parser.Feature; //导入方法依赖的package包/类
public void test_date_3() throws Exception {
    int features = JSON.DEFAULT_PARSER_FEATURE;
    features = Feature.config(features, Feature.AllowISO8601DateFormat, true);
    DefaultJSONParser parser = new DefaultJSONParser("\"2011-01-09T13:49:53\"", ParserConfig.getGlobalInstance(), features);

    java.sql.Timestamp date = parser.parseObject(java.sql.Timestamp.class);

    Assert.assertEquals(new java.sql.Timestamp(1294552193000L), date);
    parser.close();
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:11,代码来源:DateParserTest_sql_timestamp.java

示例13: test_date_4

import com.alibaba.fastjson.parser.Feature; //导入方法依赖的package包/类
public void test_date_4() throws Exception {
    int features = JSON.DEFAULT_PARSER_FEATURE;
    features = Feature.config(features, Feature.AllowISO8601DateFormat, true);
    DefaultJSONParser parser = new DefaultJSONParser("\"2011-01-09\"", ParserConfig.getGlobalInstance(), features);

    java.sql.Timestamp date = parser.parseObject(java.sql.Timestamp.class);

    Assert.assertEquals(new java.sql.Timestamp(1294502400000L), date);
    parser.close();
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:11,代码来源:DateParserTest_sql_timestamp.java

示例14: parse

import com.alibaba.fastjson.parser.Feature; //导入方法依赖的package包/类
public static final Object parse(byte[] input, int off, int len, CharsetDecoder charsetDecoder, Feature... features) {
    if (input == null || input.length == 0) {
        return null;
    }
    int featureValues = DEFAULT_PARSER_FEATURE;
    for (Feature featrue : features) {
        featureValues = Feature.config(featureValues, featrue, true);
    }
    return parse(input, off, len, charsetDecoder, featureValues);
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:11,代码来源:JSON.java

示例15: test_6

import com.alibaba.fastjson.parser.Feature; //导入方法依赖的package包/类
public void test_6() throws Exception {
    int features = JSON.DEFAULT_PARSER_FEATURE;
    features = Feature.config(features, Feature.AllowSingleQuotes, true);

    Assert.assertEquals(true, Feature.isEnabled(features, Feature.AllowSingleQuotes));

    DefaultJSONParser parser = new DefaultJSONParser("'abc'", ParserConfig.getGlobalInstance(), features);

    Assert.assertEquals("abc", parser.parse());
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:11,代码来源:DefaultExtJSONParserTest_3.java


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