public abstract class Utils
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
DEFAULT_JAVA_COMPILER
'javac' the default java compiler.
|
static java.lang.String |
DEFAULT_OUTPUT_DIRECTORY
'bin' the sub-folder containing compiled classes.
|
static java.lang.String |
DEFAULT_SOURCE_DIRECTORY
'src' the sub-folder containing java/groovy source code.
|
static java.lang.String |
FILE_SUFFIX_GROOVY
'.groovy' the suffix of groovy source code.
|
static java.lang.String |
FILE_SUFFIX_JAVA
'.java' the suffix of java source code.
|
Constructor and Description |
---|
Utils() |
Modifier and Type | Method and Description |
---|---|
static void |
compile(java.lang.String classnames)
Compile the java/groovy source code.
NOTE: 1. |
static void |
compile(java.lang.String classnames,
java.lang.String sourceDIR,
java.lang.String outDIR,
java.lang.String useClasspath)
Compile java and/or groovy source code.
|
static boolean |
equals(java.lang.Object value1,
java.lang.Object value2)
Compare 2 objects even they are multiple-dimension arrays.
|
static java.lang.Object[] |
getArray(java.lang.Object array) |
static java.lang.Object |
getMapValue(java.util.Map<?,?> map,
java.lang.Object key,
java.lang.Object defaultValue)
Get the value form the map according to a key.
If the map is null or the value is null, then return the default value. |
static boolean |
getNumLock() |
static void |
main(java.lang.String[] params)
java -ea org.safs.Utils
|
static void |
makeRunAsAdministrator(java.lang.String lnkFileName)
Change the windows .lnk file's property to make it "Run As Administrator".
|
static java.lang.Object |
parseValue(java.lang.Class<?> expectedType,
java.lang.Object value)
Convert the parameter 'value' to an appropriate Object according to the expectedType.
|
static void |
setNumLock(boolean onOff) |
static java.lang.String |
toString(java.lang.Object object)
Convert an Object to a string, even this object is a multiple dimension array.
|
public static final java.lang.String FILE_SUFFIX_JAVA
public static final java.lang.String FILE_SUFFIX_GROOVY
public static final java.lang.String DEFAULT_SOURCE_DIRECTORY
public static final java.lang.String DEFAULT_OUTPUT_DIRECTORY
public static final java.lang.String DEFAULT_JAVA_COMPILER
public static void setNumLock(boolean onOff)
onOff
- boolean, Set keyboard's 'NumLock' on or off.public static boolean getNumLock()
public static void compile(java.lang.String classnames) throws SAFSException
root + "src" (source files folder) + package1 + package2 + "bin" (compiled classes go into this folder--which will be created if not already present.)
classnames
- String, the class names to compile separated by space, such as my.package.ClassA my.pack2.ClassBSAFSException
- if the compilation failed for any reason--including bad parameter values.public static void compile(java.lang.String classnames, java.lang.String sourceDIR, java.lang.String outDIR, java.lang.String useClasspath) throws SAFSException
classnames
- String, the class names to compile separated by space, such as my.package.ClassA my.pack2.ClassBsourceDIR
- String, the root directory off which the sourcecode files reside.outDIR
- String, the root directory off which the compiled classes will be stored. The directory will be created, if necessary.useClasspath
- String, the semi-colon separated CLASSPATH to be used for the compile.SAFSException
- if the compilation failed for any reason--including bad parameter values.public static java.lang.Object getMapValue(java.util.Map<?,?> map, java.lang.Object key, java.lang.Object defaultValue)
map
- Mapkey
- Object,defaultValue
- Object,public static java.lang.Object parseValue(java.lang.Class<?> expectedType, java.lang.Object value) throws SAFSException
expectedType
- Class, the expected field typevalue
- Object, the value to parse.SAFSException
public static java.lang.Object[] getArray(java.lang.Object array) throws SAFSException
array
- Object, an array object.SAFSException
public static java.lang.String toString(java.lang.Object object)
object
- Objectpublic static boolean equals(java.lang.Object value1, java.lang.Object value2)
value1
- Objectvalue2
- Objectpublic static void makeRunAsAdministrator(java.lang.String lnkFileName) throws java.io.IOException
lnkFileName
- String, the full path to a link filejava.io.IOException
public static void main(java.lang.String[] params)
Copyright © SAS Institute. All Rights Reserved.