Created
October 13, 2015 03:45
-
-
Save elucash/258cae1e7ecc31c02340 to your computer and use it in GitHub Desktop.
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
import com.google.common.collect.ImmutableList; | |
import com.google.common.base.Optional; | |
import org.immutables.value.Value; | |
interface Step {} | |
@Value.Immutable | |
interface StepsExtends { | |
ImmutableList<Step> steps(); | |
public class Builder extends ImmutableStepsExtends.Builder { | |
public Builder addStep(Optional<Step> step) { | |
if (step.isPresent()) { | |
addSteps(step.get()); | |
} | |
return this; | |
} | |
} | |
} | |
@Value.Immutable | |
interface StepsSuper { | |
ImmutableList<Step> steps(); | |
public class Builder { | |
public ImmutableStepsSuper.Builder addStep(Optional<Step> step) { | |
ImmutableStepsSuper.Builder builder = (ImmutableStepsSuper.Builder) this; | |
if (step.isPresent()) { | |
builder.addSteps(step.get()); | |
} | |
return builder; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment