| 1 | package pro.verron.officestamper.core; | |
| 2 | ||
| 3 | import org.jspecify.annotations.Nullable; | |
| 4 | import org.springframework.expression.*; | |
| 5 | ||
| 6 | import java.util.ArrayList; | |
| 7 | import java.util.List; | |
| 8 | import java.util.Objects; | |
| 9 | ||
| 10 | /// An {@link EvaluationContext} that combines multiple contexts. | |
| 11 | public class UnionEvaluationContext | |
| 12 | implements EvaluationContext { | |
| 13 | private final EvaluationContext evaluationContext; | |
| 14 | private final Invokers invokers; | |
| 15 | ||
| 16 | UnionEvaluationContext(EvaluationContext evaluationContext, Invokers invokers) { | |
| 17 | this.evaluationContext = evaluationContext; | |
| 18 | this.invokers = invokers; | |
| 19 | } | |
| 20 | ||
| 21 | @Override | |
| 22 | public TypedValue getRootObject() { | |
| 23 |
1
1. getRootObject : replaced return value with null for pro/verron/officestamper/core/UnionEvaluationContext::getRootObject → KILLED |
return evaluationContext.getRootObject(); |
| 24 | } | |
| 25 | ||
| 26 | @Override | |
| 27 | public List<PropertyAccessor> getPropertyAccessors() { | |
| 28 | var accessors = evaluationContext.getPropertyAccessors(); | |
| 29 | var unionAccessors = new ArrayList<>(accessors); | |
| 30 |
1
1. getPropertyAccessors : removed call to java/util/ArrayList::addFirst → TIMED_OUT |
unionAccessors.addFirst(new UnionPropertyAccessor(accessors)); |
| 31 |
1
1. getPropertyAccessors : replaced return value with Collections.emptyList for pro/verron/officestamper/core/UnionEvaluationContext::getPropertyAccessors → TIMED_OUT |
return unionAccessors; |
| 32 | } | |
| 33 | ||
| 34 | @Override | |
| 35 | public List<IndexAccessor> getIndexAccessors() { | |
| 36 | var accessors = evaluationContext.getIndexAccessors(); | |
| 37 | var unionAccessors = new ArrayList<>(accessors); | |
| 38 |
1
1. getIndexAccessors : removed call to java/util/ArrayList::addFirst → NO_COVERAGE |
unionAccessors.addFirst(new UnionIndexAccessor(accessors)); |
| 39 |
1
1. getIndexAccessors : replaced return value with Collections.emptyList for pro/verron/officestamper/core/UnionEvaluationContext::getIndexAccessors → NO_COVERAGE |
return unionAccessors; |
| 40 | } | |
| 41 | ||
| 42 | @Override | |
| 43 | public List<ConstructorResolver> getConstructorResolvers() { | |
| 44 |
1
1. getConstructorResolvers : replaced return value with Collections.emptyList for pro/verron/officestamper/core/UnionEvaluationContext::getConstructorResolvers → KILLED |
return evaluationContext.getConstructorResolvers(); |
| 45 | } | |
| 46 | ||
| 47 | @Override | |
| 48 | public List<MethodResolver> getMethodResolvers() { | |
| 49 | var resolvers = evaluationContext.getMethodResolvers(); | |
| 50 | var unionResolvers = new ArrayList<>(resolvers); | |
| 51 |
1
1. getMethodResolvers : removed call to java/util/ArrayList::addFirst → TIMED_OUT |
unionResolvers.addFirst(new UnionMethodResolver(resolvers)); |
| 52 | unionResolvers.add(invokers); | |
| 53 |
1
1. getMethodResolvers : replaced return value with Collections.emptyList for pro/verron/officestamper/core/UnionEvaluationContext::getMethodResolvers → KILLED |
return unionResolvers; |
| 54 | } | |
| 55 | ||
| 56 | @Override | |
| 57 | @Nullable | |
| 58 | public BeanResolver getBeanResolver() { | |
| 59 |
1
1. getBeanResolver : replaced return value with null for pro/verron/officestamper/core/UnionEvaluationContext::getBeanResolver → NO_COVERAGE |
return evaluationContext.getBeanResolver(); |
| 60 | } | |
| 61 | ||
| 62 | @Override | |
| 63 | public TypeLocator getTypeLocator() { | |
| 64 |
1
1. getTypeLocator : replaced return value with null for pro/verron/officestamper/core/UnionEvaluationContext::getTypeLocator → KILLED |
return evaluationContext.getTypeLocator(); |
| 65 | } | |
| 66 | ||
| 67 | @Override | |
| 68 | public TypeConverter getTypeConverter() { | |
| 69 |
1
1. getTypeConverter : replaced return value with null for pro/verron/officestamper/core/UnionEvaluationContext::getTypeConverter → TIMED_OUT |
return evaluationContext.getTypeConverter(); |
| 70 | } | |
| 71 | ||
| 72 | @Override | |
| 73 | public TypeComparator getTypeComparator() { | |
| 74 |
1
1. getTypeComparator : replaced return value with null for pro/verron/officestamper/core/UnionEvaluationContext::getTypeComparator → NO_COVERAGE |
return evaluationContext.getTypeComparator(); |
| 75 | } | |
| 76 | ||
| 77 | @Override | |
| 78 | public OperatorOverloader getOperatorOverloader() { | |
| 79 |
1
1. getOperatorOverloader : replaced return value with null for pro/verron/officestamper/core/UnionEvaluationContext::getOperatorOverloader → NO_COVERAGE |
return evaluationContext.getOperatorOverloader(); |
| 80 | } | |
| 81 | ||
| 82 | @Override | |
| 83 | public void setVariable(String name, @Nullable Object value) { | |
| 84 |
1
1. setVariable : removed call to org/springframework/expression/EvaluationContext::setVariable → NO_COVERAGE |
evaluationContext.setVariable(name, value); |
| 85 | } | |
| 86 | ||
| 87 | @Override | |
| 88 | @Nullable | |
| 89 | public Object lookupVariable(String name) { | |
| 90 |
1
1. lookupVariable : replaced return value with null for pro/verron/officestamper/core/UnionEvaluationContext::lookupVariable → NO_COVERAGE |
return evaluationContext.lookupVariable(name); |
| 91 | } | |
| 92 | ||
| 93 | /// Returns the wrapped evaluation context. | |
| 94 | /// | |
| 95 | /// @return the evaluation context | |
| 96 |
1
1. evaluationContext : replaced return value with null for pro/verron/officestamper/core/UnionEvaluationContext::evaluationContext → NO_COVERAGE |
public EvaluationContext evaluationContext() {return evaluationContext;} |
| 97 | ||
| 98 | /// Returns the invokers. | |
| 99 | /// | |
| 100 | /// @return the invokers | |
| 101 |
1
1. invokers : replaced return value with null for pro/verron/officestamper/core/UnionEvaluationContext::invokers → NO_COVERAGE |
public Invokers invokers() {return invokers;} |
| 102 | ||
| 103 | @Override | |
| 104 | public int hashCode() { | |
| 105 |
1
1. hashCode : replaced int return with 0 for pro/verron/officestamper/core/UnionEvaluationContext::hashCode → NO_COVERAGE |
return Objects.hash(evaluationContext, invokers); |
| 106 | } | |
| 107 | ||
| 108 | @Override | |
| 109 | public boolean equals(Object obj) { | |
| 110 |
2
1. equals : replaced boolean return with false for pro/verron/officestamper/core/UnionEvaluationContext::equals → NO_COVERAGE 2. equals : negated conditional → NO_COVERAGE |
if (obj == this) return true; |
| 111 |
3
1. equals : negated conditional → NO_COVERAGE 2. equals : negated conditional → NO_COVERAGE 3. equals : replaced boolean return with true for pro/verron/officestamper/core/UnionEvaluationContext::equals → NO_COVERAGE |
if (obj == null || obj.getClass() != this.getClass()) return false; |
| 112 | var that = (UnionEvaluationContext) obj; | |
| 113 |
3
1. equals : negated conditional → NO_COVERAGE 2. equals : replaced boolean return with true for pro/verron/officestamper/core/UnionEvaluationContext::equals → NO_COVERAGE 3. equals : negated conditional → NO_COVERAGE |
return Objects.equals(this.evaluationContext, that.evaluationContext) && Objects.equals(this.invokers, |
| 114 | that.invokers); | |
| 115 | } | |
| 116 | ||
| 117 | @Override | |
| 118 | public String toString() { | |
| 119 |
1
1. toString : replaced return value with "" for pro/verron/officestamper/core/UnionEvaluationContext::toString → TIMED_OUT |
return "UnionEvaluationContext[" + "evaluationContext=" + evaluationContext + ", " + "invokers=" + invokers |
| 120 | + ']'; | |
| 121 | } | |
| 122 | ||
| 123 | ||
| 124 | } | |
Mutations | ||
| 23 |
1.1 |
|
| 30 |
1.1 |
|
| 31 |
1.1 |
|
| 38 |
1.1 |
|
| 39 |
1.1 |
|
| 44 |
1.1 |
|
| 51 |
1.1 |
|
| 53 |
1.1 |
|
| 59 |
1.1 |
|
| 64 |
1.1 |
|
| 69 |
1.1 |
|
| 74 |
1.1 |
|
| 79 |
1.1 |
|
| 84 |
1.1 |
|
| 90 |
1.1 |
|
| 96 |
1.1 |
|
| 101 |
1.1 |
|
| 105 |
1.1 |
|
| 110 |
1.1 2.2 |
|
| 111 |
1.1 2.2 3.3 |
|
| 113 |
1.1 2.2 3.3 |
|
| 119 |
1.1 |