KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > ant > core > TargetInfo


1 /*******************************************************************************
2  * Copyright (c) 2000, 2005 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Eclipse Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/epl-v10.html
7  *
8  * Contributors:
9  * IBM Corporation - initial API and implementation
10  *******************************************************************************/

11 package org.eclipse.ant.core;
12
13
14 /**
15  * Represents information about a target within an Ant build file.
16  * Clients may not instantiate or subclass this class.
17  * @since 2.1
18  */

19 public class TargetInfo {
20
21     private String JavaDoc name = null;
22     private String JavaDoc description = null;
23     private ProjectInfo project = null;
24     private String JavaDoc[] dependencies = null;
25     private boolean isDefault = false;
26
27     /**
28      * Create a target information
29      *
30      * @param name target name
31      * @param description a brief explanation of the target's purpose
32      * or <code>null</code> if not specified
33      * @param project enclosing project
34      * @param dependencies names of prerequisite projects
35      * @param isDefault whether this is the build file default target
36      */

37     /*package*/
38     TargetInfo(ProjectInfo project, String JavaDoc name, String JavaDoc description, String JavaDoc[] dependencies, boolean isDefault) {
39         this.name = name == null ? "" : name; //$NON-NLS-1$
40
this.description = description;
41         this.project = project;
42         this.dependencies = dependencies;
43         this.isDefault = isDefault;
44     }
45
46     /**
47      * Returns the target name.
48      *
49      * @return the target name
50      */

51     public String JavaDoc getName() {
52         return name;
53     }
54
55     /**
56      * Returns the target description or <code>null</code> if no
57      * description is provided.
58      *
59      * @return the target description or <code>null</code> if none
60      */

61     public String JavaDoc getDescription() {
62         return description;
63     }
64     
65     /**
66      * Returns the ProjectInfo of the enclosing project.
67      *
68      * @return the project info for the enclosing project
69      */

70     public ProjectInfo getProject() {
71         return project;
72     }
73     
74     /**
75      * Return the names of the targets that this target depends on.
76      *
77      * @return the dependent names
78      */

79     public String JavaDoc[] getDependencies() {
80         return dependencies;
81     }
82
83     /**
84      * Returns whether this is the build file default target.
85      *
86      * @return whether this is the build file default target
87      */

88     public boolean isDefault() {
89         return isDefault;
90     }
91
92     /* (non-Javadoc)
93      * @see java.lang.Object#equals(java.lang.Object)
94      */

95     public boolean equals(Object JavaDoc obj) {
96         if (!(obj instanceof TargetInfo)) {
97             return false;
98         }
99         TargetInfo other= (TargetInfo)obj;
100         return getName().equals(other.getName());
101     }
102
103     /* (non-Javadoc)
104      * @see java.lang.Object#hashCode()
105      */

106     public int hashCode() {
107         return getName().hashCode();
108     }
109
110     /* (non-Javadoc)
111      * @see java.lang.Object#toString()
112      */

113     public String JavaDoc toString() {
114         return getName();
115     }
116 }
117
Popular Tags