Uploaded image for project: 'Hippo CMS'
  1. Hippo CMS
  2. CMS-13007

Support creating getters of properties which are not a known type for dynamic beans




      In dynamic beans, if the type of a field in a document type doesn't belong to the list below, than no getter method gets created for the field.

      String, Html, Password, Text, Date, Boolean, Long, Double, Docbase

      Dynamic beans doesn't know about the custom fields of downstream projects, hence custom fields are not supported for plugins and addons.

      To support generation of unknown fields, byte buddy interceptor feature could be used to delegate getter method body creation to plugins and addons.

      Byte buddy can delegate a method body to an explicit class method. If a downstream project has a content bean class under packages org.onehippo.* or com.onehippo.*, this class gets instantiated by DynamicObjectConverterImpl and added to the annotatedClassesMap. Then, this class can be used to store a custom code logic and byte buddy can delegate method creation to this class.

      To be able to do that, this class should have a constructor like;

      public MyContentBean(String propertyType, Node documentTypeNode)

      and should contain a method which returns itself (name of the method isn't important);

      public MyContentBean setContentBean(@Super(proxyType = TargetType.class) Object superObject)

      Then, dynamic beans will add this class as a getter method to the generated dynamic bean, and method body will be delegated to MyContentBean.

      public MyContentBean getMyContentBean() {
        return myContentBeanInstance.setContentBean(hippoBeanInstance);



        Issue Links



              Unassigned Unassigned
              ekarakus Erdem Karakus
              0 Vote for this issue
              3 Start watching this issue