com.backendless.writer.serialization.BlConfigurationItemDescriptionOptionsDeserializer 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.JsonParser;
import com.fasterxml.jackson.core.JsonToken;
import com.fasterxml.jackson.databind.DeserializationContext;
import com.fasterxml.jackson.databind.JsonDeserializer;
import java.io.IOException;
public class BlConfigurationItemDescriptionOptionsDeserializer extends JsonDeserializer
{
@Override
public String deserialize( JsonParser jsonParser, DeserializationContext deserializationContext ) throws IOException
{
if (jsonParser.getCurrentToken() == JsonToken.VALUE_STRING)
return jsonParser.getValueAsString();
String[] values = jsonParser.readValueAs( String[].class );
if (values == null)
return "";
StringBuilder sb = new StringBuilder();
for( String val : values )
sb.append( val ).append( ',' );
sb.setLength( sb.length() - 1 );
return sb.toString();
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy