1 19 package org.netbeans.modules.javacore.parser; 20 21 import java.util.Arrays ; 22 import org.netbeans.modules.javacore.jmiimpl.javamodel.AnnotationImpl; 23 import org.netbeans.modules.javacore.jmiimpl.javamodel.SemiPersistentElement; 24 25 29 public final class AnnotationInfoMeasure implements Measure { 30 public static final AnnotationInfoMeasure INSTANCE = new AnnotationInfoMeasure(); 31 32 private AnnotationInfoMeasure() { 33 } 34 35 40 public int getDistance(Object refObject, Object ast) { 41 if (ast instanceof AnnotationInfo) { 42 AnnotationInfo astInfo = (AnnotationInfo) ast; 43 AnnotationImpl refInfo = (AnnotationImpl) refObject; 44 int result = INFINITE_DISTANCE; 45 46 if (refInfo.isPersisted()) { 47 result = ClassNameMeasure.INSTANCE.getDistance(refInfo.getTypeRef(), astInfo.type); 48 } 49 return result; 50 } 51 return INFINITE_DISTANCE; 52 } 53 } 54 | Popular Tags |