Skip to content
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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

[Case 1] Proposed solution #3

wants to merge 1 commit into from

Conversation

grimsa
Copy link
Owner

@grimsa grimsa commented Jul 14, 2022

Changes are based on this suggestion

…bject creation into a separate branch in the package hierarchy
Comment on lines +13 to +19
private final BiFunction<RoofFace, PvModuleDefinition, LayoutSpecification> layoutSpecificationConstructor;

public DefaultPvModuleLayouts(
BiFunction<RoofFace, PvModuleDefinition, LayoutSpecification> layoutSpecificationConstructor
) {
this.layoutSpecificationConstructor = layoutSpecificationConstructor;
}
Copy link
Owner Author

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

Comment on lines +1 to +13
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);
}
}
Copy link
Owner Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant