public class Blowdryer extends Object
Public static methods which retrieve resources as
determined by BlowdryerSetup.
| Modifier and Type | Class and Description |
|---|---|
static class |
Blowdryer.WithProject
|
| Modifier and Type | Method and Description |
|---|---|
static File |
file(String resourcePath)
Returns the given resource as a File (as configured by
BlowdryerSetup. |
static File |
immutableUrl(String url)
Downloads the given url to a local file in the system temporary directory.
|
static File |
immutableUrl(String url,
String requiredSuffix)
Downloads the given url to a local file in the system temporary directory.
|
static <T> T |
proj(Project project,
Class<T> clazz,
String key,
String descForError)
Reads a property from the project, and throws “Undefined ‘key’: descForError” if it is missing,
or “Wrong type ‘key’: descForError - expected java.io.File but was java.io.String”
|
static String |
proj(Project project,
String key,
String descForError)
Reads a property from the project, and throws “Undefined ‘key’: descForError” if it is missing.
|
static <T> T |
projOptional(Project project,
Class<T> clazz,
String key,
String descForError)
Reads a property from the project, returns null if it is not present.
|
static String |
projOptional(Project project,
String key,
String descForError)
Alias for
projOptional(Project, String, String) with String.class. |
static String |
prop(String propFile,
String key)
Returns the key from the given propFile (adds .properties extension automatically).
|
public static File immutableUrl(String url)
Downloads the given url to a local file in the system temporary directory. It will only be downloaded once, system-wide, and it will not be checked for updates. This is appropriate only for immutable URLs, such as specific hashes from Git.
public static File immutableUrl(String url, @Nullable String requiredSuffix)
Downloads the given url to a local file in the system temporary directory. It will only be downloaded once, system-wide, and it will not be checked for updates. This is appropriate only for immutable URLs, such as specific hashes from Git.
If requiredSuffix is non-null, it is guaranteed that the returned filename will end with that string.
public static File file(String resourcePath)
Returns the given resource as a File (as configured by BlowdryerSetup.
public static String prop(String propFile, String key) throws IOException
Returns the key from the given propFile (adds .properties extension automatically).
IOExceptionpublic static String proj(Project project, String key, String descForError)
Reads a property from the project, and throws “Undefined ‘key’: descForError” if it is missing. Requires the property value to be a String.
public static <T> T proj(Project project, Class<T> clazz, String key, String descForError)
Reads a property from the project, and throws “Undefined ‘key’: descForError” if it is missing, or “Wrong type ‘key’: descForError - expected java.io.File but was java.io.String”
@Nullable public static <T> T projOptional(Project project, Class<T> clazz, String key, String descForError)
Reads a property from the project, returns null if it is not present.