com.autodesk.objects
Class FilesObject

java.lang.Object
  extended by com.autodesk.objects.FilesObject
All Implemented Interfaces:
IOObject

public class FilesObject
extends java.lang.Object
implements IOObject

This class represents a collection of files or directories. The files may be absolute or relative. If they are relative then there is a single directory given that the files are relative to.


Constructor Summary
FilesObject(java.io.File base, java.io.File[] files)
          Create a FilesObject.
FilesObject(java.lang.String base, java.lang.String[] files)
          Create a FilesObject.
 
Method Summary
static boolean classConvertibleTo(java.lang.Class otherClass)
          Determine if this class is convertible to another IOObject class.
 IOObject convert(java.lang.Class otherClass)
          Convert this object to an object of another class.
 boolean convertibleTo(java.lang.Class otherClass)
          Check if this object can be converted to some other class.
 java.io.File getBaseDirectory()
          Get the base directory.
 java.io.File[] getFiles()
          Get the files this object references.
 java.lang.Class[] listClasses()
          Return a Class array of classes that this object is capable of converting itself into.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FilesObject

public FilesObject(java.io.File base,
                   java.io.File[] files)
Create a FilesObject. The files array may only be null when base is also null. If you need to return a single diretory set base to null and create a single element array containing the directory for files.

Parameters:
base - the base directory that the files are relative to. This may be null in which case the files are all absolute references.
files - an array of files. This may only be null if base is also null. If base is not null the files should be below the directory specified by base. The array is copied though File objects contained within are not.

FilesObject

public FilesObject(java.lang.String base,
                   java.lang.String[] files)
Create a FilesObject. The files array may only be null when base is also null. If you need to return a single diretory set base to null and create a single element array containing the directory for files.

Parameters:
base - the base directory that the files are relative to. This may be null in which case the files are all absolute references.
files - an Array of Strings that contain filenames. This may only be null if base is also null. If base is not null the files should be below the directory specified by base.
Method Detail

classConvertibleTo

public static boolean classConvertibleTo(java.lang.Class otherClass)
Determine if this class is convertible to another IOObject class. This method is required by all IOObject implementations.

Parameters:
otherClass - class to test.
Returns:
true is returned if this object can be converted to the given class, false otherwise.
See Also:
IOObject

convertibleTo

public boolean convertibleTo(java.lang.Class otherClass)
Check if this object can be converted to some other class.

Specified by:
convertibleTo in interface IOObject
Parameters:
otherClass - class to test.
Returns:
true is returned if this object can be converted to the given class, false otherwise.
See Also:
IOObject.convertibleTo(Class)

convert

public IOObject convert(java.lang.Class otherClass)
Convert this object to an object of another class. If asked to convert to the same class then the same object is returned.

Specified by:
convert in interface IOObject
Parameters:
otherClass - another class to cast the object to.
Returns:
an object of the other class or null if the cast is not possible. (castableTo() will return true when the cast is possible and false otherwise.)
See Also:
IOObject.convert(Class)

listClasses

public java.lang.Class[] listClasses()
Return a Class array of classes that this object is capable of converting itself into.

Specified by:
listClasses in interface IOObject
Returns:
a Class array of class.
See Also:
IOObject.listClasses()

getBaseDirectory

public java.io.File getBaseDirectory()
Get the base directory. If this is null then the files are all absolute references.

Returns:
get the base directory for this collection of files.

getFiles

public java.io.File[] getFiles()
Get the files this object references. This method returns a reference to the internal Files array for efficiency. If you need to make changes to the array you must clone it first.

Returns:
the array of files. This will only be null when the base directory is also null. The returned files are absolute references having been expanded from the base directory.