/* * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. */ package codetoanalyze.java.litho; import com.facebook.litho.Component; import com.facebook.litho.annotations.Prop; import java.util.ArrayList; import java.util.List; /** varArg test */ class VarArgPropComponent extends Component { @Prop(varArg = "prop") List props; public Builder create() { return new Builder(); } static class Builder extends Component.Builder { VarArgPropComponent mVarArgPropComponent; public Builder prop(Object prop) { if (prop == null) { return this; } if (this.mVarArgPropComponent.props == null) { this.mVarArgPropComponent.props = new ArrayList(); } this.mVarArgPropComponent.props.add(prop); return this; } public Builder propAttr(Object prop) { if (prop == null) { return this; } if (this.mVarArgPropComponent.props == null) { this.mVarArgPropComponent.props = new ArrayList(); } this.mVarArgPropComponent.props.add(prop); return this; } public Builder propsAttr(List props) { if (props == null) { return this; } if (this.mVarArgPropComponent.props == null || this.mVarArgPropComponent.props.isEmpty()) { this.mVarArgPropComponent.props = props; } else { this.mVarArgPropComponent.props.addAll(props); } return this; } public Builder props(List props) { if (props == null) { return this; } if (this.mVarArgPropComponent.props == null || this.mVarArgPropComponent.props.isEmpty()) { this.mVarArgPropComponent.props = props; } else { this.mVarArgPropComponent.props.addAll(props); } return this; } public VarArgPropComponent build() { return mVarArgPropComponent; } @Override public Builder getThis() { return this; } } }