You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
55 lines
1.1 KiB
55 lines
1.1 KiB
/*
|
|
* 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;
|
|
|
|
public class MyComponent extends Component {
|
|
@Prop Object prop1; // implicitly non-optional
|
|
|
|
@Prop(optional = true)
|
|
Object prop2; // explicitly optional
|
|
|
|
@Prop(optional = false)
|
|
Object prop3; // explicitly non-optional
|
|
|
|
Object nonProp;
|
|
|
|
public Builder create() {
|
|
return new Builder();
|
|
}
|
|
|
|
public static class Builder extends Component.Builder<Builder> {
|
|
MyComponent mMyComponent;
|
|
|
|
public Builder prop1(Object o) {
|
|
this.mMyComponent.prop1 = o;
|
|
return this;
|
|
}
|
|
|
|
public Builder prop2(Object o) {
|
|
this.mMyComponent.prop2 = o;
|
|
return this;
|
|
}
|
|
|
|
public Builder prop3(Object o) {
|
|
this.mMyComponent.prop3 = o;
|
|
return this;
|
|
}
|
|
|
|
public MyComponent build() {
|
|
return mMyComponent;
|
|
}
|
|
|
|
@Override
|
|
public Builder getThis() {
|
|
return this;
|
|
}
|
|
}
|
|
}
|