-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Case 1] Proposed solution #3
base: main
Are you sure you want to change the base?
Conversation
…bject creation into a separate branch in the package hierarchy
private final BiFunction<RoofFace, PvModuleDefinition, LayoutSpecification> layoutSpecificationConstructor; | ||
|
||
public DefaultPvModuleLayouts( | ||
BiFunction<RoofFace, PvModuleDefinition, LayoutSpecification> layoutSpecificationConstructor | ||
) { | ||
this.layoutSpecificationConstructor = layoutSpecificationConstructor; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If the constructor required more parameters, we'd probably have to introduce something like this
interface LayoutSpecificationConstructor {
LayoutSpecification construct(
RoofFace roofFace,
PvModuleDefinition pvModuleDefinition,
Object someOtherArg1,
Object someOtherArg2
);
}
probably as a nested interface inside LayoutSpecification
package com.company.appconfig; | ||
|
||
import com.company.app.PvModuleLayouts; | ||
import com.company.app.pvmodulelayouts.DefaultPvModuleLayouts; | ||
import com.company.app.pvmodulelayouts.layoutspecification.RoofSlopeDependentLayoutSpecification; | ||
|
||
// @Configuration | ||
public class Main { | ||
// @Bean | ||
public PvModuleLayouts pvModuleLayouts() { | ||
return new DefaultPvModuleLayouts(RoofSlopeDependentLayoutSpecification::new); | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This code that would plug everything together goes into a parallel package hierarchy
Changes are based on this suggestion