Fixed grammar in messages.
[mirror_edk2.git] / Tools / Source / GenBuild / org / tianocore / build / global / VariableTask.java
CommitLineData
878ddf1f 1/** @file\r
2 * This file is ANT task VariableTask. \r
3 *\r
4 * VariableTask task implements part of ANT property task. The difference is\r
5 * this task will override variable with same name, but ANT property task do not.\r
6 *\r
7 * Copyright (c) 2006, Intel Corporation\r
8 * All rights reserved. This program and the accompanying materials\r
9 * are licensed and made available under the terms and conditions of the BSD License\r
10 * which accompanies this distribution. The full text of the license may be found at\r
11 * http://opensource.org/licenses/bsd-license.php\r
12 *\r
13 * THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
14 * WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
15 */\r
16package org.tianocore.build.global;\r
17\r
18import org.apache.tools.ant.BuildException;\r
19import org.apache.tools.ant.Task;\r
20\r
21/**\r
22 * VariableTask task implements part of ANT property task. The difference is\r
23 * this task will override variable with same name, but ANT property task do not.\r
24 * \r
25 * @since GenBuild 1.0\r
26 */\r
27public class VariableTask extends Task {\r
28\r
29 /**\r
30 * property value\r
31 */\r
32 private String value;\r
33 \r
34 /**\r
35 * property name\r
36 */\r
37 private String name;\r
38\r
39 /**\r
40 * Set property name.\r
41 *\r
42 * @param name property name\r
43 */\r
44 public void setName( String name ) {\r
45 this.name = name;\r
46 }\r
47\r
48\r
49 /**\r
50 * Set property value.\r
51 *\r
52 * @param value property value\r
53 */\r
54 public void setValue( String value ) {\r
55 this.value = value;\r
56 }\r
57\r
58 /**\r
59 * ANT task's entry point, will be called after init(). \r
60 *\r
61 * @exception BuildException\r
62 * If name or value is null\r
63 */\r
64 public void execute() throws BuildException {\r
65 if (name == null || value == null) {\r
391dbbb1 66 throw new BuildException("Name or value cannot be null.");\r
878ddf1f 67 }\r
68 getProject().setProperty(name, value);\r
69 }\r
70}\r
71\r