Class WarningViaDialogClassNameCRStrategy
java.lang.Object
org.exolab.castor.builder.conflictresolution.BaseClassNameCRStrategy
org.exolab.castor.builder.conflictresolution.WarningViaDialogClassNameCRStrategy
- All Implemented Interfaces:
ClassNameCRStrategy
public final class WarningViaDialogClassNameCRStrategy
extends BaseClassNameCRStrategy
implements ClassNameCRStrategy
An implementation of
ClassNameCRStrategy
that reports any conflict
notifications to a console dialog, asking the user whether to stop code
generation (as the conflict is not acceptable), or whether to proceed by
overwriting an already existing class.- Since:
- 1.1
- Author:
- Werner Guttmann
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionCreates an instance of this name conflict resolution strategy, that will use the specifiedConsoleDialog
instance to emit warnings to the user and ask about an approach to deal with them. -
Method Summary
Modifier and TypeMethodDescriptiondealWithClassNameConflict
(SGStateInfo state, ClassInfo newClassInfo, JClass conflict) Handle a class name conflict between newClassInfo and conflict.boolean
dealWithFileOverwrite
(String filename) Presents the user with a console dialog, asking for confirmation whether an existing file should be overwritten (or not).protected ConsoleDialog
Returns theConsoleDialog
instance in use.getName()
Returns the name of the strategy.void
setConsoleDialog
(ConsoleDialog dialog) Sets the console dialog to use with this strategy.Methods inherited from class org.exolab.castor.builder.conflictresolution.BaseClassNameCRStrategy
getSingleClassGenerator, setSingleClassGenerator
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface org.exolab.castor.builder.conflictresolution.ClassNameCRStrategy
setSingleClassGenerator
-
Field Details
-
NAME
Name of this strategy.- See Also:
-
-
Constructor Details
-
WarningViaDialogClassNameCRStrategy
public WarningViaDialogClassNameCRStrategy()Creates an instance of this name conflict resolution strategy, that will use the specifiedConsoleDialog
instance to emit warnings to the user and ask about an approach to deal with them.
-
-
Method Details
-
dealWithClassNameConflict
public SGStateInfo dealWithClassNameConflict(SGStateInfo state, ClassInfo newClassInfo, JClass conflict) Handle a class name conflict between newClassInfo and conflict.- Specified by:
dealWithClassNameConflict
in interfaceClassNameCRStrategy
- Parameters:
state
- SourceGeneration statenewClassInfo
- ClassInfo for the new classconflict
- JClass for the existing class- Returns:
- the provided source generator state, as modified by the strategy
- See Also:
-
getName
Returns the name of the strategy.- Specified by:
getName
in interfaceClassNameCRStrategy
- Returns:
- the name of the strategy.
- See Also:
-
setConsoleDialog
Sets the console dialog to use with this strategy.- Specified by:
setConsoleDialog
in interfaceClassNameCRStrategy
- Parameters:
dialog
- the console dialog to use with this strategy.
-
dealWithFileOverwrite
Presents the user with a console dialog, asking for confirmation whether an existing file should be overwritten (or not).- Specified by:
dealWithFileOverwrite
in interfaceClassNameCRStrategy
- Parameters:
filename
- the filename to potentially overwrite.- Returns:
- whether or not the file should be overwritten.
- See Also:
-
getConsoleDialog
Returns theConsoleDialog
instance in use.- Returns:
- the
ConsoleDialog
used for output/feedback gathering.
-