1515 * @param <T> - String/Boolean/Numeric Type
1616 */
1717public final class EvalDetail <T > implements Serializable {
18-
19- private static final String NO_VARIATION = "NE" ;
20-
2118 private final T variation ;
2219
23- private final String id ;
24-
2520 private final String reason ;
2621
2722 private final String name ;
2823
2924 private final String keyName ;
3025
3126 private EvalDetail (T variation ,
32- String id ,
3327 String reason ,
3428 String keyName ,
3529 String name ) {
3630 this .variation = variation ;
37- this .id = id ;
3831 this .reason = reason ;
3932 this .keyName = keyName ;
4033 this .name = name ;
@@ -43,27 +36,25 @@ private EvalDetail(T variation,
4336 /**
4437 * build method, this method is only for internal use
4538 *
46- * @param variation
47- * @param id
48- * @param reason
49- * @param keyName
50- * @param name
39+ * @param variation the result of flag value
40+ * @param reason main factor that influenced the flag evaluation value
41+ * @param keyName key name of the flag
42+ * @param name name of the flag
5143 * @param <T> String/Boolean/Numeric Type
5244 * @return an EvalDetail
5345 */
5446 public static <T > EvalDetail <T > of (T variation ,
55- String id ,
5647 String reason ,
5748 String keyName ,
5849 String name ) {
59- return new EvalDetail <>(variation , id , reason , keyName , name );
50+ return new EvalDetail <>(variation , reason , keyName , name );
6051 }
6152
6253 /**
6354 * build the method from a json string, this method is only for internal use
6455 *
65- * @param json
66- * @param cls
56+ * @param json json string of an EvalDetail
57+ * @param cls raw type of flag value
6758 * @param <T> String/Boolean/Numeric Type
6859 * @return an EvalDetail
6960 */
@@ -82,16 +73,6 @@ public T getVariation() {
8273 return variation ;
8374 }
8475
85- /**
86- * The id of the returned value within the flag's list of variations
87- * In fact this value is an index, this value is only for internal use
88- *
89- * @return a integer value
90- */
91- public String getId () {
92- return id ;
93- }
94-
9576 /**
9677 * get the reason that evaluate the flag value.
9778 *
@@ -119,16 +100,6 @@ public String getKeyName() {
119100 return keyName ;
120101 }
121102
122- /**
123- * Returns true if the flag evaluation returned a good value,
124- * false if the default value returned
125- *
126- * @return Returns true if the flag evaluation returned a good value, false if the default value returned
127- */
128- public boolean isSuccess () {
129- return !id .equals (NO_VARIATION );
130- }
131-
132103 /**
133104 * object converted to json string
134105 *
@@ -143,27 +114,21 @@ public boolean equals(Object o) {
143114 if (this == o ) return true ;
144115 if (o == null || getClass () != o .getClass ()) return false ;
145116 EvalDetail <?> that = (EvalDetail <?>) o ;
146- return id == that . id && Objects .equals (variation , that .variation ) && Objects .equals (reason , that .reason ) && Objects .equals (name , that .name ) && Objects .equals (keyName , that .keyName );
117+ return Objects .equals (variation , that .variation ) && Objects .equals (reason , that .reason ) && Objects .equals (name , that .name ) && Objects .equals (keyName , that .keyName );
147118 }
148119
149120 @ Override
150121 public int hashCode () {
151- return Objects .hash (variation , id , reason , name , keyName );
122+ return Objects .hash (variation , reason , name , keyName );
152123 }
153124
154125 @ Override
155126 public String toString () {
156127 return MoreObjects .toStringHelper (this )
157128 .add ("variation" , variation )
158- .add ("id" , id )
159129 .add ("reason" , reason )
160130 .add ("name" , name )
161131 .add ("keyName" , keyName )
162132 .toString ();
163133 }
164-
165- public FlagState <T > toFlagState () {
166- return FlagState .of (this );
167- }
168-
169134}
0 commit comments