01: package org.kohsuke.rngom.digested;
02:
03: /**
04: * @author Kohsuke Kawaguchi (kk@kohsuke.org)
05: */
06: public class DDefine {
07: private final String name;
08:
09: private DPattern pattern;
10: private Boolean nullable;
11: DAnnotation annotation;
12:
13: public DDefine(String name) {
14: this .name = name;
15: }
16:
17: public DPattern getPattern() {
18: return pattern;
19: }
20:
21: public DAnnotation getAnnotation() {
22: if (annotation == null)
23: return DAnnotation.EMPTY;
24: return annotation;
25: }
26:
27: public void setPattern(DPattern pattern) {
28: this .pattern = pattern;
29: this .nullable = null;
30: }
31:
32: /**
33: * Gets the name of the pattern block.
34: */
35: public String getName() {
36: return name;
37: }
38:
39: public boolean isNullable() {
40: if (nullable == null)
41: nullable = pattern.isNullable() ? Boolean.TRUE
42: : Boolean.FALSE;
43: return nullable.booleanValue();
44: }
45: }
|