Class UpdateListenerAdapter
- java.lang.Object
-
- ru.vyarus.yaml.updater.listen.UpdateListenerAdapter
-
- All Implemented Interfaces:
UpdateListener
public class UpdateListenerAdapter extends java.lang.Object implements UpdateListener
Dummy implementation ofUpdateListenerto simplify selective implementation. Also used when no listener configured.- Since:
- 17.08.2021
-
-
Constructor Summary
Constructors Constructor Description UpdateListenerAdapter()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidbackupCreated(java.io.File backup)Called after backup file creation (only if required).voidconfigured(UpdateConfig config)Called just before start to provide access to configuration actually used by merger (catching configuration errors).voidcurrentConfigParsed(CmtTree tree, StructTree struct)Parsed current configuration with two parsers (preserving comments and snakeyaml).voidmerged(CmtTree result)Called just after the merge, but before final validation.voidupdateConfigParsed(CmtTree tree, StructTree struct)Parsed new configuration with two parsers (preserving comments and snakeyaml).voidvalidated(StructTree result)Called after result validation.
-
-
-
Method Detail
-
configured
public void configured(UpdateConfig config)
Description copied from interface:UpdateListenerCalled just before start to provide access to configuration actually used by merger (catching configuration errors).- Specified by:
configuredin interfaceUpdateListener- Parameters:
config- configuration instance
-
updateConfigParsed
public void updateConfigParsed(CmtTree tree, StructTree struct)
Description copied from interface:UpdateListenerParsed new configuration with two parsers (preserving comments and snakeyaml). At this point trees were validated to be equal (merger self-control mechanism).Environment variables already applied.
Passed structure tree would be used later for the final result validation, so be careful with modifications.
If you going to modify tree then modify both trees accordingly (otherwise final validation would fail)
- Specified by:
updateConfigParsedin interfaceUpdateListener- Parameters:
tree- comments treestruct- structure tree- See Also:
for creating new comment nodes,for creating new struct nodes
-
currentConfigParsed
public void currentConfigParsed(CmtTree tree, StructTree struct)
Description copied from interface:UpdateListenerParsed current configuration with two parsers (preserving comments and snakeyaml). At this point trees were validated to be equal (merger self-control mechanism).Configured deletions already applied.
Method would not be called if current configuration does not exist.
Passed structure tree would be used later for the final result validation, so be careful with modifications.
NOTE: The same
CmtTreeinstance used for updates and would be written to file after merge.If you going to modify tree then modify both trees accordingly (otherwise final validation would fail)
- Specified by:
currentConfigParsedin interfaceUpdateListener- Parameters:
tree- comments treestruct- structure tree- See Also:
for creating new comment nodes,for creating new struct nodes
-
merged
public void merged(CmtTree result)
Description copied from interface:UpdateListenerCalled just after the merge, but before final validation. Provided structure would be written to file after validation.NOTE: validation would detect modifications and deny entire update. If you want to manually correct the resulted tree then disable result validation (it would still read the resulted file to make sure it's semantically correct, but would not compare with old/new files).
- Specified by:
mergedin interfaceUpdateListener- Parameters:
result- merge result- See Also:
for creating new comment nodes
-
validated
public void validated(StructTree result)
Description copied from interface:UpdateListenerCalled after result validation. Not called if validation disabled.At this point merged file was already saved. Passed model is a read of just merged file for validation. Any changes to this model will not take any effect. Method may be used for additional validations.
- Specified by:
validatedin interfaceUpdateListener- Parameters:
result- parsed merged file (with snakeyaml)
-
backupCreated
public void backupCreated(java.io.File backup)
Description copied from interface:UpdateListenerCalled after backup file creation (only if required).- Specified by:
backupCreatedin interfaceUpdateListener- Parameters:
backup- created backup file for current configuration
-
-