Class ProxyHelper

java.lang.Object
org.zkoss.bind.proxy.ProxyHelper

public class ProxyHelper extends Object
A proxy helper class to create a proxy cache mechanism for Set, List, Collection, Map, and POJO.
Since:
8.0.0
Author:
jumperchen
  • Constructor Details

    • ProxyHelper

      public ProxyHelper()
  • Method Details

    • createProxyIfAny

      public static <T> T createProxyIfAny(T origin)
      Creates a proxy object from the given origin object, if any.
    • createProxyIfAny

      public static <T> T createProxyIfAny(T origin, Annotation[] annotations)
      Creates a proxy object from the given origin object, if any.
      Parameters:
      annotations - the annotations of the caller method to indicate whether the elements of the collection or Map type can proxy deeply, if any. (Optional) Like ImmutableElements
    • addIgnoredProxyClass

      public static void addIgnoredProxyClass(Class<?> type)
      Adds an ignored proxy class type. Once the data binder try to create a proxy object for the form binding, it will check whether the origin class type should be ignored.

      Default it will apply these classes from the library property org.zkoss.bind.proxy.IgnoredProxyClasses

    • addIgnoredSuperProxyClass

      public static void addIgnoredSuperProxyClass(Class<?> type)
      Adds an ignored super proxy class type. Once the data binder try to create a proxy object for the form binding, it will check the super classes of the origin class type. If one of the super classes is in the ignored super classes, the origin class type should be ignored.

      Default it will apply these classes from the library property org.zkoss.bind.proxy.IgnoredSuperProxyClasses

      Since:
      8.6.1
    • isImmutable

      public static boolean isImmutable(Object origin)
      Returns whether the given origin object is immutable.
    • getOriginObject

      public static <T> T getOriginObject(T origin)
      Internal use only.
    • createFormProxy

      public static <T> T createFormProxy(T origin, Class<?> type)
      Creates a proxy form object from the given origin object, if any.
      Parameters:
      origin - the origin data object
      type - the class type of the data object
      Throws:
      org.zkoss.zk.ui.UiException - if the class type is a sealed class or interface, since a proxy cannot extend or implement it
    • createFormProxy

      public static <T> T createFormProxy(T origin, Class<?> type, Class[] interfaces)
      Creates a proxy form object from the given origin object, if any.
      Parameters:
      origin - the origin data object
      type - the class type of the data object
      interfaces - the interface type of the data object, if any.
      Throws:
      org.zkoss.zk.ui.UiException - if the class type is a sealed class or interface, since a proxy cannot extend or implement it
      Since:
      8.0.1
    • toSetter

      public static String toSetter(String attr)
      Internal use only.
    • toGetter

      public static String toGetter(String attr)
      Internal use only.
    • capitalize

      public static String capitalize(String prefix, String attr)
      Internal use only.
    • isAttribute

      public static boolean isAttribute(Method method)
      Internal use only.
    • toAttrName

      public static String toAttrName(Method method, int prefix)
      Internal use only.
    • toAttrName

      public static String toAttrName(Method method)
      Internal use only.