1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package org.apache.syncope.common.lib.types;
20
21 import org.apache.commons.lang3.builder.EqualsBuilder;
22 import org.apache.commons.lang3.builder.HashCodeBuilder;
23 import org.apache.syncope.common.lib.BaseBean;
24
25 public class SRARoutePredicate implements BaseBean {
26
27 private static final long serialVersionUID = -635785645207375128L;
28
29 public static class Builder {
30
31 private final SRARoutePredicate instance = new SRARoutePredicate();
32
33 public Builder negate() {
34 instance.setNegate(true);
35 return this;
36 }
37
38 public Builder cond(final SRARoutePredicateCond cond) {
39 instance.setCond(cond);
40 return this;
41 }
42
43 public Builder factory(final SRARoutePredicateFactory factory) {
44 instance.setFactory(factory);
45 return this;
46 }
47
48 public Builder args(final String args) {
49 instance.setArgs(args);
50 return this;
51 }
52
53 public SRARoutePredicate build() {
54 return instance;
55 }
56 }
57
58 private boolean negate;
59
60 private SRARoutePredicateCond cond;
61
62 private SRARoutePredicateFactory factory;
63
64 private String args;
65
66 public boolean isNegate() {
67 return negate;
68 }
69
70 public void setNegate(final boolean negate) {
71 this.negate = negate;
72 }
73
74 public SRARoutePredicateCond getCond() {
75 return cond;
76 }
77
78 public void setCond(final SRARoutePredicateCond cond) {
79 this.cond = cond;
80 }
81
82 public SRARoutePredicateFactory getFactory() {
83 return factory;
84 }
85
86 public void setFactory(final SRARoutePredicateFactory factory) {
87 this.factory = factory;
88 }
89
90 public String getArgs() {
91 return args;
92 }
93
94 public void setArgs(final String args) {
95 this.args = args;
96 }
97
98 @Override
99 public int hashCode() {
100 return new HashCodeBuilder().
101 append(cond).
102 append(factory).
103 append(args).
104 build();
105 }
106
107 @Override
108 public boolean equals(final Object obj) {
109 if (this == obj) {
110 return true;
111 }
112 if (obj == null) {
113 return false;
114 }
115 if (getClass() != obj.getClass()) {
116 return false;
117 }
118 final SRARoutePredicate other = (SRARoutePredicate) obj;
119 return new EqualsBuilder().
120 append(cond, other.cond).
121 append(factory, other.factory).
122 append(args, other.args).
123 build();
124 }
125
126 @Override
127 public String toString() {
128 return "GatewayPredicate{"
129 + "negate=" + negate
130 + ", cond=" + cond
131 + ", factory=" + factory
132 + ", args=" + args
133 + '}';
134 }
135 }