1 23 24 package com.sun.enterprise.deployment.annotation.impl; 25 26 import java.util.Map ; 27 import java.util.HashMap ; 28 import java.lang.reflect.AnnotatedElement ; 29 30 import com.sun.enterprise.deployment.annotation.ProcessingResult; 31 import com.sun.enterprise.deployment.annotation.ResultType; 32 import com.sun.enterprise.deployment.annotation.HandlerProcessingResult; 33 34 39 public class ProcessingResultImpl implements ProcessingResult { 40 41 Map <AnnotatedElement , HandlerProcessingResult> results; 42 ResultType overallResult = ResultType.UNPROCESSED; 43 44 45 public ProcessingResultImpl() { 46 results = new HashMap <AnnotatedElement , HandlerProcessingResult>(); 47 } 48 49 public void add(ProcessingResult pr) { 50 51 Map <AnnotatedElement , HandlerProcessingResult> results = pr.getResults(); 52 for (AnnotatedElement element : results.keySet()) { 53 add(element, results.get(element)); 54 } 55 } 56 57 public void add(AnnotatedElement element, HandlerProcessingResult elementResult) { 58 59 if (elementResult.getOverallResult().compareTo(overallResult)>0) { 60 overallResult = elementResult.getOverallResult(); 61 } 62 if (results.containsKey(element)) { 63 HandlerProcessingResultImpl previousResult = (HandlerProcessingResultImpl) results.get(element); 64 previousResult.addAll(elementResult); 65 } else { 66 if (elementResult instanceof HandlerProcessingResultImpl) { 67 results.put(element, elementResult); 68 } else { 69 HandlerProcessingResultImpl result = new HandlerProcessingResultImpl(); 70 result.addAll(elementResult); 71 results.put(element, result); 72 } 73 } 74 } 75 76 public Map <AnnotatedElement ,HandlerProcessingResult> getResults() { 77 return results; 78 } 79 80 public ResultType getOverallResult(){ 81 return overallResult; 82 } 83 } 84 | Popular Tags |