au.edu.archer.util
Class XDMSUtil

java.lang.Object
  extended by au.edu.archer.util.XDMSUtil

public class XDMSUtil
extends java.lang.Object

General utility class for XDMS.


Field Summary
static java.lang.String DIR_SEPERATOR
          DIR_SEPERATOR.
static java.lang.String ISO8601_FORMAT
          ISO8601_FORMAT.
static java.lang.String LINE_SEPERTAOR
          LINE_SEPERTAOR.
static java.lang.String SPACE
          SPACE.
static java.lang.String YES
          YES.
 
Constructor Summary
XDMSUtil()
           
 
Method Summary
static java.util.Date generateDate(java.lang.String dateStr)
          Generate Date object from string date.
static java.lang.String generateDisplayDate(java.util.Date date)
          Generate date as display string.
static java.lang.String generateSuffixByTimeStamp()
          Generate the suffix based on the timestamp.
static java.lang.String getCurrentDateInISO8601Format()
          Get current date in ISO-8601 format.
static byte[] getFileAsBytes(java.io.File file)
          Generate byte array representation of a file.
static byte[] getFileAsBytes(java.lang.String fileLocation)
          Generate byte array representation of a file.
static java.util.List<java.lang.String> getInterfaceFieldNames(java.lang.Class interfaceClass)
          Get the list of field names using reflection.
static java.lang.String getInterfaceFieldValue(java.lang.Class interfaceClass, java.lang.String interfaceFieldName)
          Retrieve interface field value by name.
static java.util.List<java.lang.Object> getInterfaceFieldValues(java.lang.Class interfaceClass)
          Get the list of field value using reflection.
static boolean isListEmptyOrNull(java.util.List list)
          Check if the List is empty or null.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

ISO8601_FORMAT

public static final java.lang.String ISO8601_FORMAT
ISO8601_FORMAT.

See Also:
Constant Field Values

LINE_SEPERTAOR

public static final java.lang.String LINE_SEPERTAOR
LINE_SEPERTAOR.


YES

public static final java.lang.String YES
YES.

See Also:
Constant Field Values

SPACE

public static final java.lang.String SPACE
SPACE.

See Also:
Constant Field Values

DIR_SEPERATOR

public static final java.lang.String DIR_SEPERATOR
DIR_SEPERATOR.

See Also:
Constant Field Values
Constructor Detail

XDMSUtil

public XDMSUtil()
Method Detail

generateDate

public static java.util.Date generateDate(java.lang.String dateStr)
Generate Date object from string date.

Parameters:
dateStr - string date.
Returns:
date object.

getCurrentDateInISO8601Format

public static java.lang.String getCurrentDateInISO8601Format()
Get current date in ISO-8601 format. The date format is YYYY-MM-DD.

Returns:
a String represents a date which format is YYYY-MM-DD.

generateDisplayDate

public static java.lang.String generateDisplayDate(java.util.Date date)
Generate date as display string.

Parameters:
date - Date object.
Returns:
date display string.

getInterfaceFieldNames

public static java.util.List<java.lang.String> getInterfaceFieldNames(java.lang.Class interfaceClass)
Get the list of field names using reflection.

Parameters:
interfaceClass - Interface whose fields are required
Returns:
List of field names.

getInterfaceFieldValues

public static java.util.List<java.lang.Object> getInterfaceFieldValues(java.lang.Class interfaceClass)
Get the list of field value using reflection.

Parameters:
interfaceClass - Interface whose fields are required
Returns:
List of field values.

getInterfaceFieldValue

public static java.lang.String getInterfaceFieldValue(java.lang.Class interfaceClass,
                                                      java.lang.String interfaceFieldName)
Retrieve interface field value by name.

Parameters:
interfaceClass - Interface from which the value is to be retrieved.
interfaceFieldName - Interface field name.
Returns:
Interface field value.

isListEmptyOrNull

public static boolean isListEmptyOrNull(java.util.List list)
Check if the List is empty or null.

Parameters:
list - List to be checked.
Returns:
true if the list is empty or null, otherwise false.

getFileAsBytes

public static byte[] getFileAsBytes(java.io.File file)
                             throws java.io.FileNotFoundException,
                                    java.io.IOException
Generate byte array representation of a file.

Parameters:
file - File object to be transformed.
Returns:
byte array representation of the file.
Throws:
java.io.FileNotFoundException - if the file can not be found.
java.io.IOException - if file processing goes wrong.

getFileAsBytes

public static byte[] getFileAsBytes(java.lang.String fileLocation)
                             throws java.io.FileNotFoundException,
                                    java.io.IOException
Generate byte array representation of a file.

Parameters:
fileLocation - Full path of the file to be transformed.
Returns:
byte array representation of the file.
Throws:
java.io.FileNotFoundException - if the file can not be found.
java.io.IOException - if file processing goes wrong.

generateSuffixByTimeStamp

public static java.lang.String generateSuffixByTimeStamp()
Generate the suffix based on the timestamp.

Returns:
a String represents the suffix.


Copyright © 2008-09 Monash University. All Rights Reserved.