Class Builder

  extended by org.inria.ns.reflex.processor.catalog.Builder
Direct Known Subclasses:
CatalogBuilder, FilterBuilder, ModuleBuilder, SchemaBuilder, TypeBuilder, XMLBuilder

public abstract class Builder
extends Object

A Builder uses an input to deliver an instance of the object that the input represents. A single builder is not intended to deliver several instances each time the getInstance() method is invoked. However, XMLBuilder seems to waive this principle, because it can deliver either a SAX event producer or a DOM tree ; in fact, both represent the same data model, giving just different APIs ; so the instance delivered is effectively "the same" in a higher point of view.

To deliver an instance, the following steps are performed :

If an instance of the object can be delivered, next requests should deliver it quickly.

This class is used to provide instances of huge objects stored in a file or in a data base ; for example, EXP modules, catalogs, and schemata are usually backed by a builder. The input is usually a file name, or an URI...


This builder can act as a wrapper if a ready-to-use object is available.

To do so, concrete implementations of this class must fill the protected member #object that will be directly delivered.

Philippe Poulard

Constructor Summary
Builder(Object name, Object input)
          Create a builder from an input.
Method Summary
 boolean equals(Object obj)
 Object getInstance()
          Return an instance that is represented by the input.
 int hashCode()
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, toString, wait, wait, wait

Constructor Detail


public Builder(Object name,
               Object input)
Create a builder from an input.

If a string is given as input, it may be in the following format : "res:org.acme.MyCatalog".

name - The name of the object.
input - The input that will be used to build the instance.
Method Detail


public boolean equals(Object obj)
equals in class Object
See Also:


public int hashCode()
hashCode in class Object
See Also:


public Object getInstance()
                   throws Exception
Return an instance that is represented by the input.

Once an instance is resolved, this builder always delivers it, except if the reference is a class name (a new instance will be created).

The non-null object built now or previously by this builder.
Exception - When the input can't be used to build a new instance.