org.exolab.castor.builder.conflictresolution

Interface ClassNameCRStrategy

Known Implementing Classes:
BaseClassNameCRStrategy, InformViaLogClassNameCRStrategy, WarningViaDialogClassNameCRStrategy

public interface ClassNameCRStrategy

Strategy pattern for dealing with class name conflicts during source code generation. The various implementations of this stragtegy will implement individual approaches for dealing with such a naming collision.
Author:
Werner Guttmann
Since:
1.1

Method Summary

SGStateInfo
dealWithClassNameConflict(SGStateInfo state, ClassInfo newClassInfo, JClass conflict)
Implements a specific strategy for dealing with class name conflicts.
boolean
dealWithFileOverwrite(String filename)
Implements a specific strategy for dealing with the fact that -- for a given file name -- an artifact with the same name already exists.
String
getName()
Returns the name of this strategy.
void
setConsoleDialog(ConsoleDialog dialog)
Sets the ConsoleDialog instance to use (if required).
void
setSingleClassGenerator(SingleClassGenerator generator)
Injects the SingleClassGenerator instance that actually is calling a method of this strategy.

Method Details

dealWithClassNameConflict

public SGStateInfo dealWithClassNameConflict(SGStateInfo state,
                                             ClassInfo newClassInfo,
                                             JClass conflict)
Implements a specific strategy for dealing with class name conflicts.
Parameters:
state - The current source generator state.
newClassInfo - The CLassInfo for the new class to be generated.
conflict - The JClass instance representing the potential conflict.
Returns:
the source generator state, as modified by the decision.

dealWithFileOverwrite

public boolean dealWithFileOverwrite(String filename)
Implements a specific strategy for dealing with the fact that -- for a given file name -- an artifact with the same name already exists.
Parameters:
filename - The name of the file to be overwritten.
Returns:
True of the file should be overwritten.

getName

public String getName()
Returns the name of this strategy.
Returns:
The name of this strategy.

setConsoleDialog

public void setConsoleDialog(ConsoleDialog dialog)
Sets the ConsoleDialog instance to use (if required).
Parameters:
dialog - the ConsoleDialog instance to use (if required).

setSingleClassGenerator

public void setSingleClassGenerator(SingleClassGenerator generator)
Injects the SingleClassGenerator instance that actually is calling a method of this strategy.
Parameters:
generator - The calling SingleClassGenerator

Intalio Inc. (C) 1999-2008. All rights reserved http://www.intalio.com