use of com.fasterxml.jackson.core.io.SerializedString in project jackson-databind by FasterXML.
the class SequenceWriterTest method testSimpleNonArray.
public void testSimpleNonArray() throws Exception {
StringWriter strw = new StringWriter();
SequenceWriter w = WRITER.forType(Bean.class).writeValues(strw);
w.write(new Bean(13)).write(new Bean(-6)).writeAll(new Bean[] { new Bean(3), new Bean(1) }).writeAll(Arrays.asList(new Bean(5), new Bean(7)));
w.close();
assertEquals(aposToQuotes("{'a':13}\n{'a':-6}\n{'a':3}\n{'a':1}\n{'a':5}\n{'a':7}"), strw.toString());
strw = new StringWriter();
JsonGenerator gen = WRITER.getFactory().createGenerator(strw);
w = WRITER.withRootValueSeparator(new SerializedString("/")).writeValues(gen);
w.write(new Bean(1)).write(new Bean(2));
w.close();
gen.close();
assertEquals(aposToQuotes("{'a':1}/{'a':2}"), strw.toString());
}
use of com.fasterxml.jackson.core.io.SerializedString in project jackson-databind by FasterXML.
the class ObjectIdWriter method construct.
/**
* Factory method called by {@link com.fasterxml.jackson.databind.ser.std.BeanSerializerBase}
* with the initial information based on standard settings for the type
* for which serializer is being built.
*
* @since 2.3
*/
public static ObjectIdWriter construct(JavaType idType, PropertyName propName, ObjectIdGenerator<?> generator, boolean alwaysAsId) {
String simpleName = (propName == null) ? null : propName.getSimpleName();
SerializableString serName = (simpleName == null) ? null : new SerializedString(simpleName);
return new ObjectIdWriter(idType, serName, generator, null, alwaysAsId);
}
use of com.fasterxml.jackson.core.io.SerializedString in project jackson-databind by FasterXML.
the class UnwrappingBeanPropertyWriter method rename.
@Override
public UnwrappingBeanPropertyWriter rename(NameTransformer transformer) {
String oldName = _name.getValue();
String newName = transformer.transform(oldName);
// important: combine transformers:
transformer = NameTransformer.chainedTransformer(transformer, _nameTransformer);
return _new(transformer, new SerializedString(newName));
}
Aggregations