Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

edu.iicm.xpg.util
Class Factory  view Factory download Factory.java

java.lang.Object
  extended byedu.iicm.xpg.util.Factory

public class Factory
extends java.lang.Object

This is a simple factory implementation. DFactory consists of a search method for looking up a Class Object within a given SearchPath. The search method returns a new Instance of the requested class. Furthermore there is a method getSearchPath and setSearchPath to get and set the class search path, wich consists of a stringarray of packagenames.

Version:
$Revision: 1.1 $

Field Summary
private  java.util.Hashtable cache_
          class cache Hashtable
private  java.lang.String[] path_
          String Array for the class search path
 
Constructor Summary
Factory()
          The default constructor
Factory(java.lang.String[] path)
          Another constructor with the search path as argument.
 
Method Summary
 void appendSearchPath(java.lang.String path)
          This method appends a path to the current SearchPath.
 void clearClassCache()
          Just for clearing the cache...
 java.lang.Object getInstance(java.lang.String partly_qualified_classname)
          getInstance(String partly_qualified_classname) tries to find an object a in one of the packagenames within the search path and returns a new Instance of the found object or throws a ClassNotFoundException.
 java.lang.String[] getSearchPath()
          This method returns the current search path and throws an IllegalStateException if the search path is null
 int getSearchPathIndex(java.lang.String path)
          This method returns the position the path
protected  void insertPath(java.lang.String path, int position)
          This method inserts the path at the position in the current SearchPath.
 void insertSearchPath(java.lang.String path, int position)
          This method inserts the path at the position in the current SearchPath.
 boolean isSearchPathRegistered(java.lang.String path)
          This method checks if a path is in the current SearchPath
 void removeLastSearchPath()
          This method removes the last path of the SearchPath.
 void removeSearchPath(int position)
          This method removes the path on a specified position of the SearchPath.
 void removeSearchPath(java.lang.String path)
          This method removes the path to the SearchPath.
 void reverseSearchPath()
          This method reverse the strings in the string array.
 void setSearchPath(java.lang.String[] path)
          This method sets the seach Path and clears the class cache to prevent the returnation of Objects from the wrong packages
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

path_

private java.lang.String[] path_
String Array for the class search path


cache_

private java.util.Hashtable cache_
class cache Hashtable

Constructor Detail

Factory

public Factory()
The default constructor


Factory

public Factory(java.lang.String[] path)
Another constructor with the search path as argument.

Method Detail

setSearchPath

public void setSearchPath(java.lang.String[] path)
                   throws java.lang.IllegalArgumentException
This method sets the seach Path and clears the class cache to prevent the returnation of Objects from the wrong packages


getSearchPath

public java.lang.String[] getSearchPath()
                                 throws java.lang.IllegalStateException
This method returns the current search path and throws an IllegalStateException if the search path is null


getInstance

public java.lang.Object getInstance(java.lang.String partly_qualified_classname)
                             throws java.lang.ClassNotFoundException,
                                    java.lang.LinkageError,
                                    java.lang.ExceptionInInitializerError,
                                    java.lang.IllegalArgumentException,
                                    java.lang.IllegalStateException,
                                    java.io.IOException
getInstance(String partly_qualified_classname) tries to find an object a in one of the packagenames within the search path and returns a new Instance of the found object or throws a ClassNotFoundException.


clearClassCache

public void clearClassCache()
Just for clearing the cache...


getSearchPathIndex

public int getSearchPathIndex(java.lang.String path)
                       throws java.lang.IllegalStateException
This method returns the position the path


isSearchPathRegistered

public boolean isSearchPathRegistered(java.lang.String path)
                               throws java.lang.IllegalStateException
This method checks if a path is in the current SearchPath


appendSearchPath

public void appendSearchPath(java.lang.String path)
                      throws java.lang.IllegalStateException,
                             java.lang.IllegalArgumentException
This method appends a path to the current SearchPath.


insertSearchPath

public void insertSearchPath(java.lang.String path,
                             int position)
                      throws java.lang.IllegalStateException,
                             java.lang.IllegalArgumentException
This method inserts the path at the position in the current SearchPath.


insertPath

protected void insertPath(java.lang.String path,
                          int position)
                   throws java.lang.IllegalStateException,
                          java.lang.IllegalArgumentException
This method inserts the path at the position in the current SearchPath.


removeSearchPath

public void removeSearchPath(java.lang.String path)
                      throws java.lang.IllegalStateException,
                             java.lang.IllegalStateException
This method removes the path to the SearchPath.


removeLastSearchPath

public void removeLastSearchPath()
                          throws java.lang.IllegalStateException
This method removes the last path of the SearchPath.


removeSearchPath

public void removeSearchPath(int position)
                      throws java.lang.IllegalStateException,
                             java.lang.IllegalArgumentException
This method removes the path on a specified position of the SearchPath.


reverseSearchPath

public void reverseSearchPath()
                       throws java.lang.IllegalStateException
This method reverse the strings in the string array.