public void visit(HasAnnotation hasAnnotation) { ReflectionVar v = (ReflectionVar) hasAnnotation.getVar(); Object value = v.getBindingAtJoinPoint(thisObject, targetObject, args); World world = v.getType().getWorld(); ResolvedType actualVarType = world.resolve(value.getClass().getName()); ResolvedType requiredAnnotationType = hasAnnotation.getAnnotationType().resolve(world); matches = actualVarType.hasAnnotation(requiredAnnotationType); }
public void visit(Instanceof instanceofTest) { ReflectionVar v = (ReflectionVar) instanceofTest.getVar(); Object value = v.getBindingAtJoinPoint(thisObject, targetObject, args); World world = v.getType().getWorld(); ResolvedType desiredType = instanceofTest.getType().resolve(world); if (value == null) { matches = false; } else { ResolvedType actualType = world.resolve(value.getClass().getName()); matches = desiredType.isAssignableFrom(actualType); } }