1 | package com.github.dakusui.pcond.core.fluent; | |
2 | ||
3 | import com.github.dakusui.pcond.core.fluent.builtins.*; | |
4 | import com.github.dakusui.pcond.forms.Functions; | |
5 | ||
6 | import java.util.List; | |
7 | import java.util.function.Function; | |
8 | import java.util.stream.Stream; | |
9 | ||
10 | import static com.github.dakusui.pcond.core.refl.MethodQuery.classMethod; | |
11 | import static com.github.dakusui.pcond.core.refl.MethodQuery.instanceMethod; | |
12 | import static com.github.dakusui.pcond.forms.Functions.call; | |
13 | import static com.github.dakusui.pcond.forms.Functions.parameter; | |
14 | import static java.util.Objects.requireNonNull; | |
15 | ||
16 | public interface AbstractObjectTransformer< | |
17 | TX extends AbstractObjectTransformer<TX, V, T, R>, | |
18 | V extends AbstractObjectChecker<V, T, R>, | |
19 | T, | |
20 | R | |
21 | > extends | |
22 | Transformer<TX, V, T, R> { | |
23 | ||
24 | /** | |
25 | * Corresponds to {@code toString()} method. | |
26 | * | |
27 | * @return this object the method appended. | |
28 | */ | |
29 | @SuppressWarnings("unchecked") | |
30 | default StringTransformer<String> stringify() { | |
31 |
1
1. stringify : replaced return value with null for com/github/dakusui/pcond/core/fluent/AbstractObjectTransformer::stringify → KILLED |
return (StringTransformer<String>) this.toString(Functions.stringify()); |
32 | } | |
33 | ||
34 | default <E> ObjectTransformer<T, E> invoke(String methodName, Object... args) { | |
35 |
1
1. invoke : replaced return value with null for com/github/dakusui/pcond/core/fluent/AbstractObjectTransformer::invoke → KILLED |
return this.toObject(call(instanceMethod(parameter(), methodName, args))); |
36 | } | |
37 | ||
38 | default <E> ObjectTransformer<T, E> invokeStatic(Class<?> klass, String methodName, Object... args) { | |
39 |
1
1. invokeStatic : replaced return value with null for com/github/dakusui/pcond/core/fluent/AbstractObjectTransformer::invokeStatic → KILLED |
return this.toObject(call(classMethod(klass, methodName, args))); |
40 | } | |
41 | ||
42 | default <O extends Throwable> ThrowableTransformer<T, O> expectException(Class<O> exceptionClass, Function<? super R, ?> f) { | |
43 | requireNonNull(exceptionClass); | |
44 |
1
1. expectException : replaced return value with null for com/github/dakusui/pcond/core/fluent/AbstractObjectTransformer::expectException → KILLED |
return this.toThrowable(Functions.expectingException(exceptionClass, f)); |
45 | } | |
46 | ||
47 | @SuppressWarnings("unchecked") | |
48 | default <E> ObjectTransformer<T, E> asObject() { | |
49 |
1
1. asObject : replaced return value with null for com/github/dakusui/pcond/core/fluent/AbstractObjectTransformer::asObject → KILLED |
return (ObjectTransformer<T, E>)this.toObject(Functions.identity()); |
50 | } | |
51 | ||
52 | default <E> ObjectTransformer<T, E> toObject(Function<R, E> function) { | |
53 |
1
1. toObject : replaced return value with null for com/github/dakusui/pcond/core/fluent/AbstractObjectTransformer::toObject → KILLED |
return this.transformValueWith(function, ObjectTransformer.Impl::new); |
54 | } | |
55 | ||
56 | default BooleanTransformer<T> toBoolean(Function<? super R, Boolean> function) { | |
57 |
1
1. toBoolean : replaced return value with null for com/github/dakusui/pcond/core/fluent/AbstractObjectTransformer::toBoolean → KILLED |
return this.transformValueWith(function, BooleanTransformer.Impl::new); |
58 | } | |
59 | ||
60 | default IntegerTransformer<T> toInteger(Function<? super R, Integer> function) { | |
61 |
1
1. toInteger : replaced return value with null for com/github/dakusui/pcond/core/fluent/AbstractObjectTransformer::toInteger → KILLED |
return this.transformValueWith(function, IntegerTransformer.Impl::new); |
62 | } | |
63 | ||
64 | default LongTransformer<T> toLong(Function<? super R, Long> function) { | |
65 |
1
1. toLong : replaced return value with null for com/github/dakusui/pcond/core/fluent/AbstractObjectTransformer::toLong → KILLED |
return this.transformValueWith(function, LongTransformer.Impl::new); |
66 | } | |
67 | ||
68 | default ShortTransformer<T> toShort(Function<? super R, Short> function) { | |
69 |
1
1. toShort : replaced return value with null for com/github/dakusui/pcond/core/fluent/AbstractObjectTransformer::toShort → KILLED |
return this.transformValueWith(function, ShortTransformer.Impl::new); |
70 | } | |
71 | ||
72 | default DoubleTransformer<T> toDouble(Function<? super R, Double> function) { | |
73 |
1
1. toDouble : replaced return value with null for com/github/dakusui/pcond/core/fluent/AbstractObjectTransformer::toDouble → KILLED |
return this.transformValueWith(function, DoubleTransformer.Impl::new); |
74 | } | |
75 | ||
76 | default FloatTransformer<T> toFloat(Function<? super R, Float> function) { | |
77 |
1
1. toFloat : replaced return value with null for com/github/dakusui/pcond/core/fluent/AbstractObjectTransformer::toFloat → KILLED |
return this.transformValueWith(function, FloatTransformer.Impl::new); |
78 | } | |
79 | ||
80 | default StringTransformer<T> toString(Function<? super R, String> function) { | |
81 |
1
1. toString : replaced return value with null for com/github/dakusui/pcond/core/fluent/AbstractObjectTransformer::toString → KILLED |
return this.transformValueWith(function, StringTransformer.Impl::new); |
82 | } | |
83 | ||
84 | ||
85 | default <E> ListTransformer<T, E> toList(Function<? super R, List<E>> function) { | |
86 |
1
1. toList : replaced return value with null for com/github/dakusui/pcond/core/fluent/AbstractObjectTransformer::toList → KILLED |
return this.transformValueWith(function, ListTransformer.Impl::new); |
87 | } | |
88 | ||
89 | default <E> StreamTransformer<T, E> toStream(Function<? super R, Stream<E>> function) { | |
90 |
1
1. toStream : replaced return value with null for com/github/dakusui/pcond/core/fluent/AbstractObjectTransformer::toStream → KILLED |
return this.transformValueWith(function, StreamTransformer.Impl::new); |
91 | } | |
92 | ||
93 | default <E extends Throwable> ThrowableTransformer<T, E> toThrowable(Function<? super R, E> function) { | |
94 |
1
1. toThrowable : replaced return value with null for com/github/dakusui/pcond/core/fluent/AbstractObjectTransformer::toThrowable → KILLED |
return this.transformValueWith(function, ThrowableTransformer.Impl::new); |
95 | ||
96 | } | |
97 | ||
98 | } | |
Mutations | ||
31 |
1.1 |
|
35 |
1.1 |
|
39 |
1.1 |
|
44 |
1.1 |
|
49 |
1.1 |
|
53 |
1.1 |
|
57 |
1.1 |
|
61 |
1.1 |
|
65 |
1.1 |
|
69 |
1.1 |
|
73 |
1.1 |
|
77 |
1.1 |
|
81 |
1.1 |
|
86 |
1.1 |
|
90 |
1.1 |
|
94 |
1.1 |