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.
70 lines
1.5 KiB
70 lines
1.5 KiB
5 years ago
|
/*
|
||
|
* 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 com.facebook.litho.annotations.ResType;
|
||
|
|
||
|
/**
|
||
|
* using @Prop(resType = ..) allows you to set the Prop with any of .propname, .propnameRes, or
|
||
|
* .propnameAttr
|
||
|
*/
|
||
|
class ResPropComponent extends Component {
|
||
|
|
||
|
@Prop(resType = ResType.SOME)
|
||
|
Object prop; // implicitly non-optional with resType
|
||
|
|
||
|
public Builder create() {
|
||
|
return new Builder();
|
||
|
}
|
||
|
|
||
|
static class Builder extends Component.Builder<Builder> {
|
||
|
|
||
|
ResPropComponent mResPropComponent;
|
||
|
|
||
|
public Builder prop(Object o) {
|
||
|
this.mResPropComponent.prop = o;
|
||
|
return this;
|
||
|
}
|
||
|
|
||
|
public Builder propRes(Object o) {
|
||
|
this.mResPropComponent.prop = o;
|
||
|
return this;
|
||
|
}
|
||
|
|
||
|
public Builder propAttr(Object o) {
|
||
|
this.mResPropComponent.prop = o;
|
||
|
return this;
|
||
|
}
|
||
|
|
||
|
public Builder propDip(Object o) {
|
||
|
this.mResPropComponent.prop = o;
|
||
|
return this;
|
||
|
}
|
||
|
|
||
|
public Builder propPx(Object o) {
|
||
|
this.mResPropComponent.prop = o;
|
||
|
return this;
|
||
|
}
|
||
|
|
||
|
public Builder propSp(Object o) {
|
||
|
this.mResPropComponent.prop = o;
|
||
|
return this;
|
||
|
}
|
||
|
|
||
|
public ResPropComponent build() {
|
||
|
return mResPropComponent;
|
||
|
}
|
||
|
|
||
|
@Override
|
||
|
public Builder getThis() {
|
||
|
return this;
|
||
|
}
|
||
|
}
|
||
|
}
|