Created
December 14, 2016 11:22
-
-
Save iocanel/8445913bc84724cf811dc5d0c28d96b9 to your computer and use it in GitHub Desktop.
Edit the last container of a pod.
This file contains hidden or 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
PodTemplateSpecBuilder b = new PodTemplateSpecBuilder().accept(new PathAwareTypedVisitor<ContainerBuilder, PodSpecBuilder>() { | |
@Override | |
public void visit(ContainerBuilder element) { | |
PodSpecBuilder podSpecBuilder = getParent(); | |
Container last = podSpecBuilder.getContainers().stream().reduce((first, second) -> second).orElseThrow(IllegalStateException::new); | |
if (last.getName().equals(element.getName())) { | |
//edit as you please | |
} | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment