1 /***
2 * Copyright 2003-2010 Terracotta, Inc.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17 package net.sf.ehcache.config.generator.model;
18
19 /***
20 * Interface that abstracts the idea of an attribute. An attribute has a name, a value, boolean indicating if its an optional attribute and
21 * a default value
22 *
23 * @author Abhishek Sanoujam
24 *
25 */
26 public interface NodeAttribute {
27
28 /***
29 * Name of the attribute
30 *
31 * @return Name of the attribute
32 */
33 String getName();
34
35 /***
36 * Value of the attribute
37 *
38 * @return value of the attribute
39 */
40 String getValue();
41
42 /***
43 * Returns true if the attribute is optional, otherwise false
44 *
45 * @return Returns true if the attribute is optional, otherwise false
46 */
47 boolean isOptional();
48
49 /***
50 * Returns the default value of the attribute
51 *
52 * @return default value of the attribute
53 */
54 String getDefaultValue();
55
56 /***
57 * Sets this attribute to optional or not
58 *
59 * @param optional
60 * true if this attribute is optional
61 */
62 public void setOptional(boolean optional);
63
64 /***
65 * Default value setter
66 *
67 * @param defaultValue
68 * the default value
69 */
70 public void setDefaultValue(String defaultValue);
71
72 /***
73 * Setter for value
74 *
75 * @param value
76 * the new value
77 */
78 public void setValue(String value);
79
80 /***
81 * Builder convenience method for setting optional
82 *
83 * @param optional
84 * true if optional
85 * @return the same attribute instance
86 */
87 NodeAttribute optional(boolean optional);
88
89 /***
90 * Builder convenience method for setting defaultValue
91 *
92 * @param defaultValue
93 * the default value
94 * @return the same attribute instance
95 */
96 NodeAttribute defaultValue(String defaultValue);
97
98 }