Example usage for com.fasterxml.jackson.core JsonGenerator writeString

List of usage examples for com.fasterxml.jackson.core JsonGenerator writeString

Introduction

In this page you can find the example usage for com.fasterxml.jackson.core JsonGenerator writeString.

Prototype

public abstract void writeString(SerializableString text) throws IOException, JsonGenerationException;

Source Link

Document

Method similar to #writeString(String) , but that takes SerializableString which can make this potentially more efficient to call as generator may be able to reuse quoted and/or encoded representation.

Usage

From source file:com.basistech.rosette.dm.jackson.array.ListAttributeArraySerializer.java

@Override
public void serializeWithType(ListAttribute value, JsonGenerator jgen, SerializerProvider provider,
        TypeSerializer typeSer) throws IOException {
    typeSer.writeTypePrefixForArray(value, jgen);
    jgen.writeString(KnownAttribute.getAttributeForClass(value.getItemClass()).key());
    writeItems(value, jgen, provider);//from w w  w . java 2s  .co  m
    writeExtendedProperties(value, jgen);
    typeSer.writeTypeSuffixForArray(value, jgen);
}

From source file:com.inversoft.json.LocaleSerializer.java

@Override
public void serialize(Locale value, JsonGenerator jgen, SerializerProvider provider)
        throws IOException, JsonGenerationException {
    if (value == null) {
        jgen.writeNull();//from  w w w .j  a  v a2s .c  om
    } else {
        jgen.writeString(value.toString());
    }
}

From source file:com.skcraft.launcher.model.minecraft.PlatformSerializer.java

@Override
public void serialize(Platform platform, JsonGenerator jsonGenerator, SerializerProvider serializerProvider)
        throws IOException, JsonProcessingException {
    switch (platform) {
    case WINDOWS:
        jsonGenerator.writeString("windows");
        break;/*from w w  w .  j  ava  2  s  .c  o m*/
    case MAC_OS_X:
        jsonGenerator.writeString("osx");
        break;
    case LINUX:
        jsonGenerator.writeString("linux");
        break;
    case SOLARIS:
        jsonGenerator.writeString("solaris");
        break;
    case UNKNOWN:
        jsonGenerator.writeNull();
        break;
    }
}

From source file:com.cedarsoft.serialization.jackson.StringSerializer.java

@Override
public void serialize(@Nonnull JsonGenerator serializeTo, @Nonnull String object,
        @Nonnull Version formatVersion) throws IOException, VersionException, JsonProcessingException {
    serializeTo.writeString(object);
}

From source file:com.cedarsoft.serialization.jackson.test.EmailSerializer.java

@Override
public void serialize(@Nonnull JsonGenerator serializeTo, @Nonnull Email object, @Nonnull Version formatVersion)
        throws IOException, VersionException, JsonProcessingException {
    serializeTo.writeString(object.getMail());
}

From source file:de.tudarmstadt.ukp.dkpro.core.io.brat.internal.model.BratEventAnnotation.java

@Override
public void write(JsonGenerator aJG) throws IOException {
    aJG.writeStartArray();/* w ww  . j  a  va2 s . c  o m*/
    aJG.writeString(getId());
    aJG.writeString(trigger);
    aJG.writeStartArray();
    for (BratEventArgument arg : arguments) {
        arg.write(aJG);
    }
    aJG.writeEndArray();
    aJG.writeEndArray();
}

From source file:com.create.databind.MoneySerializer.java

@Override
public void serialize(BigDecimal value, JsonGenerator jsonGenerator, SerializerProvider serializerProvider)
        throws IOException {
    final String moneyValue = value.setScale(CURRENCY_SCALE, BigDecimal.ROUND_HALF_UP).toString();
    jsonGenerator.writeString(moneyValue);
}

From source file:com.sixt.service.framework.logging.ServicePropertiesProvider.java

@Override
public void writeTo(JsonGenerator generator, DeferredProcessingAware deferredProcessingAware)
        throws IOException {
    generator.writeFieldName("service");
    generator.writeString(serviceName);
    generator.writeFieldName("service-version");
    generator.writeString(serviceVersion);
    generator.writeFieldName("service-id");
    generator.writeString(serviceInstanceId);
}

From source file:uk.gov.gchq.gaffer.core.exception.serialisation.StatusSerialiser.java

@Override
public void serialize(final Status statusType, final JsonGenerator generator, final SerializerProvider provider)
        throws IOException, JsonProcessingException {
    final String statusStr = statusType.toString().replace('_', ' ');

    generator.writeString(WordUtils.capitalize(statusStr));
}

From source file:org.jobscheduler.dashboard.domain.ParameterSerializer.java

@Override
public void serialize(String str, JsonGenerator jgen, SerializerProvider provider)
        throws IOException, JsonProcessingException {
    jgen.writeStartArray();//from   w w w .  j ava 2s .  c  o  m
    if ((str != null) && !(str.equals("null")))
        jgen.writeString(StringEscapeUtils.escapeHtml(str));
    else
        jgen.writeString("No parameter");
    jgen.writeEndArray();

}