Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
breaking: FactoryMachine.nameBuildableComponents use Type
This commit is preparing the field to be able to request the factory using types. As names are from now on a couple (String, Type), factory machines might be requested using types instead of classes. Migration has to be done in all sub-classes of FactoryMachine which are overriding the nameBuildableComponents method. There is several cases: - Either in the method you are using the `componentClass` parameter to do some equality assertions with other classes like that: ```java if (componentClass == SomeClass.class) { ... } ``` In that case the only thing to do is to change the type of the parameter from `Class<T>` to Type, it should work directly as Type is a super type of Class (you might also refactor the parameter name from componentClass to componentType, but this is up to you). - Or in the method you are using the `componentClass` parameter to compare it to other classes using `Class.isassignableFrom` method (in either way, `componentClass.isAssignableFrom(SomeClass.class)` or `SomeClass.class.isAssignableFrom(componentClass)`). In that case you have to replace the use of `Class.isAssignableFrom` to the static method `Types.isAssignableFrom`. - Or last but not least, you are doing some comparisons using `isAssignableFrom` like in the second point, but not on direct classes, but on classes of names, using `Name.getClazz()`. So you have to rely on names types instead of names classes, and do a migration like this: ```java componentClass.isAssignableFrom(aName.getClazz()) ``` becomes ```java Types.isAssignableFrom(componentType, aName.getType()) ```
- Loading branch information
Showing
12 changed files
with
36 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters