Source code: edu/ou/kmi/buddyspace/xml/XDataFieldOptionBuilder.java
1 /*
2 * License
3 *
4 * The contents of this file are subject to the Jabber Open Source License
5 * Version 1.0 (the "License"). You may not copy or use this file, in either
6 * source code or executable form, except in compliance with the License. You
7 * may obtain a copy of the License at http://www.jabber.com/license/ or at
8 * http://www.opensource.org/.
9 *
10 * Software distributed under the License is distributed on an "AS IS" basis,
11 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
12 * for the specific language governing rights and limitations under the
13 * License.
14 *
15 * Copyrights
16 *
17 * Portions created by or assigned to Jabber.com, Inc. are
18 * Copyright (c) 2000 Jabber.com, Inc. All Rights Reserved. Contact
19 * information for Jabber.com, Inc. is available at http://www.jabber.com/.
20 *
21 * Portions Copyright (c) 1999-2000 David Waite
22 *
23 * Acknowledgements
24 *
25 * Special thanks to the Jabber Open Source Contributors for their
26 * suggestions and support of Jabber.
27 *
28 * Changes
29 *
30 * @author David Waite <a href="mailto:dwaite@jabber.com">
31 * <i><dwaite@jabber.com></i></a>
32 *
33 * @author $Author: brouk $
34 * @version $Revision: 1.2 $
35 *
36 * j.komzak
37 * Changed into XDataFieldOptionBuilder
38 */
39
40 package edu.ou.kmi.buddyspace.xml;
41
42 /*
43 * XDataFieldOptionBuilder.java
44 *
45 * Project: BuddySpace
46 * (C) Copyright Knowledge Media Institute 2003
47 *
48 *
49 * Created on 5 February 2003, 13:06
50 */
51
52 import java.util.Vector;
53 import org.jabber.jabberbeans.Extension.*;
54
55 /**
56 * <code>XDataFieldOptionBuilder</code> is used to construct XDataField objects
57 *
58 * @author Jiri Komzak, Knowledge Media Institute, Open University, United Kingdom
59 */
60 public class XDataFieldOptionBuilder
61 implements ExtensionBuilder
62 {
63 /** Attributes. */
64 private String value;
65 private String label;
66
67 /** Creates a new <code>XDataFieldOptionBuilder</code> instance. */
68 public XDataFieldOptionBuilder()
69 { reset(); }
70
71 /**
72 * <code>reset</code> the builder to a default state, so it can be reused.
73 */
74 public void reset() {
75 label = value = null;
76 }
77
78 public void setLabel(String newLabel) {
79 label = newLabel;
80 }
81
82 public String getLabel() {
83 return label;
84 }
85
86 public void setValue(String newValue) {
87 value = newValue;
88 }
89
90 public String getValue() {
91 return value;
92 }
93
94 /**
95 * <code>build</code> a new XDataFieldOption object
96 *
97 * @return an <code>Extension</code> value
98 * @exception InstantiationException if insufficient or incorrect data
99 * was proviced.
100 */
101 public Extension build()
102 throws InstantiationException
103 { return new XDataFieldOption(this); }
104 }