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


Java JSONSerializer.getWriter方法代码示例

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


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

示例1: write

import com.alibaba.fastjson.serializer.JSONSerializer; //导入方法依赖的package包/类
public void write(JSONSerializer serializer, Object object, Object fieldName, Type fieldType, int features) throws IOException {
    MediaContent entity = (MediaContent) object;

    SerializeWriter out = serializer.getWriter();
    out.write('[');
    
    mediaSerilaizer.write(serializer, entity.getMedia(), "media", Media.class, 0);
    out.write(',');
    
    out.write('[');
    for (int i = 0; i < entity.getImages().size(); ++i) {
        if (i != 0) {
            out.write(',');
        }
        Image image = entity.getImages().get(i);
        imageSerilaizer.write(serializer, image, i, fieldType, 0);
    }
    out.write(']');
    
    out.write(']');
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:22,代码来源:MediaContentSerializer.java

示例2: write

import com.alibaba.fastjson.serializer.JSONSerializer; //导入方法依赖的package包/类
public void write(JSONSerializer serializer, Object object, Object fieldName, Type fieldType, int features) throws IOException {
    Image image = (Image) object;

    SerializeWriter out = serializer.getWriter();
    out.write('[');
    
    out.writeInt(image.getHeight());
    out.write(',');
    out.writeInt(image.getWidth());
    out.write(',');
    out.writeString(image.getSize().name(), ',');
    out.writeString(image.getTitle(), ',');
    out.writeString(image.getUri());
    
    out.write(']');
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:17,代码来源:ImageSerializer.java

示例3: write

import com.alibaba.fastjson.serializer.JSONSerializer; //导入方法依赖的package包/类
public void write(JSONSerializer serializer, //
                  Object object, Object fieldName, Type fieldType, int features) throws IOException {
    SerializeWriter out = serializer.getWriter();
    Json json = (Json) object;
    String value = json.value();
    out.write(value);
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:8,代码来源:SwaggerJsonSerializer.java

示例4: write

import com.alibaba.fastjson.serializer.JSONSerializer; //导入方法依赖的package包/类
public void write(JSONSerializer serializer, Object object, Object fieldName, Type fieldType, int features) throws IOException {
    Media media = (Media) object;

    SerializeWriter out = serializer.getWriter();
    out.write('[');
    
    out.writeInt(media.getBitrate());
    out.write(',');
    out.writeInt(media.getHeight());
    out.write(',');
    out.writeInt(media.getWidth());
    out.write(',');
    out.writeString(media.getCopyright(), ',');
    out.writeLong(media.getDuration());
    out.write(',');
    out.writeString(media.getFormat(), ',');
    out.write('[');
    for (int i = 0; i < media.getPersons().size(); ++i) {
        if(i != 0) {
            out.write(',');
        }
        out.writeString(media.getPersons().get(i));
    }
    out.write("],");
    out.writeString(media.getPlayer().name(), ',');
    out.writeLong(media.getSize());
    out.write(',');
    out.writeString(media.getTitle(), ',');
    out.writeString(media.getUri(), ']');
}
 
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:31,代码来源:MediaSerializer.java

示例5: write

import com.alibaba.fastjson.serializer.JSONSerializer; //导入方法依赖的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

示例6: write

import com.alibaba.fastjson.serializer.JSONSerializer; //导入方法依赖的package包/类
@Override
public void write(JSONSerializer serializer, Object object, Object o1, Type type, int i) throws IOException {
    SerializeWriter out = serializer.getWriter();
    if (object == null) {
        out.writeNull();
        return;
    }
    out.writeString(object.toString());
}
 
开发者ID:okingjerryo,项目名称:WeiMusicCommunity-server,代码行数:10,代码来源:JodaTimeDeserializer.java

示例7: write

import com.alibaba.fastjson.serializer.JSONSerializer; //导入方法依赖的package包/类
public void write(JSONSerializer serializer, Object fieldName, Type fieldType) throws IOException {
    SerializeWriter writer = serializer.getWriter();
    writer.write(this.function);
    writer.write('(');
    for (int i = 0; i < this.parameters.size(); i++) {
        if (i != 0) {
            writer.write(',');
        }
        serializer.write(this.parameters.get(i));
    }
    writer.write(')');
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:13,代码来源:JSONPObject.java

示例8: write

import com.alibaba.fastjson.serializer.JSONSerializer; //导入方法依赖的package包/类
public void write(JSONSerializer serializer, Object object, Object fieldName, Type fieldType) throws IOException {
    SerializeWriter out = serializer.getWriter();
    if (object == null) {
        out.writeNull();
    } else {
        out.writeString(object.toString());
    }
}
 
开发者ID:JackChan1999,项目名称:boohee_v5.6,代码行数:9,代码来源:Jdk8DateCodec.java

示例9: write

import com.alibaba.fastjson.serializer.JSONSerializer; //导入方法依赖的package包/类
public void write(JSONSerializer serializer, Object fieldName, Type fieldType, int features) throws IOException {
    SerializeWriter writer = serializer.getWriter();
    writer.write(function);
    writer.write('(');
    for (int i = 0; i < parameters.size(); ++i) {
        if (i != 0) {
            writer.write(',');
        }
        serializer.write(parameters.get(i));
    }
    writer.write(')');
}
 
开发者ID:uavorg,项目名称:uavstack,代码行数:13,代码来源:JSONPObject.java


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