Class FieldWriterObject<T>

    • Field Detail

      • writeUsing

        protected boolean writeUsing
    • Constructor Detail

      • FieldWriterObject

        protected FieldWriterObject​(String name,
                                    int ordinal,
                                    long features,
                                    String format,
                                    String label,
                                    Type fieldType,
                                    Class fieldClass,
                                    Field field,
                                    Method method)
    • Method Detail

      • isTypeMatch

        public boolean isTypeMatch​(Class valueClass)
        Whether a value of valueClass is compatible with the writer cached for initValueClass. Mirrors the typeMatch check performed on the write path so that ObjectWriterAdapter.toJSONObject(Object) keeps toJSON consistent with toJSONString. Notably this requires an exact class match (plus the writeUsing / Map / List / primitive-boxing exceptions), so a subclass value does NOT match and must be re-resolved by its actual class to avoid silently dropping the subclass fields. Returns false when initValueClass is null (no value has been observed for this field yet, so nothing is cached to match against).
      • writeWithUnwrapped

        protected final boolean writeWithUnwrapped​(JSONWriter jsonWriter,
                                                   Object value,
                                                   long features,
                                                   boolean refDetect,
                                                   ObjectWriter valueWriter)