1 23 package com.sun.enterprise.deployment.annotation.impl; 24 25 import java.util.Map ; 26 import java.util.HashMap ; 27 import java.lang.annotation.Annotation ; 28 29 import com.sun.enterprise.deployment.annotation.ResultType; 30 import com.sun.enterprise.deployment.annotation.HandlerProcessingResult; 31 import com.sun.enterprise.deployment.annotation.AnnotationHandler; 32 33 37 public class HandlerProcessingResultImpl implements HandlerProcessingResult { 38 39 Map <Class <? extends Annotation >,ResultType> results; 40 ResultType overallResult = ResultType.UNPROCESSED; 41 42 45 public HandlerProcessingResultImpl(Map <Class <? extends Annotation >, ResultType> results) { 46 this.results = results; 47 } 48 49 public HandlerProcessingResultImpl() { 50 results = new HashMap <Class <? extends Annotation >, ResultType>(); 51 } 52 53 public static HandlerProcessingResultImpl getDefaultResult(Class <? extends Annotation > annotationType, ResultType result) { 54 55 HandlerProcessingResultImpl impl = new HandlerProcessingResultImpl(); 56 impl.results.put(annotationType, result); 57 impl.overallResult = result; 58 return impl; 59 } 60 61 public Map <Class <? extends Annotation >,ResultType> processedAnnotations() { 62 return results; 63 } 64 65 public void addResult(Class <? extends Annotation > annotationType, ResultType result) { 66 if (result.compareTo(overallResult)>0) { 67 overallResult = result; 68 } 69 results.put(annotationType, result); 70 } 71 72 public void addAll(HandlerProcessingResult result) { 73 if (result.getOverallResult().compareTo(overallResult)>0) { 74 overallResult = result.getOverallResult(); 75 } 76 results.putAll(result.processedAnnotations()); 77 } 78 79 public ResultType getOverallResult(){ 80 return overallResult; 81 } 82 83 } 84 | Popular Tags |