1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16 package org.kuali.rice.core.api.criteria;
17
18 import org.kuali.rice.core.api.mo.ModelBuilder;
19
20 import java.io.Serializable;
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50 @Deprecated
51 public class LookupCustomizer<T> {
52
53
54 private final Transform<Predicate,Predicate> predicateTransform;
55 private final Transform<T, T> resultTransform;
56
57 private LookupCustomizer(Builder<T> builder) {
58 this.predicateTransform = builder.getPredicateTransform() != null ? builder.getPredicateTransform() : IndentityTransform.<Predicate, Predicate>getInstance();
59 this.resultTransform = builder.getResultTransform() != null ? builder.getResultTransform() : IndentityTransform.<T, T>getInstance();
60 }
61
62 public Transform<Predicate, Predicate> getPredicateTransform() {
63 return predicateTransform;
64 }
65
66 public Transform<T, T> getResultTransform() {
67 return resultTransform;
68 }
69
70 @Deprecated
71 public static final class Builder<T> implements ModelBuilder, Serializable {
72
73 private Transform<Predicate, Predicate> predicateTransform;
74 private Transform<T, T> resultTransform;
75
76 private Builder() {
77
78 }
79
80 public static <T> Builder<T> create() {
81 return new Builder<T>();
82 }
83
84 public Transform<Predicate, Predicate> getPredicateTransform() {
85 return predicateTransform;
86 }
87
88 public void setPredicateTransform(final Transform<Predicate, Predicate> predicateTransform) {
89 this.predicateTransform = predicateTransform;
90 }
91
92 public Transform<T, T> getResultTransform() {
93 return resultTransform;
94 }
95
96 public void setResultTransform(final Transform<T, T> resultTransform) {
97 this.resultTransform = resultTransform;
98 }
99
100 @Override
101 public LookupCustomizer<T> build() {
102 return new LookupCustomizer<T>(this);
103 }
104 }
105
106 @Deprecated
107 public interface Transform<P, R> {
108 R apply(P input);
109 }
110
111
112
113
114
115
116 @Deprecated
117 private static final class IndentityTransform<I> implements Transform<I, I> {
118
119 @SuppressWarnings("unchecked")
120 private static final Transform INSTANCE = new IndentityTransform();
121
122 @SuppressWarnings("unchecked")
123 public static <P, R> Transform<P, R> getInstance() {
124 return INSTANCE;
125 }
126
127 @Override
128 public I apply(final I input) {
129 return input;
130 }
131 }
132 }