com.backendless.writer.serialization.BlConfigurationItemDescriptionOptionsSerializer Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of commons Show documentation
Show all versions of commons Show documentation
Commons lib for both server and client Java/Android SDKs
The newest version!
package com.backendless.writer.serialization;
import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.JsonSerializer;
import com.fasterxml.jackson.databind.SerializerProvider;
import java.io.IOException;
public class BlConfigurationItemDescriptionOptionsSerializer extends JsonSerializer
{
@Override
public void serialize( String field, JsonGenerator jsonGenerator,
SerializerProvider serializerProvider ) throws IOException, JsonProcessingException
{
if(field == null)
{
jsonGenerator.writeNull( );
return;
}
jsonGenerator.writeStartArray();
for( String value : getOptions( field ) )
{
jsonGenerator.writeString( value );
}
jsonGenerator.writeEndArray();
}
private static String[] getOptions( String optionsStr )
{
if( optionsStr == null )
return null;
return optionsStr.split( "," );
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy