au.com.swz.jatlom
Class ITypeLib

java.lang.Object
  extended by au.com.swz.jatlom.ITypeLib

public class ITypeLib
extends java.lang.Object

The data that describes a set of objects is stored in a type library. A type library can be a stand-alone binary file (.TLB), a resource in a dynamic link library or executable file (.DLL, .OLB, or .EXE).

Author:
Mark Richter

Method Summary
 TypeLibAttributes getImportedTypeLibAttributes(int index)
          Returns the attributes of the imported type library at the specified index.
 int getImportedTypeLibCount()
          Returns the number of type libraries imported by this type library.
 ITypeInfo getTypeInfo(int index)
          Retrieves a description of the type at the specified index within this type library.
 ITypeInfo getTypeInfoByName(java.lang.String name)
          Finds and returns the first type within this type library that has the specified name.
 int getTypeInfoCount()
          Provides the number of type descriptions that are in this type library.
 ITypeInfo[] getTypeInfos()
          Retrieves all of the types within this type library.
 TypeLibAttributes getTypeLibAttributes()
          Returns the attributes of this type library.
static ITypeLib loadTypeLib(java.io.File file)
          Loads the specified type library.
static ITypeLib loadTypeLib(java.lang.String libName)
          Loads the specified type library.
static ITypeLib loadTypeLibByGUID(java.lang.String guid, int majorVersion, int minorVersion, boolean exactVersion)
           Loads the type library identified by the GUID and version.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

loadTypeLib

public static ITypeLib loadTypeLib(java.io.File file)
                            throws java.io.IOException
Loads the specified type library. If the specified file parameter contains no path then this method searches for the specified file as follows; If the type library is already loaded, LoadTypeLib increments the type library's reference count and returns the type library. For backward compatibility, loadTypeLib will register the type library if the path is not specified in the fileName parameter. LoadTypeLib will not register the type library if the path of the type library is specified.

Parameters:
file - the type library file to load.
Returns:
An ITypeLib object that can be used to interogate the type library.
Throws:
java.io.IOException

loadTypeLib

public static ITypeLib loadTypeLib(java.lang.String libName)
                            throws java.io.IOException
Loads the specified type library. If the specified file name parameter contains no path then this method searches for the specified file as follows; If the type library is already loaded, LoadTypeLib increments the type library's reference count and returns the type library. For backward compatibility, loadTypeLib will register the type library if the path is not specified in the fileName parameter. LoadTypeLib will not register the type library if the path of the type library is specified.

Parameters:
libName - the fully qualified pathname to the library to load.
Returns:
An ITypeLib object that can be used to interogate the type library.
Throws:
java.io.IOException

loadTypeLibByGUID

public static ITypeLib loadTypeLibByGUID(java.lang.String guid,
                                         int majorVersion,
                                         int minorVersion,
                                         boolean exactVersion)
                                  throws java.io.IOException

Loads the type library identified by the GUID and version. This method uses the registry to discover the type library by GUID. The exactVersion parameter determines if the specified version stipulates the minimum or exact version. If the exactVersion parameter is true then this method will only return a type library if the version number of that type library exactly matches the version specified. If the exactVersion parameter is false then this method will treat the version as a minimum version. It will return the latest versioned type library that is equal to or greater than the specified version.

If the type library is already loaded, this method increments the type library's reference count and returns the type library.

Parameters:
guid - the GUID of the type library to load.
majorVersion - the major version of the type library to load.
minorVersion - the minor version of the type library to load.
exactVersion - determines if the specified version stipulates the minimum or exact version.
Returns:
An ITypeLib object that can be used to interogate the type library.
Throws:
java.io.IOException - if the type library fails to load.

getTypeInfoByName

public ITypeInfo getTypeInfoByName(java.lang.String name)
Finds and returns the first type within this type library that has the specified name.

Parameters:
name - the name of the type that is required.
Returns:
the first type that has the specified name.

getTypeInfoCount

public int getTypeInfoCount()
Provides the number of type descriptions that are in this type library.

Returns:
the number of type descriptions in this type library.

getTypeInfo

public ITypeInfo getTypeInfo(int index)
Retrieves a description of the type at the specified index within this type library.

Parameters:
index - zero based index of the type to retrieve. This value must be less than the value returned by getTypeInfoCount().
Returns:
a ITypeInfo that contains information for the specified type.
Throws:
java.lang.ArrayIndexOutOfBoundsException - if the specified index is less than zero or exceeds the maximum number of type descriptions in this library.
See Also:
getTypeInfoCount()

getTypeInfos

public ITypeInfo[] getTypeInfos()
Retrieves all of the types within this type library.

Returns:
an array of ITypeInfo objects.
See Also:
getTypeInfoCount()

getTypeLibAttributes

public TypeLibAttributes getTypeLibAttributes()
Returns the attributes of this type library.

Returns:
the TypeLibAttributes of this type library

getImportedTypeLibCount

public int getImportedTypeLibCount()
Returns the number of type libraries imported by this type library.

Returns:
the number of type libraries imported by this type library.

getImportedTypeLibAttributes

public TypeLibAttributes getImportedTypeLibAttributes(int index)
Returns the attributes of the imported type library at the specified index.

Parameters:
index - the index for which the TypeLibAttributes is required.
Returns:
the TypeLibAttributes of the imported type library