01: /**********************************************************************
02: Copyright (c) 2004 Andy Jefferson and others. All rights reserved.
03: Licensed under the Apache License, Version 2.0 (the "License");
04: you may not use this file except in compliance with the License.
05: You may obtain a copy of the License at
06:
07: http://www.apache.org/licenses/LICENSE-2.0
08:
09: Unless required by applicable law or agreed to in writing, software
10: distributed under the License is distributed on an "AS IS" BASIS,
11: WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12: See the License for the specific language governing permissions and
13: limitations under the License.
14:
15: Contributors:
16: Kikucho Kousuke - org.jpox.enhancer.conf.JDOConfigExtension
17: ...
18: **********************************************************************/package org.jpox.metadata;
19:
20: import java.io.Serializable;
21:
22: import org.jpox.util.StringUtils;
23:
24: /**
25: * Representation of the Meta-Data for an extension.
26: * Takes the form of key and value. The vendor will be "jpox".
27: * <P>Represents the following MetaData element
28: * <PRE>
29: * <!ELEMENT extension (extension)*>
30: * <!ATTLIST extension vendor-name CDATA #REQUIRED>
31: * <!ATTLIST extension key CDATA #IMPLIED>
32: * <!ATTLIST extension value CDATA #IMPLIED>
33: * </PRE>
34: * @since 1.1
35: * @version $Revision: 1.4 $
36: */
37: public class ExtensionMetaData implements Serializable {
38: /** vendor-name tag value. */
39: protected String vendorName;
40:
41: /** key tag value. */
42: protected String key;
43:
44: /** value tag value. */
45: protected String value;
46:
47: /**
48: * Constructor
49: * @param vendorName vendor-name tag value
50: * @param key key tag value
51: * @param value value tag value
52: */
53: public ExtensionMetaData(String vendorName, String key, String value) {
54: this .vendorName = (StringUtils.isWhitespace(vendorName) ? null
55: : vendorName);
56: this .key = (StringUtils.isWhitespace(key) ? null : key);
57: this .value = (StringUtils.isWhitespace(value) ? null : value);
58: }
59:
60: /**
61: * Accessor for the key tag value.
62: * @return key tag value
63: */
64: public String getKey() {
65: return key;
66: }
67:
68: /**
69: * Accessor for the value tag value .
70: * @return value tag value
71: */
72: public String getValue() {
73: return value;
74: }
75:
76: /**
77: * Accessor for the vendor-name tag value.
78: * @return vendor-name tag value
79: */
80: public String getVendorName() {
81: return vendorName;
82: }
83:
84: /**
85: * Returns a string representation of the object.
86: * @return a string representation of the object.
87: */
88: public String toString() {
89: return "<extension vendor-name=\"" + vendorName + "\" key=\""
90: + key + "\" value=\"" + value + "\"/>";
91: }
92: }
|