Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/hogoww/visitorGenerator
Visitor generator for any class hierarchy
https://github.com/hogoww/visitorGenerator
Last synced: about 2 months ago
JSON representation
Visitor generator for any class hierarchy
- Host: GitHub
- URL: https://github.com/hogoww/visitorGenerator
- Owner: hogoww
- License: mit
- Created: 2022-05-07T14:11:25.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2022-05-08T11:04:03.000Z (over 2 years ago)
- Last Synced: 2024-10-31T13:46:12.201Z (3 months ago)
- Language: Smalltalk
- Size: 15.6 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-pharo - VisitorGenerator - Generates basic visitor & visit methods for any Pharo classes hierarchy. (Code generation)
README
# VisitorGenerator
Quick utility to generate diverse kinds of base visitors for an object hierarchy.```VisitorsGenerator generateForRootClass: YourHierarchyClassRoot```
Generates multiple kinds of base visitor to inherit from to define visitor for a class hierarchy.
- AbstractVisitor: Only defines an empty visit of each object
- SubclassResponsibilityVisitor: Defines each and every visit as a subclassResponsibility method.
Enforces the definition of each method to be able to use the visitor for the kind of objects encountered.
- SuperclassVisitor: Defines each visit will use the method for its super class as well by default.
For example, I have several RBNodes that have all the same behavior from the point of view of the visitor, I only need to override the common superclass.I also add the `acceptVisitor:` method on each class of the hierarchy.