org.apache.commons.clazz
Class ClazzLoader

java.lang.Object
  extended by org.apache.commons.clazz.ClazzLoader
Direct Known Subclasses:
BeanClazzLoader, GroupClazzLoader, ReflectedClazzLoader

public abstract class ClazzLoader
extends Object

Constructs/loads Clazzes.

Version:
$Id: ClazzLoader.java 155436 2005-02-26 13:17:48Z dirkv $
Author:
Dmitri Plotnikov

Constructor Summary
ClazzLoader(ModelClazzLoader modelClazzLoader)
          ClazzLoaders are grouped into models.
 
Method Summary
abstract  Clazz defineClazz(String name, Class clazzClass, Class instanceClass)
          Defines a new Clazz with the supplied name.
 void enableLogging(String className)
          Enable diagnistic logging for the specified class.
 Clazz getClazz(Object instance)
          Returns the Clazz for the supplied instance.
abstract  Clazz getClazzForName(String name)
          Given a Clazz name, returns the corresponding Clazz.
abstract  String getClazzName(Object instance)
          Returns the clazz name for the supplied instance.
 String getModel()
          Returns the name of the model this clazz loader belongs to.
 ModelClazzLoader getModelClazzLoader()
          Returns the model clazz loader for this clazz loader.
 boolean isLoggingEnabled(String className)
           
abstract  boolean isMember(Object instance)
          Returns true iff this loader has or can construct a Clazz for the supplied instance.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ClazzLoader

public ClazzLoader(ModelClazzLoader modelClazzLoader)
ClazzLoaders are grouped into models.

Method Detail

getModelClazzLoader

public ModelClazzLoader getModelClazzLoader()
Returns the model clazz loader for this clazz loader.


getModel

public String getModel()
Returns the name of the model this clazz loader belongs to.


getClazzForName

public abstract Clazz getClazzForName(String name)
Given a Clazz name, returns the corresponding Clazz. Does not cache clazzes, that's the job of CachingGroupClazzLoader. Return null if there is no Clazz for this name.

Note that we use canonical class names for primitive types and arrays, e.g. "byte", "byte[]", "boolean[][]", "java.lang.String[]".


isMember

public abstract boolean isMember(Object instance)
Returns true iff this loader has or can construct a Clazz for the supplied instance.


getClazz

public Clazz getClazz(Object instance)
Returns the Clazz for the supplied instance. Returns null if it cannot produce such a Clazz.


getClazzName

public abstract String getClazzName(Object instance)
Returns the clazz name for the supplied instance. Returns null if it cannot produce a clazz name for the instance.


defineClazz

public abstract Clazz defineClazz(String name,
                                  Class clazzClass,
                                  Class instanceClass)
Defines a new Clazz with the supplied name. If it cannot define a clazz of the supplied type or if it cannot define clazzes at all, returns null.

Parameters:
name - the name of the clazz, should be unique within the scope of the top-level ClazzLoader
clazzClass - the Class of the Clazz that this method needs to produce.
instanceClass - the Class of the instances the new Clazz will be able to create using the newInstance() method.
Returns:
Clazz

enableLogging

public void enableLogging(String className)
Enable diagnistic logging for the specified class.


isLoggingEnabled

public boolean isLoggingEnabled(String className)


Copyright © 2001-2010 The Apache Software Foundation. All Rights Reserved.