org.apache.commons.clazz.reflect
Class ReflectedClazzLoader

java.lang.Object
  extended byorg.apache.commons.clazz.ClazzLoader
      extended byorg.apache.commons.clazz.reflect.ReflectedClazzLoader
Direct Known Subclasses:
ExtendedReflectedClazzLoader, StandardReflectedClazzLoader

public abstract class ReflectedClazzLoader
extends org.apache.commons.clazz.ClazzLoader

Version:
$Id: ReflectedClazzLoader.java,v 1.7 2004/02/19 23:58:37 scolebourne Exp $
Author:
Dmitri Plotnikov

Constructor Summary
ReflectedClazzLoader(org.apache.commons.clazz.ModelClazzLoader modelClazzLoader, ClassLoader classLoader)
           
 
Method Summary
protected abstract  org.apache.commons.clazz.Clazz createClazz(Class javaClass)
          Override this method to construct an Clazz for the given Class (javaClass).
 org.apache.commons.clazz.Clazz defineClazz(String name, Class clazzClass, Class instanceClass)
          Defines a new Clazz with the supplied name.
 org.apache.commons.clazz.Clazz getClazzForName(String name)
          Given a Clazz name, returns the corresponding Clazz.
 String getClazzName(Object instance)
          Returns the clazz name for the supplied instance.
 boolean isMember(Object instance)
          Returns true for all objects.
protected  boolean isSupportedClass(Class javaClass)
          Returns true for all classes supported by this specific clazz loader.
protected  org.apache.commons.clazz.Clazz lookupCustomClazz(Class javaClass)
          Try to find and allocate a custom Clazz for the specified Java class.
 
Methods inherited from class org.apache.commons.clazz.ClazzLoader
enableLogging, getClazz, getModel, getModelClazzLoader, isLoggingEnabled
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ReflectedClazzLoader

public ReflectedClazzLoader(org.apache.commons.clazz.ModelClazzLoader modelClazzLoader,
                            ClassLoader classLoader)
Method Detail

getClazzName

public String getClazzName(Object instance)
Description copied from class: org.apache.commons.clazz.ClazzLoader
Returns the clazz name for the supplied instance. Returns null if it cannot produce a clazz name for the instance.


getClazzForName

public org.apache.commons.clazz.Clazz getClazzForName(String name)
Description copied from class: org.apache.commons.clazz.ClazzLoader
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[]".


lookupCustomClazz

protected org.apache.commons.clazz.Clazz lookupCustomClazz(Class javaClass)
Try to find and allocate a custom Clazz for the specified Java class. Build the name of the custom Clazz class out of the name of the Java class, followed by the model name, followed by the word "Clazz". For example, if the java class is called "my.Foo", and the model is "Standard", the corresponding Clazz class name is "my.FooStandardClazz".

Parameters:
javaClass -
Returns:
Clazz

isMember

public boolean isMember(Object instance)
Returns true for all objects.

See Also:
ClazzLoader.isMember(Object)

isSupportedClass

protected boolean isSupportedClass(Class javaClass)
Returns true for all classes supported by this specific clazz loader.


createClazz

protected abstract org.apache.commons.clazz.Clazz createClazz(Class javaClass)
Override this method to construct an Clazz for the given Class (javaClass). Make sure that the new Clazz is initialized with the supplied clazzLoader representing the clazz loader group, not with this.


defineClazz

public org.apache.commons.clazz.Clazz defineClazz(String name,
                                                  Class clazzClass,
                                                  Class instanceClass)
Description copied from class: org.apache.commons.clazz.ClazzLoader
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
See Also:
ClazzLoader.defineClazz(String, Class, Class)


Copyright © 2002-2005 The Apache Software Foundation. All Rights Reserved.