Package org.terracotta.utilities.test.io
Enum WindowsSpecialFolder
- java.lang.Object
-
- java.lang.Enum<WindowsSpecialFolder>
-
- org.terracotta.utilities.test.io.WindowsSpecialFolder
-
- All Implemented Interfaces:
java.io.Serializable,java.lang.Comparable<WindowsSpecialFolder>
public enum WindowsSpecialFolder extends java.lang.Enum<WindowsSpecialFolder>
Provides the value for Windows Special Folder identifiers.The values represented by this enumeration are determined when first referenced by calling
PowerShellto obtain the path assigned to the special folder identifier.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description private static classWindowsSpecialFolder.LazyProperty<T>A derived on first reference value holder.static classWindowsSpecialFolder.SpecialFolderExceptionThrown when the folder assigned to a Windows Special Folder identifier cannot be determined.
-
Enum Constant Summary
Enum Constants Enum Constant Description COMMON_APPLICATION_DATAProvides thePathcorresponding to theCommonApplicationDataspecial folder.SYSTEMProvides thePathcorresponding to theSystemspecial folder.
-
Field Summary
Fields Modifier and Type Field Description private WindowsSpecialFolder.LazyProperty<java.nio.file.Path>accessorprivate static org.slf4j.LoggerLOGGER
-
Constructor Summary
Constructors Modifier Constructor Description privateWindowsSpecialFolder(java.lang.String identifier, boolean create)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.nio.file.Pathget()Gets thePathassigned to the identified special folder.private static java.nio.file.PathgetSpecialFolder(java.lang.String specialFolderId, boolean create)Gets thePathto the identified Windows Special Folder.static WindowsSpecialFoldervalueOf(java.lang.String name)Returns the enum constant of this type with the specified name.static WindowsSpecialFolder[]values()Returns an array containing the constants of this enum type, in the order they are declared.
-
-
-
Enum Constant Detail
-
COMMON_APPLICATION_DATA
public static final WindowsSpecialFolder COMMON_APPLICATION_DATA
Provides thePathcorresponding to theCommonApplicationDataspecial folder. A get via this constant will attempt to create the folder if it does not already exist.
-
SYSTEM
public static final WindowsSpecialFolder SYSTEM
Provides thePathcorresponding to theSystemspecial folder.
-
-
Field Detail
-
accessor
private final WindowsSpecialFolder.LazyProperty<java.nio.file.Path> accessor
-
LOGGER
private static final org.slf4j.Logger LOGGER
-
-
Method Detail
-
values
public static WindowsSpecialFolder[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:for (WindowsSpecialFolder c : WindowsSpecialFolder.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static WindowsSpecialFolder valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)- Parameters:
name- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
java.lang.IllegalArgumentException- if this enum type has no constant with the specified namejava.lang.NullPointerException- if the argument is null
-
get
public java.nio.file.Path get() throws java.io.IOExceptionGets thePathassigned to the identified special folder.- Returns:
- the special folder
Path - Throws:
java.io.IOException- if an error is raised while attempting to determine thePathfor the special folder
-
getSpecialFolder
private static java.nio.file.Path getSpecialFolder(java.lang.String specialFolderId, boolean create) throws java.io.IOExceptionGets thePathto the identified Windows Special Folder.- Parameters:
specialFolderId- the special folder identifiercreate- iftrue, attempts to create the folder if it does not exist- Returns:
- the path to the special folder; an empty path is returned if the folder does not exist
- Throws:
java.io.IOException- if the special folder value cannot be determined
-
-