11package io .getstream .core .models ;
22
3+ import static com .google .common .base .Preconditions .checkArgument ;
34import static com .google .common .base .Preconditions .checkNotNull ;
45
56import com .fasterxml .jackson .annotation .JsonCreator ;
67import com .fasterxml .jackson .annotation .JsonIgnoreProperties ;
8+ import com .fasterxml .jackson .annotation .JsonInclude ;
79import com .fasterxml .jackson .annotation .JsonProperty ;
810import com .google .common .base .MoreObjects ;
911import java .util .Objects ;
1214public final class FollowRelation {
1315 private final String source ;
1416 private final String target ;
17+ private final Integer activityCopyLimit ;
1518
1619 @ JsonCreator
1720 public FollowRelation (
18- @ JsonProperty ("feed_id" ) String source , @ JsonProperty ("target_id" ) String target ) {
21+ @ JsonProperty ("feed_id" ) String source ,
22+ @ JsonProperty ("target_id" ) String target ,
23+ @ JsonProperty ("activity_copy_limit" ) Integer activityCopyLimit ) {
1924 checkNotNull (source , "FollowRelation 'source' field required" );
2025 checkNotNull (target , "FollowRelation 'target' field required" );
26+ if (activityCopyLimit != null ) {
27+ checkArgument (activityCopyLimit >= 0 , "Activity copy limit must be non negative" );
28+ }
2129
2230 this .source = source ;
2331 this .target = target ;
32+ this .activityCopyLimit = activityCopyLimit ;
33+ }
34+
35+ public FollowRelation (String source , String target ) {
36+ this (source , target , null );
2437 }
2538
2639 public String getSource () {
@@ -31,24 +44,33 @@ public String getTarget() {
3144 return this .target ;
3245 }
3346
47+ @ JsonProperty ("activity_copy_limit" )
48+ @ JsonInclude (JsonInclude .Include .NON_NULL )
49+ public Integer getActivityCopyLimit () {
50+ return this .activityCopyLimit ;
51+ }
52+
3453 @ Override
3554 public boolean equals (Object o ) {
3655 if (this == o ) return true ;
3756 if (o == null || getClass () != o .getClass ()) return false ;
3857 FollowRelation that = (FollowRelation ) o ;
39- return Objects .equals (source , that .source ) && Objects .equals (target , that .target );
58+ return Objects .equals (source , that .source )
59+ && Objects .equals (target , that .target )
60+ && Objects .equals (activityCopyLimit , that .activityCopyLimit );
4061 }
4162
4263 @ Override
4364 public int hashCode () {
44- return Objects .hash (source , target );
65+ return Objects .hash (source , target , activityCopyLimit );
4566 }
4667
4768 @ Override
4869 public String toString () {
4970 return MoreObjects .toStringHelper (this )
5071 .add ("source" , this .source )
5172 .add ("target" , this .target )
73+ .add ("activityCopyLimit" , this .activityCopyLimit )
5274 .toString ();
5375 }
5476}
0 commit comments