net.sf.mmm.util.pojo.base
Class GuessingPojoFactory

java.lang.Object
  extended by net.sf.mmm.util.component.base.AbstractComponent
      extended by net.sf.mmm.util.component.base.AbstractLoggableComponent
          extended by net.sf.mmm.util.pojo.base.SimplePojoFactory
              extended by net.sf.mmm.util.pojo.base.DefaultPojoFactory
                  extended by net.sf.mmm.util.pojo.base.GuessingPojoFactory
All Implemented Interfaces:
PojoFactory

@Singleton
@Named
public class GuessingPojoFactory
extends DefaultPojoFactory

This is the default implementation of the PojoFactory interface.
In advance to DefaultPojoFactory it tries to find implementations for interfaces by guessing according to conventions:
For an interface some.package.api.Foo it will try to find the following classes...

Since:
1.1.0
Author:
Joerg Hohwiller (hohwille at users.sourceforge.net)

Field Summary
private static String API_PKG_SUFFIX
          The conventional suffix for an api package.
private static String IMPL_CLASS_SUFFIX
          The conventional suffix for an implementation class.
private static String IMPL_PKG_SUFFIX
          The conventional suffix for an implementation package.
 
Constructor Summary
GuessingPojoFactory()
          The constructor.
GuessingPojoFactory(CollectionFactoryManager collectionFactoryManager)
          The constructor.
 
Method Summary
protected
<POJO> POJO
newInstanceForInterface(Class<POJO> pojoInterface)
          This method is invoked from SimplePojoFactory.newInstance(Class) if the given Class is an interface.
 
Methods inherited from class net.sf.mmm.util.pojo.base.DefaultPojoFactory
doInitialize, getCollectionFactoryManager, setCollectionFactoryManager
 
Methods inherited from class net.sf.mmm.util.pojo.base.SimplePojoFactory
newInstance, newInstanceForClass
 
Methods inherited from class net.sf.mmm.util.component.base.AbstractLoggableComponent
getLogger, setLogger
 
Methods inherited from class net.sf.mmm.util.component.base.AbstractComponent
doInitialized, getInitializationState, initialize
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

IMPL_CLASS_SUFFIX

private static final String IMPL_CLASS_SUFFIX
The conventional suffix for an implementation class.

See Also:
Constant Field Values

IMPL_PKG_SUFFIX

private static final String IMPL_PKG_SUFFIX
The conventional suffix for an implementation package.

See Also:
Constant Field Values

API_PKG_SUFFIX

private static final String API_PKG_SUFFIX
The conventional suffix for an api package.

See Also:
Constant Field Values
Constructor Detail

GuessingPojoFactory

public GuessingPojoFactory()
The constructor.


GuessingPojoFactory

public GuessingPojoFactory(CollectionFactoryManager collectionFactoryManager)
The constructor.

Parameters:
collectionFactoryManager - is the CollectionFactoryManager instance used to create Maps and Collections.
Method Detail

newInstanceForInterface

protected <POJO> POJO newInstanceForInterface(Class<POJO> pojoInterface)
                                throws InstantiationFailedException
This method is invoked from SimplePojoFactory.newInstance(Class) if the given Class is an interface.

Overrides:
newInstanceForInterface in class DefaultPojoFactory
Type Parameters:
POJO - is the generic type of the Pojo to create.
Parameters:
pojoInterface - is the interface reflecting the Pojo to create.
Returns:
the new instance of the given pojoType.
Throws:
InstantiationFailedException - if the instantiation failed.


Copyright © 2001-2010 mmm-Team. All Rights Reserved.