Package com.spertus.jacquard.common
Class Target
java.lang.Object
com.spertus.jacquard.common.Target
The target of a
Grader
, which must be a file.-
Method Summary
Modifier and TypeMethodDescriptionboolean
static Target
Creates a target from a class that the student is responsible for submitting.fromDirectory
(String dir) Creates targets from all the files in the specified directory.static Target
Creates a target from a path, which must be to a single file.static Target
Creates a target from a relative path string to a file.fromPathStrings
(String dir, String... files) Creates targets from a directory string and list of files in the directory.int
hashCode()
Gets this target's directory.toFile()
Gets this target's file (which may be a directory).toPath()
Gets this target's pathGets the string representation of this target's absolute path.
-
Method Details
-
fromPath
Creates a target from a path, which must be to a single file.- Parameters:
path
- the path- Returns:
- the target
- Throws:
ClientException
- if the path is to a directory rather than a file
-
fromPathString
Creates a target from a relative path string to a file. It does not matter whether forward slashes or backslashes are used as separators.- Parameters:
s
- a relative path string to a file- Returns:
- the target
- Throws:
ClientException
- if the path is to a directory rather than a file
-
fromClass
Creates a target from a class that the student is responsible for submitting. The class's package must not be empty.- Parameters:
targetClass
- the class- Returns:
- the target
- Throws:
ClientException
- if the package of the class is invalid
-
fromPathStrings
Creates targets from a directory string and list of files in the directory.- Parameters:
dir
- a relative directory string (ending with/
or\
)files
- the names of the files in the directory- Returns:
- the targets
- Throws:
ClientException
- if dir does not end with a path separator
-
fromDirectory
Creates targets from all the files in the specified directory.- Parameters:
dir
- a relative directory string- Returns:
- the targets
- Throws:
ClientException
- if dir is not a directory or is not accessible
-
toPathString
Gets the string representation of this target's absolute path.- Returns:
- the string representation of this target's absolute path
-
toPath
Gets this target's path- Returns:
- this target's path
-
toFile
Gets this target's file (which may be a directory).- Returns:
- this target's file
-
toDirectory
Gets this target's directory.- Returns:
- the directory
-
equals
-
hashCode
public int hashCode()
-