FileDocCategorySizeDatePackage
VerifierFactory.javaAPI DocJava SE 5 API5405Fri Aug 26 14:55:24 BST 2005com.sun.org.apache.bcel.internal.verifier

VerifierFactory

public class VerifierFactory extends Object
This class produces instances of the Verifier class. Its purpose is to make sure that they are singleton instances with respect to the class name they operate on. That means, for every class (represented by a unique fully qualified class name) there is exactly one Verifier.
version
$Id: VerifierFactory.java,v 1.1.1.1 2001/10/29 20:00:32 jvanzyl Exp $
author
Enver Haase

Fields Summary
private static HashMap
hashMap
The HashMap that holds the data about the already-constructed Verifier instances.
private static Vector
observers
The VerifierFactoryObserver instances that observe the VerifierFactory.
Constructors Summary
private VerifierFactory()
The VerifierFactory is not instantiable.


	     	 
	 
Methods Summary
public static voidattach(VerifierFactoryObserver o)
Adds the VerifierFactoryObserver o to the list of observers.

		observers.addElement(o);
	
public static voiddetach(VerifierFactoryObserver o)
Removes the VerifierFactoryObserver o from the list of observers.

			observers.removeElement(o);
	
public static VerifiergetVerifier(java.lang.String fully_qualified_classname)
Returns the (only) verifier responsible for the class with the given name. Possibly a new Verifier object is transparently created.

return
the (only) verifier responsible for the class with the given name.

		fully_qualified_classname = fully_qualified_classname;
		
		Verifier v = (Verifier) (hashMap.get(fully_qualified_classname));
		if (v==null){
			v = new Verifier(fully_qualified_classname);
			hashMap.put(fully_qualified_classname, v);
			notify(fully_qualified_classname);
		}
		
		return v;
	
public static Verifier[]getVerifiers()
Returns all Verifier instances created so far. This is useful when a Verifier recursively lets the VerifierFactory create other Verifier instances and if you want to verify the transitive hull of referenced class files.

		Verifier[] vs = new Verifier[hashMap.values().size()];
		return (Verifier[]) (hashMap.values().toArray(vs));	// Because vs is big enough, vs is used to store the values into and returned!
	
private static voidnotify(java.lang.String fully_qualified_classname)
Notifies the observers of a newly generated Verifier.

		// notify the observers
		Iterator i = observers.iterator();
		while (i.hasNext()){
			VerifierFactoryObserver vfo = (VerifierFactoryObserver) i.next();
			vfo.update(fully_qualified_classname);
		}