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

Modify extractCompasPrivate method to respect good developpement practices #249

Closed
gleizesDor opened this issue Feb 28, 2023 · 0 comments
Closed
Labels
enhancement New feature or request

Comments

@gleizesDor
Copy link
Contributor

org.lfenergy.compas.sct.commons.scl.PrivateService#extractCompasPrivate(org.lfenergy.compas.scl2007b4.model.TBaseElement, java.lang.Class)

This method as a simple goal : filter a list to return the matching element
So there is no need to create :
2 private methods
2 separated lists
etc...

An exemple would be :

private TCompasICDHeader gettCompasICDHeader(TIED tied) {
        return tied.getPrivate()
                .stream()
                .filter(tPrivate -> "COMPAS-ICDHeader".equals(tPrivate.getType()))
                .map(TAnyContentFromOtherNamespace::getContent)
                .flatMap(Collection::stream)
                .filter(JAXBElement.class::isInstance)
                .map(JAXBElement.class::cast)
                .map(JAXBElement::getValue)
                .map(TCompasICDHeader.class::cast)
                .findFirst()
                .orElseThrow();
    }
@gleizesDor gleizesDor added the enhancement New feature or request label Feb 28, 2023
gleizesDor added a commit that referenced this issue Jun 7, 2023
…veloppement practices

Signed-off-by: gleizesDor <115622893+gleizesDor@users.noreply.github.com>
gleizesDor added a commit that referenced this issue Jun 20, 2023
…veloppement practices

Signed-off-by: gleizesDor <115622893+gleizesDor@users.noreply.github.com>
gleizesDor added a commit that referenced this issue Jun 20, 2023
…veloppement practices

Signed-off-by: gleizesDor <115622893+gleizesDor@users.noreply.github.com>
gleizesDor added a commit that referenced this issue Jun 20, 2023
…veloppement practices

Signed-off-by: gleizesDor <115622893+gleizesDor@users.noreply.github.com>
gleizesDor added a commit that referenced this issue Jun 21, 2023
…veloppement practices

Signed-off-by: gleizesDor <115622893+gleizesDor@users.noreply.github.com>
gleizesDor added a commit that referenced this issue Jun 21, 2023
…veloppement practices

Signed-off-by: gleizesDor <115622893+gleizesDor@users.noreply.github.com>
gleizesDor added a commit that referenced this issue Jun 21, 2023
…vate_method_to_respect_good_developpement_practices

refactor(#249): Modify extractCompasPrivate method to respect good de…
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
Status: Done
Development

No branches or pull requests

1 participant