Class DynamicViewApiIntrospector

java.lang.Object
io.jmix.dynmodelflowui.impl.behavior.DynamicViewApiIntrospector
All Implemented Interfaces:
org.springframework.beans.factory.InitializingBean

@Component("dynmod_DynamicViewApiIntrospector") public class DynamicViewApiIntrospector extends Object implements org.springframework.beans.factory.InitializingBean
Describes the sandbox API available to dynamic view behavior handler expressions, so the Admin UI handler editor can offer it as code completion.

The description is derived by reflection from DynamicViewHandlerContext rather than written by hand, so a facade method added later appears in the editor without a change here. The rules match what the sandbox accepts at runtime: only public non-static methods of DynamicViewApi-annotated classes, never a method declared by Object (see FacadeMethodResolver).

A public no-argument getXxx() is reported as the property xxx; every other method is reported as a method. isNew() is therefore a method, matching the documented call form, and does not turn into a new property.

  • Field Details

  • Constructor Details

    • DynamicViewApiIntrospector

      public DynamicViewApiIntrospector()
  • Method Details

    • afterPropertiesSet

      public void afterPropertiesSet()
      Specified by:
      afterPropertiesSet in interface org.springframework.beans.factory.InitializingBean
    • getRootMembers

      public List<DynamicViewApiIntrospector.ApiMember> getRootMembers()
      Returns the members available at the start of an expression: the entity, isNew(), and the facades.
    • getMembers

      public List<DynamicViewApiIntrospector.ApiMember> getMembers(String receiverPath)
      Returns the members of the facade the given path resolves to.
      Parameters:
      receiverPath - a dotted path from the expression root, for example components or event
      Returns:
      the members of the resolved facade, or an empty list when the path leaves the facades — an unknown name, or a value the sandbox exposes as a plain object such as entity
    • resolveType

      protected @Nullable Class<?> resolveType(String receiverPath)
    • describe

      protected void describe(Class<?> type)
      Describes the given facade type and, recursively, every facade it exposes. The type is registered before its members are collected, so a facade cycle cannot cause endless recursion.
    • isApiMethod

      protected boolean isApiMethod(Method method)
    • propertyName

      protected @Nullable String propertyName(Method method)
      Returns the property name of a no-argument getXxx() getter, or null when the method is not such a getter. isXxx() is deliberately not treated as a getter: the sandbox documents isNew() as a call.
    • methodDisplayText

      protected String methodDisplayText(Method method)
      Builds setVisible(componentId, visible). Parameter names come from reflection — all Jmix modules are compiled with -parameters — and a class compiled without them falls back to parameter types.
    • typeName

      protected @Nullable String typeName(Class<?> type)