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 (
36+ @ JsonProperty ("feed_id" ) String source ,
37+ @ JsonProperty ("target_id" ) String target ) {
38+ this (source , target , null );
2439 }
2540
2641 public String getSource () {
@@ -31,24 +46,33 @@ public String getTarget() {
3146 return this .target ;
3247 }
3348
49+ @ JsonProperty ("activity_copy_limit" )
50+ @ JsonInclude (JsonInclude .Include .NON_NULL )
51+ public Integer getActivityCopyLimit () {
52+ return this .activityCopyLimit ;
53+ }
54+
3455 @ Override
3556 public boolean equals (Object o ) {
3657 if (this == o ) return true ;
3758 if (o == null || getClass () != o .getClass ()) return false ;
3859 FollowRelation that = (FollowRelation ) o ;
39- return Objects .equals (source , that .source ) && Objects .equals (target , that .target );
60+ return Objects .equals (source , that .source )
61+ && Objects .equals (target , that .target )
62+ && Objects .equals (activityCopyLimit , that .activityCopyLimit );
4063 }
4164
4265 @ Override
4366 public int hashCode () {
44- return Objects .hash (source , target );
67+ return Objects .hash (source , target , activityCopyLimit );
4568 }
4669
4770 @ Override
4871 public String toString () {
4972 return MoreObjects .toStringHelper (this )
5073 .add ("source" , this .source )
5174 .add ("target" , this .target )
75+ .add ("activityCopyLimit" , this .activityCopyLimit )
5276 .toString ();
5377 }
5478}
0 commit comments