Refine search
/** * Method that allows overriding String used for separating root-level * JSON values (default is single space character) * * @param sep Separator to use, if any; null means that no separator is * automatically added * * @since 2.1 */ public JsonFactory setRootValueSeparator(String sep) { _rootValueSeparator = (sep == null) ? null : new SerializedString(sep); return this; }
@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)); }
/** * 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); }
public BeanPropertyWriter rename(NameTransformer transformer) { String newName = transformer.transform(_name.getValue()); if (newName.equals(_name.toString())) { return this; } return new BeanPropertyWriter(this, new SerializedString(newName)); }
@Override public PropertyName getFullName() { // !!! TODO: impl properly return new PropertyName(_name.getValue()); }
public synchronized SerializedString findRootName(Class<?> rootType, MapperConfig<?> config) { ClassKey key = new ClassKey(rootType); if (_rootNames == null) { _rootNames = new LRUMap<ClassKey,SerializedString>(20, 200); } else { SerializedString name = _rootNames.get(key); if (name != null) { return name; } } BeanDescription beanDesc = config.introspectClassAnnotations(rootType); AnnotationIntrospector intr = config.getAnnotationIntrospector(); AnnotatedClass ac = beanDesc.getClassInfo(); PropertyName pname = intr.findRootName(ac); String nameStr; // No answer so far? Let's just default to using simple class name if (pname == null || !pname.hasSimpleName()) { // Should we strip out enclosing class tho? For now, nope: nameStr = rootType.getSimpleName(); } else { nameStr = pname.getSimpleName(); } SerializedString name = new SerializedString(nameStr); _rootNames.put(key, name); return name; } }
public BeanPropertyWriter rename(NameTransformer transformer) { String newName = transformer.transform(_name.getValue()); if (newName.equals(_name.toString())) { return this; } return new BeanPropertyWriter(this, new PropertyName(newName)); }
throws JsonParseException, IOException { SerializedString keyDocContent = new SerializedString("data"); boolean isDone = false; throw new JsonParseException("The property " + keyDocContent.getValue() + " couldn't be found in the Json Stream.", null);
@Override public String getName() { return _name.getValue(); }
/** * Method called to check to see if this property has a name that would * conflict with a given name. * * @since 2.6 */ public boolean wouldConflictWithName(PropertyName name) { if (_wrapperName != null) { return _wrapperName.equals(name); } // Bit convoluted since our support for namespaces is spotty but: return name.hasSimpleName(_name.getValue()) && !name.hasNamespace(); }
public MinimalPrettyPrinter() { this(DEFAULT_ROOT_VALUE_SEPARATOR.toString()); }
_name = new SerializedString(name.getSimpleName()); _wrapperName = base._wrapperName;
public BeanPropertyWriter rename(NameTransformer transformer) { String newName = transformer.transform(_name.getValue()); if (newName.equals(_name.toString())) { return this; } return new BeanPropertyWriter(this, new SerializedString(newName)); }
@Override public PropertyName getFullName() { // !!! TODO: impl properly return new PropertyName(_name.getValue()); }
public BeanPropertyWriter rename(NameTransformer transformer) { String newName = transformer.transform(_name.getValue()); if (newName.equals(_name.toString())) { return this; } return new BeanPropertyWriter(this, new PropertyName(newName)); }
private static final SerializedString LF = new SerializedString("\n"); private static final DefaultPrettyPrinter.Indenter INDENTER = new DefaultIndenter(" ", LF.getValue()); private boolean prettyPrint = false;
/** * Method called to indicate that serialization of a field was omitted due * to filtering, in cases where backend data format does not allow basic * omission. * * @since 2.3 */ @Override public void serializeAsOmittedField(Object bean, JsonGenerator gen, SerializerProvider prov) throws Exception { if (!gen.canOmitFields()) { gen.writeOmittedField(_name.getValue()); } }
/** * Method called to check to see if this property has a name that would * conflict with a given name. * * @since 2.6 */ public boolean wouldConflictWithName(PropertyName name) { if (_wrapperName != null) { return _wrapperName.equals(name); } // Bit convoluted since our support for namespaces is spotty but: return name.hasSimpleName(_name.getValue()) && !name.hasNamespace(); }
public MinimalPrettyPrinter() { this(DEFAULT_ROOT_VALUE_SEPARATOR.toString()); }