Package org.zkoss.bind.proxy
Class ProxyHelper
java.lang.Object
org.zkoss.bind.proxy.ProxyHelper
A proxy helper class to create a proxy cache mechanism for Set, List, Collection,
Map, and POJO.
- Since:
- 8.0.0
- Author:
- jumperchen
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceAn interface to decorate theProxyObjectfor some purposes, like providing custom validation logic or adding extra handler on it. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidaddIgnoredProxyClass(Class<?> type) Adds an ignored proxy class type.static voidaddIgnoredSuperProxyClass(Class<?> type) Adds an ignored super proxy class type.static Stringcapitalize(String prefix, String attr) Internal use only.static <T> TcreateFormProxy(T origin, Class<?> type) Creates a proxy form object from the given origin object, if any.static <T> TcreateFormProxy(T origin, Class<?> type, Class[] interfaces) Creates a proxy form object from the given origin object, if any.static <T> TcreateProxyIfAny(T origin) Creates a proxy object from the given origin object, if any.static <T> TcreateProxyIfAny(T origin, Annotation[] annotations) Creates a proxy object from the given origin object, if any.static <T> TgetOriginObject(T origin) Internal use only.static booleanisAttribute(Method method) Internal use only.static booleanisImmutable(Object origin) Returns whether the given origin object is immutable.static StringtoAttrName(Method method) Internal use only.static StringtoAttrName(Method method, int prefix) Internal use only.static StringInternal use only.static StringInternal use only.
-
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
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) LikeImmutableElements
-
addIgnoredProxyClass
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
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
Returns whether the given origin object is immutable. -
getOriginObject
public static <T> T getOriginObject(T origin) Internal use only. -
createFormProxy
Creates a proxy form object from the given origin object, if any.- Parameters:
origin- the origin data objecttype- 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
Creates a proxy form object from the given origin object, if any.- Parameters:
origin- the origin data objecttype- the class type of the data objectinterfaces- 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
Internal use only. -
toGetter
Internal use only. -
capitalize
Internal use only. -
isAttribute
Internal use only. -
toAttrName
Internal use only. -
toAttrName
Internal use only.
-