Package org.zkoss.zk.ui.metainfo
Class Property
java.lang.Object
org.zkoss.zk.ui.metainfo.Property
- All Implemented Interfaces:
Serializable,Condition
Information about how to initialize a property (a.k.a., a field of a component).
There are two kind of properties: one is a String instance (either
a string value or an expression), and the other is
a
NativeInfo instance. The later is also called the native content.- Author:
- tomyeh
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionProperty(EvaluatorRef evalr, String name, String value, ConditionImpl cond) Constructs a property with a class that is known in advance.Property(EvaluatorRef evalr, String name, NativeInfo value, ConditionImpl cond) Constructs a property with the native content. -
Method Summary
Modifier and TypeMethodDescriptionvoidAssigns the value of this member to the specified component.static final voidAssigns a property.Returns the effectiveness condition.Returns the evaluator reference.getName()Returns the name of the property.Returns the raw value of the property.Evaluates the value to an Object.Evaluates the value to an Object.booleanisEffective(Component comp) Used to evaluate whether it is effective.booleanisEffective(Page page) Used to evaluate whether it is effective.booleanReturns whether the property is held byNativeInfo.static final MethodresolveMethod(Class cls, String name) Resolves the method for the specified property, or null ifDynamicPropertied.setDynamicProperty(java.lang.String, java.lang.Object)shall be used instead.voidsetCondition(ConditionImpl cond) Sets the effectiveness condition.voidsetRawValue(String value) Sets the raw value of the property.toString()booleanTests if the condition is set
-
Constructor Details
-
Property
Constructs a property with a class that is known in advance.- Throws:
IllegalArgumentException- if name is null
-
Property
Constructs a property with the native content. The native content is represented byNativeInfo, i.e., a XML fragment (a.k.a., a tree ofComponentInfo.- Since:
- 3.5.0
-
-
Method Details
-
getName
Returns the name of the property. -
getRawValue
Returns the raw value of the property. Note: it is the original value without evaluation. In other words, it may contain EL expressions.- Throws:
UnsupportedOperationException- if value is the native content, i.e., it is constructed by use ofProperty(EvaluatorRef, String, NativeInfo, ConditionImpl).- Since:
- 3.0.0
-
isNativeInfo
public boolean isNativeInfo()Returns whether the property is held byNativeInfo.- Returns:
- Since:
- 10.0.0
-
setRawValue
Sets the raw value of the property.- Throws:
UnsupportedOperationException- if value is the native content, i.e., it is constructed by use ofProperty(EvaluatorRef, String, NativeInfo, ConditionImpl).- Since:
- 3.0.0
-
getValue
Evaluates the value to an Object. Note: it does NOT callCondition.isEffective(org.zkoss.zk.ui.Component)and it doesn't coerce the result (i.e., Object.class is assumed). -
getValue
Evaluates the value to an Object. Note: it does NOT callCondition.isEffective(org.zkoss.zk.ui.Component)and it doesn't coerce the result (i.e., Object.class is assumed).- Throws:
UnsupportedOperationException- if value is the native content, i.e., it is constructed by use ofProperty(EvaluatorRef, String, NativeInfo, ConditionImpl).
-
assign
Assigns the value of this member to the specified component.Note: this method does nothing if
Condition.isEffective(org.zkoss.zk.ui.Component)returns false. -
assign
Assigns a property.Don't use the reflection directly since this method searches more signatures.
- Throws:
PropertyNotFoundException- if the property is not found, i.e., no corresponding method andDynamicPropertiednot implemented.UiException- if fail to assign- Since:
- 3.5.0
-
toString
-
resolveMethod
Resolves the method for the specified property, or null ifDynamicPropertied.setDynamicProperty(java.lang.String, java.lang.Object)shall be used instead.Use this method to retrieve the method when you want to assign a value to a component's property.
Don't use the reflection directly since this method searches more signatures.
- Parameters:
name- the property name, such as "title".- Throws:
PropertyNotFoundException- if the property is not found, i.e., no corresponding method andDynamicPropertiednot implemented.- Since:
- 3.5.0
-
getEvaluatorRef
Returns the evaluator reference. -
getCondition
Returns the effectiveness condition. -
setCondition
Sets the effectiveness condition. -
withCondition
public boolean withCondition()Tests if the condition is set -
isEffective
Description copied from interface:ConditionUsed to evaluate whether it is effective.- Specified by:
isEffectivein interfaceCondition- Parameters:
comp- used as the self variable. Ignored if null.
-
isEffective
Description copied from interface:ConditionUsed to evaluate whether it is effective.- Specified by:
isEffectivein interfaceCondition- Parameters:
page- used as the self variable. Ignored if null.
-