Package jodd.json

Class BeanSerializer


  • public class BeanSerializer
    extends TypeJsonVisitor
    Bean visitor that serializes properties of a bean. It analyzes the rules for inclusion/exclusion of a property.
    • Constructor Summary

      Constructors 
      Constructor Description
      BeanSerializer​(JsonContext jsonContext, java.lang.Object bean)  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected void onSerializableProperty​(java.lang.String propertyName, java.lang.Class propertyType, java.lang.Object value)
      Invoked on serializable properties, that have passed all the rules.
      protected void onSerializableProperty​(java.lang.String propertyName, jodd.introspector.PropertyDescriptor propertyDescriptor)
      Reads property value and serializes it.
      private java.lang.Object readProperty​(java.lang.Object source, jodd.introspector.PropertyDescriptor propertyDescriptor)
      Reads property using property descriptor.
      void serialize()
      Serializes a bean.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • source

        protected final java.lang.Object source
    • Constructor Detail

      • BeanSerializer

        public BeanSerializer​(JsonContext jsonContext,
                              java.lang.Object bean)
    • Method Detail

      • serialize

        public void serialize()
        Serializes a bean.
      • onSerializableProperty

        protected final void onSerializableProperty​(java.lang.String propertyName,
                                                    jodd.introspector.PropertyDescriptor propertyDescriptor)
        Reads property value and serializes it.
        Specified by:
        onSerializableProperty in class TypeJsonVisitor
      • onSerializableProperty

        protected void onSerializableProperty​(java.lang.String propertyName,
                                              java.lang.Class propertyType,
                                              java.lang.Object value)
        Invoked on serializable properties, that have passed all the rules. Property type is null for metadata class name property.
      • readProperty

        private java.lang.Object readProperty​(java.lang.Object source,
                                              jodd.introspector.PropertyDescriptor propertyDescriptor)
        Reads property using property descriptor.