source: other-projects/trunk/gs3-release-maker/apache-ant-1.6.5/src/main/org/apache/tools/ant/taskdefs/optional/extension/ExtraAttribute.java@ 14627

Last change on this file since 14627 was 14627, checked in by oranfry, 17 years ago

initial import of the gs3-release-maker

File size: 2.2 KB
Line 
1/*
2 * Copyright 2002,2004-2005 The Apache Software Foundation
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 */
17package org.apache.tools.ant.taskdefs.optional.extension;
18
19import org.apache.tools.ant.BuildException;
20
21/**
22 * Simple holder for extra attributes in main section of manifest.
23 *
24 * @todo Refactor this and all the other parameter, sysproperty,
25 * property etc into a single class in framework
26 */
27public class ExtraAttribute {
28 private String name;
29 private String value;
30
31 /**
32 * Set the name of the parameter.
33 *
34 * @param name the name of parameter
35 */
36 public void setName(final String name) {
37 this.name = name;
38 }
39
40 /**
41 * Set the value of the parameter.
42 *
43 * @param value the parameter value
44 */
45 public void setValue(final String value) {
46 this.value = value;
47 }
48
49 /**
50 * Retrieve name of parameter.
51 *
52 * @return the name of parameter.
53 */
54 String getName() {
55 return name;
56 }
57
58 /**
59 * Retrieve the value of parameter.
60 *
61 * @return the value of parameter.
62 */
63 String getValue() {
64 return value;
65 }
66
67 /**
68 * Make sure that neither the name or the value
69 * is null.
70 *
71 * @throws BuildException if the attribute is invalid.
72 */
73 public void validate() throws BuildException {
74 if (null == name) {
75 final String message = "Missing name from parameter.";
76 throw new BuildException(message);
77 } else if (null == value) {
78 final String message = "Missing value from parameter " + name + ".";
79 throw new BuildException(message);
80 }
81 }
82}
Note: See TracBrowser for help on using the repository browser.