1 // -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
2 // ---------------------------------------------------------------------------
4 // Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
5 // ---------------------------------------------------------------------------
6 // SquirrelJME is under the GNU General Public License v3+, or later.
7 // See license.mkd for licensing and copyright information.
8 // ---------------------------------------------------------------------------
10 package cc
.squirreljme
.plugin
.multivm
;
12 import org
.gradle
.api
.Project
;
13 import org
.gradle
.api
.Task
;
16 * This holds the name of a project and task and is used for storing them
17 * for resolution as needed.
19 * This class is immutable.
23 public final class ProjectAndTaskName
25 /** The project name. */
26 protected final String project
;
29 protected final String task
;
32 * Initializes the holder.
34 * @param __project The project name.
35 * @param __task The task name.
36 * @throws NullPointerException On null arguments.
39 public ProjectAndTaskName(String __project
, String __task
)
40 throws NullPointerException
42 if (__project
== null || __task
== null)
43 throw new NullPointerException("NARG");
45 this.project
= __project
;
56 return this.project
.hashCode() ^
65 public boolean equals(Object __o
)
70 if (!(__o
instanceof ProjectAndTaskName
))
73 ProjectAndTaskName o
= (ProjectAndTaskName
)__o
;
74 return this.project
.equals(o
.project
) &&
75 this.task
.equals(o
.task
);
83 public String
toString()
85 return this.project
+ ":" + this.task
;
89 * Maps the project and task name.
91 * @param __project The project to get from.
92 * @param __task The task to use.
93 * @return The project and task name.
94 * @throws NullPointerException On null arguments.
97 public static ProjectAndTaskName
of(Project __project
, String __task
)
98 throws NullPointerException
100 if (__project
== null || __task
== null)
101 throw new NullPointerException("NARG");
103 return new ProjectAndTaskName(__project
.getPath(), __task
);
109 * @param __task The task to use.
110 * @return The project and task name.
111 * @throws NullPointerException On null arguments.
114 public static ProjectAndTaskName
of(Task __task
)
115 throws NullPointerException
118 throw new NullPointerException("NARG");
120 return ProjectAndTaskName
.of(__task
.getProject(), __task
.getName());