|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.zkoss.zk.ui.metainfo.impl.AnnotationHelper
public class AnnotationHelper
A helper class used to parse annotations.
How to use:
add(java.lang.String, java.util.Map, org.zkoss.util.resource.Location)
or addByCompoundValue(java.lang.String, org.zkoss.util.resource.Location) to add annotations to this helper.applyAnnotations(org.zkoss.zk.ui.metainfo.ComponentInfo, java.lang.String, boolean)
to update the annotations to the specified component info.
| Constructor Summary | |
|---|---|
AnnotationHelper()
|
|
| Method Summary | |
|---|---|
void |
add(java.lang.String annotName,
java.util.Map<java.lang.String,java.lang.String[]> annotAttrs)
Deprecated. As of release 6.0.1, replaced with add(String, Map, Location). |
void |
add(java.lang.String annotName,
java.util.Map<java.lang.String,java.lang.String[]> annotAttrs,
Location loc)
Adds an annotation definition. |
void |
addByCompoundValue(java.lang.String cval,
Location loc)
Adds annotation by specifying the content in the compound format. |
void |
applyAnnotations(AnnotationMap annots,
java.lang.String propName,
boolean clear)
Applies the annotations defined in this helper to the specified annotation map. |
void |
applyAnnotations(ComponentInfo compInfo,
java.lang.String propName,
boolean clear)
Applies the annotations defined in this helper to the specified instance definition. |
void |
applyAnnotations(ComponentInfo compInfo,
java.lang.String propName,
boolean clear,
Location loc)
Deprecated. As of release 6.0.1, replaced with applyAnnotations(ComponentInfo,String,boolean). |
void |
applyAnnotations(Component comp,
java.lang.String propName,
boolean clear)
Applies the annotations defined in this helper to the specified component. |
boolean |
clear()
Clears the annotations defined in this helper. |
static boolean |
isAnnotation(java.lang.String val)
Test if the given value is an annotation. |
static java.lang.String[] |
parseAttributeValue(java.lang.String val,
Location loc)
Parses the attribute value. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public AnnotationHelper()
| Method Detail |
|---|
public static boolean isAnnotation(java.lang.String val)
addByCompoundValue(java.lang.String, org.zkoss.util.resource.Location).
val - the value.
public void add(java.lang.String annotName,
java.util.Map<java.lang.String,java.lang.String[]> annotAttrs,
Location loc)
annotName - the annotation name.annotAttrs - a map of attributes of the annotation. If null,
it means no attribute at all.loc - the location information of the annotation in
the document, or null if not available.addByCompoundValue(java.lang.String, org.zkoss.util.resource.Location)
public void add(java.lang.String annotName,
java.util.Map<java.lang.String,java.lang.String[]> annotAttrs)
add(String, Map, Location).
public void addByCompoundValue(java.lang.String cval,
Location loc)
There are two formats:
Format 1 (recommended, since 6.0):
@annot-name(att1-name=att1-value, att2-name=att2-value) @annot-name() @default(annot3-attrs)
Format 2 (deprecated, 5.0 and before):
@{annot-name(att1-name=att1-value, att2-name=att2-value) annot2-name (annot3-attrs)}
In the first format, it must be a list of annotations separated by space.
And, each annotation is in the format of @annot-name(key=value, value, key=value).
That is, it starts with the annotation's name and a parenthesis to enclose
any number of key and value pairs (key is optional).
The annotation's names must be composed of letters, numbers, the underscore _, the dash - and the dollar sign $.
The names may only begin with a letter, the underscore or a dollar sign.
In additions, all characters are preserved, including the single and double quotes.
cval - the compound value to check. This method assumes that
cval starts with @ and the length is larger than 2loc - the location information of the value for displaying better
error message. Ignored if null.
public static java.lang.String[] parseAttributeValue(java.lang.String val,
Location loc)
val - the value. This method assumes val has been trimmed before the
call.loc - the location information of the value for displaying better
error message. Ignored if null.
NullPointException - if val is null.
public void applyAnnotations(ComponentInfo compInfo,
java.lang.String propName,
boolean clear)
compInfo - the instance definition to updatepropName - the property nameclear - whether to clear all definitions before returningclear()
public void applyAnnotations(ComponentInfo compInfo,
java.lang.String propName,
boolean clear,
Location loc)
applyAnnotations(ComponentInfo,String,boolean).
public void applyAnnotations(Component comp,
java.lang.String propName,
boolean clear)
comp - the component to updatepropName - the property nameclear - whether to clear all definitions before returningclear()
public void applyAnnotations(AnnotationMap annots,
java.lang.String propName,
boolean clear)
annots - the annotation map where the annotaions are added.propName - the property nameclear - whether to clear all definitions before returningclear()public boolean clear()
The annotations are defined by add(java.lang.String, java.util.Map
or addByCompoundValue(java.lang.String, org.zkoss.util.resource.Location).
add(java.lang.String, java.util.Map, org.zkoss.util.resource.Location) ).
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||