Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

Source code: com/aendvari/cerberus/component/descriptor/ComponentAttribute.java


1   /*
2    * ComponentAttribute.java
3    *
4    * Copyright (c) 2001, 2002 Aendvari, Ltd. All Rights Reserved.
5    *
6    * See the file LICENSE for terms of use.
7    *
8    */
9   
10  package com.aendvari.cerberus.component.descriptor;
11  
12  import java.util.ArrayList;
13  import java.util.Collection;
14  
15  /**
16   * <p>Describes a component attribute.</p>
17   *
18   * <p>Attributes allow portions of {@link ComponentDefinition ComponentDefinitions}
19   * to be specified during component instantiation.</p>
20   *
21   * <p>The attribute value is built from a series of literals and other attributes.</p>
22   *
23   * @author  Trevor Milne
24   *
25   */
26  
27  public class ComponentAttribute extends ComponentProperty
28  {
29    /** Specifies whether the attribute is required. */
30    protected boolean required;
31  
32    /** The attribute value. */
33    protected MultiPartValue value;
34  
35  
36    /* Constructors. */
37  
38  
39    /**
40     * Constructs a <code>ComponentAttribute</code> instance.
41     *
42     */
43  
44    public ComponentAttribute()
45    {
46      super();
47  
48      required = false;
49      value = new MultiPartValue();
50    }
51  
52    /**
53     * Constructs a <code>ComponentAttribute</code> instance as a copy of the one supplied.
54     *
55     * @param    attribute          The <code>ComponentAttribute</code> to copy.
56     *
57     */
58  
59    public ComponentAttribute(ComponentAttribute attribute)
60    {
61      super(attribute);
62  
63      required = attribute.getRequired();
64      value = new MultiPartValue(attribute.getValue());
65    }
66  
67  
68    /* Accessors. */
69  
70  
71    /* Required. */
72  
73    /**
74     * Sets the required state of this attribute.
75     *
76     * @param    setRequired          The attribute's required state.
77     *
78     */
79  
80    public void setRequired(boolean setRequired)
81    {
82      required = setRequired;
83    }
84  
85    /**
86     * Returns the required state of this attribute.
87     *
88     * @return                  True if required, false otherwise.
89     *
90     */
91  
92    public boolean getRequired()
93    {
94      return required;
95    }
96  
97    /* Value. */
98  
99    /**
100    * Returns the value of this attribute. The {@link MultiPartValue}
101    * returned may be manipulated to modify the value of this attribute.
102    *
103    * @return                  The value of this attribute.
104    *
105    */
106 
107   public MultiPartValue getValue()
108   {
109     return value;
110   }
111 }
112