• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

aspectran / aspectran / #4407

17 Jul 2025 08:32AM CUT coverage: 34.843% (-0.1%) from 34.982%
#4407

push

github

topframe
Update

0 of 148 new or added lines in 5 files covered. (0.0%)

6 existing lines in 1 file now uncovered.

14406 of 41346 relevant lines covered (34.84%)

0.35 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/core/src/main/java/com/aspectran/core/activity/aspect/AdviceResult.java
1
/*
2
 * Copyright (c) 2008-present The Aspectran Project
3
 *
4
 * Licensed under the Apache License, Version 2.0 (the "License");
5
 * you may not use this file except in compliance with the License.
6
 * You may obtain a copy of the License at
7
 *
8
 *     http://www.apache.org/licenses/LICENSE-2.0
9
 *
10
 * Unless required by applicable law or agreed to in writing, software
11
 * distributed under the License is distributed on an "AS IS" BASIS,
12
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
 * See the License for the specific language governing permissions and
14
 * limitations under the License.
15
 */
16
package com.aspectran.core.activity.aspect;
17

18
import com.aspectran.core.context.rule.AdviceRule;
19
import com.aspectran.core.context.rule.type.AdviceType;
20
import com.aspectran.utils.annotation.jsr305.NonNull;
21

22
import java.util.HashMap;
23
import java.util.Map;
24

25
/**
26
 * Represents the result data for the advice.
27
 * Additionally, it holds the bean object of the advice.
28
 */
29
public class AdviceResult {
×
30

31
    private Map<String, Object> adviceBeanMap;
32

33
    private Map<String, Object> beforeAdviceResultMap;
34

35
    private Map<String, Object> afterAdviceResultMap;
36

37
    private Map<String, Object> aroundAdviceResultMap;
38

39
    private Map<String, Object> finallyAdviceResultMap;
40

41
    public Object getAdviceBean(String aspectId) {
42
        return (adviceBeanMap != null ? adviceBeanMap.get(aspectId) : null);
×
43
    }
44

45
    public void putAdviceBean(String aspectId, Object adviceBean) {
46
        if (adviceBeanMap == null) {
×
47
            adviceBeanMap = new HashMap<>();
×
48
        }
49
        adviceBeanMap.put(aspectId, adviceBean);
×
50
    }
×
51

52
    public Object getBeforeAdviceResult(String aspectId) {
53
        return (beforeAdviceResultMap != null ? beforeAdviceResultMap.get(aspectId) : null);
×
54
    }
55

56
    private void putBeforeAdviceResult(String aspectId, Object actionResult) {
57
        if (beforeAdviceResultMap == null) {
×
58
            beforeAdviceResultMap = new HashMap<>();
×
59
        }
60
        beforeAdviceResultMap.put(aspectId, actionResult);
×
61
    }
×
62

63
    public Object getAfterAdviceResult(String aspectId) {
64
        return (afterAdviceResultMap != null ? afterAdviceResultMap.get(aspectId) : null);
×
65
    }
66

67
    private void putAfterAdviceResult(String aspectId, Object actionResult) {
68
        if (afterAdviceResultMap == null) {
×
69
            afterAdviceResultMap = new HashMap<>();
×
70
        }
71
        afterAdviceResultMap.put(aspectId, actionResult);
×
72
    }
×
73

74
    public Object getAroundAdviceResult(String aspectId) {
75
        return (aroundAdviceResultMap != null ? aroundAdviceResultMap.get(aspectId) : null);
×
76
    }
77

78
    private void putAroundAdviceResult(String aspectId, Object actionResult) {
79
        if (aroundAdviceResultMap == null) {
×
80
            aroundAdviceResultMap = new HashMap<>();
×
81
        }
82
        aroundAdviceResultMap.put(aspectId, actionResult);
×
83
    }
×
84

85
    public Object getFinallyAdviceResult(String aspectId) {
86
        return (finallyAdviceResultMap != null ? finallyAdviceResultMap.get(aspectId) : null);
×
87
    }
88

89
    private void putFinallyAdviceResult(String aspectId, Object actionResult) {
90
        if (finallyAdviceResultMap == null) {
×
91
            finallyAdviceResultMap = new HashMap<>();
×
92
        }
93
        finallyAdviceResultMap.put(aspectId, actionResult);
×
94
    }
×
95

96
    public void putAdviceResult(@NonNull AdviceRule adviceRule, Object adviceResult) {
97
        if (adviceRule.getAdviceType() == AdviceType.BEFORE) {
×
98
            putBeforeAdviceResult(adviceRule.getAspectId(), adviceResult);
×
99
        } else if (adviceRule.getAdviceType() == AdviceType.AFTER) {
×
100
            putAfterAdviceResult(adviceRule.getAspectId(), adviceResult);
×
101
        } else if (adviceRule.getAdviceType() == AdviceType.AROUND) {
×
102
            putAroundAdviceResult(adviceRule.getAspectId(), adviceResult);
×
103
        } else if (adviceRule.getAdviceType() == AdviceType.FINALLY) {
×
104
            putFinallyAdviceResult(adviceRule.getAspectId(), adviceResult);
×
105
        } else {
106
            throw new UnsupportedOperationException("Unrecognized advice type: " +
×
107
                    adviceRule.getAdviceType());
×
108
        }
109
    }
×
110

111
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc