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


Java SerializeWriter.writeFieldValue方法代码示例

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


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

示例1: write

import com.alibaba.fastjson.serializer.SerializeWriter; //导入方法依赖的package包/类
@Override
public void write(JSONSerializer serializer, Object object, Object fieldName, Type fieldType,
                  int features) throws IOException {
    Image image = (Image) object;
    
    SerializeWriter out = serializer.out;
    
    out.writeFieldValue('{', "height", image.getHeight());
    out.writeFieldValueStringWithDoubleQuote(',', "size", image.getSize().name());
    
    String tile = image.getTitle();
    out.writeFieldValueStringWithDoubleQuoteCheck(',', "title", tile);
    out.writeFieldValueStringWithDoubleQuoteCheck(',', "uri", image.getUri());
    out.writeFieldValue(',', "width", image.getWidth());

    out.write('}');
    // TODO
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:19,代码来源:FastjsonManualCodec.java

示例2: write

import com.alibaba.fastjson.serializer.SerializeWriter; //导入方法依赖的package包/类
@Override
public void write(JSONSerializer serializer, Object object, Object fieldName, Type fieldType,
                  int features) throws IOException {
    Model model = (Model) object;
    SerializeWriter out = serializer.getWriter();
    out.writeFieldValue('{', "ID", model.id);
    out.write('}');
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:9,代码来源:CustomSerializerTest.java

示例3: test_0

import com.alibaba.fastjson.serializer.SerializeWriter; //导入方法依赖的package包/类
public void test_0() throws Exception {
    StringWriter out = new StringWriter();
    
    SerializeWriter writer = new SerializeWriter(out, 10);
    Assert.assertEquals(10, writer.getBufferLength());
    
    writer.writeFieldValue(',', "abcde01245abcde", true);
    writer.close();
    
    String text = out.toString();
    Assert.assertEquals(",abcde01245abcde:true", text);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:13,代码来源:StreamWriterTest_writeFieldValue_bool.java

示例4: test_0

import com.alibaba.fastjson.serializer.SerializeWriter; //导入方法依赖的package包/类
public void test_0() throws Exception {
    StringWriter out = new StringWriter();
    
    SerializeWriter writer = new SerializeWriter(out, 10);
    writer.config(SerializerFeature.QuoteFieldNames, true);
    Assert.assertEquals(10, writer.getBufferLength());
    
    writer.writeFieldValue(',', "abcde01245abcde", 123L);
    writer.close();
    
    String text = out.toString();
    Assert.assertEquals(",\"abcde01245abcde\":123", text);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:14,代码来源:StreamWriterTest_writeFieldValue_long.java

示例5: test_0

import com.alibaba.fastjson.serializer.SerializeWriter; //导入方法依赖的package包/类
public void test_0() throws Exception {
    StringWriter out = new StringWriter();
    
    SerializeWriter writer = new SerializeWriter(out, 10);
    writer.config(SerializerFeature.QuoteFieldNames, true);
    Assert.assertEquals(10, writer.getBufferLength());
    
    writer.writeFieldValue(',', "abcde01245abcde", "123");
    writer.close();
    
    String text = out.toString();
    Assert.assertEquals(",\"abcde01245abcde\":\"123\"", text);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:14,代码来源:StreamWriterTest_writeFieldValue_string.java

示例6: test_0

import com.alibaba.fastjson.serializer.SerializeWriter; //导入方法依赖的package包/类
public void test_0() throws Exception {
    StringWriter out = new StringWriter();
    
    SerializeWriter writer = new SerializeWriter(out, 10);
    writer.config(SerializerFeature.QuoteFieldNames, true);
    Assert.assertEquals(10, writer.getBufferLength());
    
    writer.writeFieldValue(',', "abcde01245abcde", 123);
    writer.close();
    
    String text = out.toString();
    Assert.assertEquals(",\"abcde01245abcde\":123", text);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:14,代码来源:StreamWriterTest_writeFieldValue_int.java

示例7: test_0

import com.alibaba.fastjson.serializer.SerializeWriter; //导入方法依赖的package包/类
public void test_0() throws Exception {
    StringWriter out = new StringWriter();
    
    SerializeWriter writer = new SerializeWriter(out, 10);
    writer.config(SerializerFeature.QuoteFieldNames, true);
    writer.config(SerializerFeature.UseSingleQuotes, true);
    Assert.assertEquals(10, writer.getBufferLength());
    
    writer.writeFieldValue(',', "abcde01245abcde", "123");
    writer.close();
    
    String text = out.toString();
    Assert.assertEquals(",'abcde01245abcde':'123'", text);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:15,代码来源:StreamWriterTest_writeFieldValue_string_singQuote.java

示例8: test_0

import com.alibaba.fastjson.serializer.SerializeWriter; //导入方法依赖的package包/类
public void test_0() throws Exception {
    StringWriter out = new StringWriter();
    
    SerializeWriter writer = new SerializeWriter(out, 10);
    Assert.assertEquals(10, writer.getBufferLength());
    
    writer.writeFieldValue(',', "abcde01245abcde", 123);
    writer.close();
    
    String text = out.toString();
    Assert.assertEquals(",abcde01245abcde:123", text);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:13,代码来源:StreamWriterTest_writeFieldValue_int_1.java

示例9: test_0

import com.alibaba.fastjson.serializer.SerializeWriter; //导入方法依赖的package包/类
public void test_0() throws Exception {
    StringWriter out = new StringWriter();
    
    SerializeWriter writer = new SerializeWriter(out, 10);
    Assert.assertEquals(10, writer.getBufferLength());
    
    writer.config(SerializerFeature.QuoteFieldNames, true);
    writer.writeFieldValue(',', "abcde01245abcde", true);
    writer.close();
    
    String text = out.toString();
    Assert.assertEquals(",\"abcde01245abcde\":true", text);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:14,代码来源:StreamWriterTest_writeFieldValue.java

示例10: test_3

import com.alibaba.fastjson.serializer.SerializeWriter; //导入方法依赖的package包/类
public void test_3() throws Exception {
    SerializeWriter out = new SerializeWriter(1);
    out.config(SerializerFeature.QuoteFieldNames, true);
    out.config(SerializerFeature.UseSingleQuotes, true);
    out.writeFieldValue(',', "name", (String) null);
    Assert.assertEquals(",'name':null", out.toString());
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:8,代码来源:SerializeWriterTest_5.java

示例11: test_4

import com.alibaba.fastjson.serializer.SerializeWriter; //导入方法依赖的package包/类
public void test_4() throws Exception {
    SerializeWriter out = new SerializeWriter(1);
    out.config(SerializerFeature.QuoteFieldNames, true);
    out.config(SerializerFeature.UseSingleQuotes, true);
    out.writeFieldValue(',', "name", (String) null);
    Assert.assertEquals(",'name':null", out.toString());
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:8,代码来源:SerializeWriterTest_5.java

示例12: test_0

import com.alibaba.fastjson.serializer.SerializeWriter; //导入方法依赖的package包/类
public void test_0() throws Exception {
    SerializeWriter out = new SerializeWriter(1);
    out.config(SerializerFeature.QuoteFieldNames, true);
    out.config(SerializerFeature.WriteTabAsSpecial, true);
    out.writeFieldValue(',', "name", "\t");
    Assert.assertEquals(",\"name\":\"\\t\"", out.toString());
    out.close();
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:9,代码来源:SerializeWriterTest_4.java

示例13: test_1

import com.alibaba.fastjson.serializer.SerializeWriter; //导入方法依赖的package包/类
public void test_1() throws Exception {
    SerializeWriter out = new SerializeWriter(1);
    out.config(SerializerFeature.QuoteFieldNames, true);
    out.config(SerializerFeature.WriteTabAsSpecial, true);
    out.writeFieldValue(',', "name", "\t\n");
    Assert.assertEquals(",\"name\":\"\\t\\n\"", out.toString());
    out.close();
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:9,代码来源:SerializeWriterTest_4.java

示例14: test_4

import com.alibaba.fastjson.serializer.SerializeWriter; //导入方法依赖的package包/类
public void test_4() throws Exception {
    SerializeWriter out = new SerializeWriter(1);
    out.config(SerializerFeature.QuoteFieldNames, true);
    out.config(SerializerFeature.WriteTabAsSpecial, false);
    out.writeFieldValue(',', "name", "\t\n \b\n\r\f\\ \"");
    Assert.assertEquals(",\"name\":\"\\t\\n \\b\\n\\r\\f\\\\ \\\"\"", out.toString());
    out.close();
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:9,代码来源:SerializeWriterTest_4.java

示例15: test_null_1

import com.alibaba.fastjson.serializer.SerializeWriter; //导入方法依赖的package包/类
public void test_null_1() throws Exception {
    SerializeWriter out = new SerializeWriter(1);
    out.config(SerializerFeature.QuoteFieldNames, false);
    out.writeFieldValue(',', "name", (String) null);
    Assert.assertEquals(",name:null", out.toString());
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:7,代码来源:SerializeWriterTest_3.java


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