jodd.petite.config
Class AutomagicPetiteConfig

java.lang.Object
  extended by jodd.io.findfile.FindClass
      extended by jodd.petite.config.AutomagicPetiteConfig
All Implemented Interfaces:
PetiteConfig

public class AutomagicPetiteConfig
extends jodd.io.findfile.FindClass
implements PetiteConfig

Auto-magically configures Petite container by analyzing the classpath.

Scans all classes on classpath and in jar files, and scans for PetiteBean annotation (not by loading the class!). If annotation is founded, class will be loaded and registered as Petite bean.


Field Summary
protected  PetiteContainer container
           
protected  long elapsed
           
protected  byte[] petiteBeanAnnotationBytes
           
 
Fields inherited from class jodd.io.findfile.FindClass
createInputStream, excludedJars, excludedPackages, includedJars, includedPackages
 
Constructor Summary
AutomagicPetiteConfig()
           
 
Method Summary
 void configure(PetiteContainer petiteContainer)
          Configures PetiteContainer with default class path.
 void configure(PetiteContainer petiteContainer, java.net.URL[] classpath)
          Configures PetiteContainer with specified class path.
 long getElapsed()
          Return elapsed number of milliseconds for configuration.
protected  java.lang.Class loadClass(java.lang.String className)
          Loads class from classname using default classloader.
protected  void onClassName(java.lang.String className, java.io.InputStream inputStream)
          Scans all classes and registers only those annotated with PetiteBean.
 
Methods inherited from class jodd.io.findfile.FindClass
getExcludedJars, getExcludedPackages, getIncludedJars, getIncludedPackages, scanClassName, scanClassPath, scanJarFile, scanUrl, setExcludedJars, setExcludedPackages, setIncludedJars, setIncludedPackages
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

petiteBeanAnnotationBytes

protected byte[] petiteBeanAnnotationBytes

container

protected PetiteContainer container

elapsed

protected long elapsed
Constructor Detail

AutomagicPetiteConfig

public AutomagicPetiteConfig()
Method Detail

getElapsed

public long getElapsed()
Return elapsed number of milliseconds for configuration.


configure

public void configure(PetiteContainer petiteContainer,
                      java.net.URL[] classpath)
Configures PetiteContainer with specified class path.

See Also:
configure(jodd.petite.PetiteContainer)

configure

public void configure(PetiteContainer petiteContainer)
Configures PetiteContainer with default class path.

Specified by:
configure in interface PetiteConfig
See Also:
configure(jodd.petite.PetiteContainer, java.net.URL[])

onClassName

protected void onClassName(java.lang.String className,
                           java.io.InputStream inputStream)
Scans all classes and registers only those annotated with PetiteBean. Because of performance purposes, classes are not dynamically loaded; instead, their file content is examined.

Specified by:
onClassName in class jodd.io.findfile.FindClass

loadClass

protected java.lang.Class loadClass(java.lang.String className)
                             throws java.lang.ClassNotFoundException
Loads class from classname using default classloader.

Throws:
java.lang.ClassNotFoundException


Copyright ©2008 Jodd Team