org.org.usurper.setup
Class UsurperGeneratorSetup

java.lang.Object
  extended by org.org.usurper.setup.UsurperGeneratorSetup
All Implemented Interfaces:
IUsurperGeneratorSetup

public class UsurperGeneratorSetup
extends java.lang.Object
implements IUsurperGeneratorSetup

This is the mutable version of the class setting up the behaviour of the UsurperGenerator. Default behaviour is to fail if no handler is registered for a given property of the Bean.
Default type handlers are already registered (but can be overriden) for :


Default ArrayHandler and EnumHandler are the one provided with Usurper. You are not encouraged to modify these two handlers.
Default collections count callback returns the default value: 10.

Author:
pagregoire

Constructor Summary
UsurperGeneratorSetup()
          Instantiates a new mutable usurper generator setup using default configuration:
Using default property handlers for basic types (see default handlers' package), SQL types handlers ,and Collections handlers.
UsurperGeneratorSetup(IUsurperGeneratorSetup immutableSetup)
          Instantiates a new mutable usurper generator setup using the passed setup as a configuration.
 
Method Summary
 java.util.Map<ITargetDefinition,IHandler> getAllHandlers()
          Gets all handlers.
 ArrayHandler getArrayHandler()
          Gets the array handler.
 ICountCallback getCountCallback()
          Gets the count callback.
 EnumHandler getEnumHandler()
          Gets the enum handler.
 ImmutableUsurperGeneratorSetup getImmutable()
          Gets the immutable version of this mutable setup.
 OnMissingHandlers getOnMissingHandlers()
          Gets the on missing handlers behavior.
 AbstractPropertyTypeHandler getPropertyTypeHandler(PropertyTypeDefinition handledType)
          This method retrieves the Handler for Properties of a given java type.
 java.util.Map<PropertyTypeDefinition,AbstractPropertyTypeHandler> getPropertyTypeHandlersMap()
          Gets the property type handlers map.
 PropertyWritingMechanism getPropertyWritingMechanism()
          Gets the property writing mechanism behavior.
 AbstractSpecificPropertyHandler getSpecificPropertyHandler(SpecificPropertyDefinition specificPropertyDefinition)
          This method retrieves the Handler for a given Property of a given Class.
 java.util.Map<SpecificPropertyDefinition,AbstractSpecificPropertyHandler> getSpecificPropertyHandlersMap()
          Gets the specific property handlers map.
 boolean hasPropertyTypeHandler(PropertyTypeDefinition type)
          This method tests if a handler is registered for a given Java Type.
 boolean hasSpecificPropertyHandler(SpecificPropertyDefinition specificPropertyDefinition)
          This method tests if a handler is registered for a given Property of a given Class.
 void onMissingHandlers(OnMissingHandlers onMissingHandlers)
          Sets On missing handlers behavior using the enum type.
 void registerPropertyTypeHandler(AbstractPropertyTypeHandler typeHandler)
          This method allows the user to register a Handler for Properties of determinated java types.
 void registerPropertyTypeHandlers(java.util.Set<AbstractPropertyTypeHandler> typeHandlers)
          This method allows the user to register many Handlers for Properties of determinated java types.
 void registerSpecificPropertyHandler(AbstractSpecificPropertyHandler propertyHandler)
          This method allows the user to register a Handler for a given property.
 void setAllHandlers(java.util.Map<ITargetDefinition,IHandler> handlers)
          Sets All the handlers at once.
 void setArrayHandler(ArrayHandler arrayHandler)
          Sets the array handler.
 void setCountCallback(ICountCallback countCallback)
          Sets the count callback.
 void setEnumHandler(EnumHandler enumHandler)
          Sets the enum handler.
 void setOnMissingHandlers(java.lang.String onMissingHandlers)
          Sets On missing handlers behavior using the String values of the enum type.
 void setPropertyTypeHandlersMap(java.util.Map<PropertyTypeDefinition,AbstractPropertyTypeHandler> propertyTypeHandlersMap)
          Sets the property type handlers map.
 void setPropertyWritingMechanism(java.lang.String propertyWritingMechanism)
          Sets the property writing mechanism using the String values of the enum type.
 java.lang.String toString()
           
 java.lang.String toStringRepresentation()
          The implementation of this method must return a String representation of the setup.
 void usePropertyWritingMechanism(PropertyWritingMechanism propertyWritingMechanism)
          Sets the property writing mechanism using the enum type.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

UsurperGeneratorSetup

public UsurperGeneratorSetup()
Instantiates a new mutable usurper generator setup using default configuration:

UsurperGeneratorSetup

public UsurperGeneratorSetup(IUsurperGeneratorSetup immutableSetup)
Instantiates a new mutable usurper generator setup using the passed setup as a configuration.

Parameters:
immutableSetup - the immutable setup
Method Detail

getPropertyTypeHandlersMap

public java.util.Map<PropertyTypeDefinition,AbstractPropertyTypeHandler> getPropertyTypeHandlersMap()
Description copied from interface: IUsurperGeneratorSetup
Gets the property type handlers map.

Specified by:
getPropertyTypeHandlersMap in interface IUsurperGeneratorSetup
Returns:
the property type handlers map
See Also:
IUsurperGeneratorSetup.getPropertyTypeHandlersMap()

setPropertyTypeHandlersMap

public void setPropertyTypeHandlersMap(java.util.Map<PropertyTypeDefinition,AbstractPropertyTypeHandler> propertyTypeHandlersMap)
Sets the property type handlers map.

Parameters:
propertyTypeHandlersMap - the property type handlers map

getSpecificPropertyHandlersMap

public java.util.Map<SpecificPropertyDefinition,AbstractSpecificPropertyHandler> getSpecificPropertyHandlersMap()
Description copied from interface: IUsurperGeneratorSetup
Gets the specific property handlers map.

Specified by:
getSpecificPropertyHandlersMap in interface IUsurperGeneratorSetup
Returns:
the specific property handlers map
See Also:
IUsurperGeneratorSetup.getSpecificPropertyHandlersMap()

registerPropertyTypeHandler

public void registerPropertyTypeHandler(AbstractPropertyTypeHandler typeHandler)
This method allows the user to register a Handler for Properties of determinated java types.
Only one handler can be registered for a given java type at a time.
Registering a handler when one is already registered for a given type overrides the preceding one.

Parameters:
typeHandler - the handler to register (AbstractPropertyTypeHandler)

registerPropertyTypeHandlers

public void registerPropertyTypeHandlers(java.util.Set<AbstractPropertyTypeHandler> typeHandlers)
This method allows the user to register many Handlers for Properties of determinated java types.
Only one handler can be registered for a given java type at a time.
Registering a handler when one is already registered for a given type overrides the preceding one.

Parameters:
typeHandlers - the handler to register (Set<AbstractPropertyTypeHandler>)

hasPropertyTypeHandler

public boolean hasPropertyTypeHandler(PropertyTypeDefinition type)
Description copied from interface: IUsurperGeneratorSetup
This method tests if a handler is registered for a given Java Type.

Specified by:
hasPropertyTypeHandler in interface IUsurperGeneratorSetup
Parameters:
type - the property type definition
Returns:
true if one is registered, false otherwise
See Also:
IUsurperGeneratorSetup.hasPropertyTypeHandler(org.org.usurper.model.PropertyTypeDefinition)

getPropertyTypeHandler

public AbstractPropertyTypeHandler getPropertyTypeHandler(PropertyTypeDefinition handledType)
Description copied from interface: IUsurperGeneratorSetup
This method retrieves the Handler for Properties of a given java type.

Specified by:
getPropertyTypeHandler in interface IUsurperGeneratorSetup
Parameters:
handledType - the property type definition
Returns:
the registered handler or null if none is defined.
See Also:
IUsurperGeneratorSetup.getPropertyTypeHandler(org.org.usurper.model.PropertyTypeDefinition)

registerSpecificPropertyHandler

public void registerSpecificPropertyHandler(AbstractSpecificPropertyHandler propertyHandler)
This method allows the user to register a Handler for a given property.
Only one handler can be registered for a given property at a time.
Registering a handler when one is already registered for a given property overrides the preceding one.

Parameters:
propertyHandler - the handler to register (AbstractSpecificPropertyHandler)

getAllHandlers

public java.util.Map<ITargetDefinition,IHandler> getAllHandlers()
Description copied from interface: IUsurperGeneratorSetup
Gets all handlers.

Specified by:
getAllHandlers in interface IUsurperGeneratorSetup
Returns:
the all handlers
See Also:
IUsurperGeneratorSetup.getAllHandlers()

getImmutable

public ImmutableUsurperGeneratorSetup getImmutable()
Gets the immutable version of this mutable setup.

Returns:
the immutable

getArrayHandler

public ArrayHandler getArrayHandler()
Description copied from interface: IUsurperGeneratorSetup
Gets the array handler.

Specified by:
getArrayHandler in interface IUsurperGeneratorSetup
Returns:
the array handler
See Also:
IUsurperGeneratorSetup.getArrayHandler()

setArrayHandler

public void setArrayHandler(ArrayHandler arrayHandler)
Sets the array handler.

Parameters:
arrayHandler - the new array handler

getEnumHandler

public EnumHandler getEnumHandler()
Description copied from interface: IUsurperGeneratorSetup
Gets the enum handler.

Specified by:
getEnumHandler in interface IUsurperGeneratorSetup
Returns:
the enum handler
See Also:
IUsurperGeneratorSetup.getEnumHandler()

setEnumHandler

public void setEnumHandler(EnumHandler enumHandler)
Sets the enum handler.

Parameters:
enumHandler - the new enum handler

getOnMissingHandlers

public OnMissingHandlers getOnMissingHandlers()
Description copied from interface: IUsurperGeneratorSetup
Gets the on missing handlers behavior.

Specified by:
getOnMissingHandlers in interface IUsurperGeneratorSetup
Returns:
the on missing handlers
See Also:
IUsurperGeneratorSetup.getOnMissingHandlers()

setOnMissingHandlers

public void setOnMissingHandlers(java.lang.String onMissingHandlers)
Sets On missing handlers behavior using the String values of the enum type.

Parameters:
onMissingHandlers - the new on missing handlers

onMissingHandlers

public void onMissingHandlers(OnMissingHandlers onMissingHandlers)
Sets On missing handlers behavior using the enum type.

Parameters:
onMissingHandlers - the on missing handlers

getPropertyWritingMechanism

public PropertyWritingMechanism getPropertyWritingMechanism()
Description copied from interface: IUsurperGeneratorSetup
Gets the property writing mechanism behavior.

Specified by:
getPropertyWritingMechanism in interface IUsurperGeneratorSetup
Returns:
the property writing mechanism
See Also:
IUsurperGeneratorSetup.getPropertyWritingMechanism()

setPropertyWritingMechanism

public void setPropertyWritingMechanism(java.lang.String propertyWritingMechanism)
Sets the property writing mechanism using the String values of the enum type.

Parameters:
propertyWritingMechanism - the new property writing mechanism

usePropertyWritingMechanism

public void usePropertyWritingMechanism(PropertyWritingMechanism propertyWritingMechanism)
Sets the property writing mechanism using the enum type.

Parameters:
propertyWritingMechanism - the property writing mechanism

getCountCallback

public ICountCallback getCountCallback()
Description copied from interface: IUsurperGeneratorSetup
Gets the count callback.

Specified by:
getCountCallback in interface IUsurperGeneratorSetup
Returns:
the count callback
See Also:
IUsurperGeneratorSetup.getCountCallback()

setCountCallback

public void setCountCallback(ICountCallback countCallback)
Sets the count callback.

Parameters:
countCallback - the new count callback

hasSpecificPropertyHandler

public boolean hasSpecificPropertyHandler(SpecificPropertyDefinition specificPropertyDefinition)
Description copied from interface: IUsurperGeneratorSetup
This method tests if a handler is registered for a given Property of a given Class.

Specified by:
hasSpecificPropertyHandler in interface IUsurperGeneratorSetup
Parameters:
specificPropertyDefinition - the specific property definition
Returns:
true if one is registered, false otherwise
See Also:
IUsurperGeneratorSetup.hasSpecificPropertyHandler(org.org.usurper.model.SpecificPropertyDefinition)

getSpecificPropertyHandler

public AbstractSpecificPropertyHandler getSpecificPropertyHandler(SpecificPropertyDefinition specificPropertyDefinition)
Description copied from interface: IUsurperGeneratorSetup
This method retrieves the Handler for a given Property of a given Class.

Specified by:
getSpecificPropertyHandler in interface IUsurperGeneratorSetup
Parameters:
specificPropertyDefinition - the specific property definition
Returns:
the registered property handler or null if none is defined.
See Also:
IUsurperGeneratorSetup.getSpecificPropertyHandler(org.org.usurper.model.SpecificPropertyDefinition)

setAllHandlers

public void setAllHandlers(java.util.Map<ITargetDefinition,IHandler> handlers)
Sets All the handlers at once.

Parameters:
handlers - the handlers

toStringRepresentation

public java.lang.String toStringRepresentation()
Description copied from interface: IUsurperGeneratorSetup
The implementation of this method must return a String representation of the setup.

Specified by:
toStringRepresentation in interface IUsurperGeneratorSetup
Returns:
the String representation of the setup.
See Also:
IUsurperGeneratorSetup.toStringRepresentation()

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object
See Also:
Object.toString()


Copyright © 2008. All Rights Reserved.