Determine of the specified class can be monitored via the probes
infrastructure.

@param clazz the monitoring candidate

@return false if the class can't be monitored
353050
public boolean isMonitorable(Class<?> clazz) {
        // Faster(?) path
        if (notMonitorable.contains(clazz)) {
            return false;
        } else if (monitorable.contains(clazz)) {
            return true;
        }

        boolean isMonitorable = true;
        if (!instrumentation.isModifiableClass(clazz)) {
            isMonitorable = false;
        } else if (clazz.isInterface()) {
            isMonitorable = false;
        } else if (clazz.isArray()) {
            isMonitorable = false;
        } else if (Proxy.isProxyClass(clazz)) {
            isMonitorable = false;
        } else if (clazz.isPrimitive()) {
            isMonitorable = false;
        } else if (isExcludedClass(Type.getInternalName(clazz))) {
            isMonitorable = false;
        } else if (!includeBootstrap && clazz.getClassLoader() == null) {
            isMonitorable = false;
        }

        // Update collections
        if (!isMonitorable) {
            synchronized (notMonitorable) {
                notMonitorable.add(clazz);
            }
        } else {
            monitorable.add(clazz);
        }
        return isMonitorable;
    }
824085
protected boolean isBoundaryClass(Class<?> clazz) {
        if (clazz.equals(WebPage.class) || clazz.equals(Page.class) || clazz.equals(Panel.class)
                || clazz.equals(MarkupContainer.class) || clazz.equals(Component.class)
                || clazz.equals(AuthenticatedWebSession.class) || clazz.equals(WebSession.class)
                || clazz.equals(Session.class) || clazz.equals(Object.class)) {
            return true;
        }
        return false;
    }
91526
private void visitClass(final Class clazz) {
        Method[] methods = clazz.getDeclaredMethods();
        for (Method method : methods) {
            Class<?>[] exceptionTypes = method.getExceptionTypes();
            String[] exceptions = new String[exceptionTypes.length];
            for (int i = 0; i < exceptions.length; i++) {
                exceptions[i] = BytecodeHelper.getClassInternalName(exceptionTypes[i]);
            }
            // for each method defined in the class, generate the appropriate delegation bytecode
            visitMethod(method.getModifiers(),
                    method.getName(),
                    BytecodeHelper.getMethodDescriptor(method.getReturnType(), method.getParameterTypes()),
                    null,
                    exceptions);
        }
        Constructor[] constructors = clazz.getDeclaredConstructors();
        for (Constructor method : constructors) {
            Class<?>[] exceptionTypes = method.getExceptionTypes();
            String[] exceptions = new String[exceptionTypes.length];
            for (int i = 0; i < exceptions.length; i++) {
                exceptions[i] = BytecodeHelper.getClassInternalName(exceptionTypes[i]);
            }
            // for each method defined in the class, generate the appropriate delegation bytecode
            visitMethod(method.getModifiers(),
                    "<init>",
                    BytecodeHelper.getMethodDescriptor(Void.TYPE, method.getParameterTypes()),
                    null,
                    exceptions);
        }

        for (Class intf : clazz.getInterfaces()) {
            visitClass(intf);
        }
        Class superclass = clazz.getSuperclass();
        if (superclass != null) visitClass(superclass);

        // Ultimately, methods can be available in the closure map which are not defined by the superclass
        // nor the interfaces
        for (Map.Entry<String, Boolean> entry : delegatedClosures.entrySet()) {
            Boolean visited = entry.getValue();
            if (!visited) {
                String name = entry.getKey();
                if (!"*".equals(name)) {
                    // generate a new method
                    visitMethod(ACC_PUBLIC, name, "([Ljava/lang/Object;)Ljava/lang/Object;", null, null);
                }
            }
        }
    }
569616
public static boolean isProperClass(Class<?> clazz) {
		int mods = clazz.getModifiers();
		return !(Modifier.isAbstract(mods) || Modifier.isInterface(mods) || Modifier.isNative(mods));
	}
691634
public static boolean classHasAnnotation(Class clazz, Class<? extends Annotation> annotation) {
		try {
			Set<Class> hierarchy = ReflectionUtil.flattenHierarchy(clazz);
			for (Class c : hierarchy) {
				if (c.isAnnotationPresent(annotation)) return true;
			}
		} catch (Throwable t) {
			t.printStackTrace();
		}
		return false;
	}
818756
public boolean isLikelyContextClass(Class<?> clazz) {     
        return (OutputReceiver.class.isAssignableFrom(clazz) ||
                getClassName(clazz).toLowerCase().endsWith("context"));
    }
580857
public static List<Class<?>> getSuperclasses(Class<?> clazz) {
        return getSuperclassesAsStream(clazz).collect(Collectors.toList());
    }
362538
synchronized void removeInterestedByClass(Class<?> clazz, ProbeListener listener) {
        Set<ProbeListener> listeners = listenersByClass.get(clazz);
        if (listeners != null) {
            listeners.remove(listener);
            if (listeners.isEmpty()) {
                listenersByClass.remove(clazz);
            }
        }
    }
986900
public static boolean isPropertyGettable(
                    final Class<?> clazz,
                    final String propertyName
                    )
    {
        if (clazz == null) {
            throw new IllegalArgumentException( "no class specified" );
        }

        if (propertyName == null) {
            throw new IllegalArgumentException( "no property specified" );
        }

        PropertyAccessor  accessor = _findAccessor( clazz, propertyName );

        return (accessor == null ? false : accessor.isGettable());
    }
538700
private void check(Class clazz) {

        final Constructor<?>[] constructors = clazz.getDeclaredConstructors();

        if (constructors.length > 1) {
            throw new AssertionError(clazz + " has more than one constructor");
        }

        final Constructor<?> constructor = constructors[0];

        constructor.setAccessible(true);

        if (!Modifier.isPrivate(constructor.getModifiers())) {
            throw new AssertionError("Constructor of " + clazz + " must be private");
        }

        final Class<?>[] parameterTypes = constructor.getParameterTypes();

        if (parameterTypes.length > 0) {
            if (expectedParameters == null) {
                throw new AssertionError(clazz + " has non-default constructor with some parameters");
            } else {
                if (!Arrays.equals(parameterTypes, expectedParameters)) {
                    throw new AssertionError("Expected constructor with parameters " + getReadableClassesOutput(expectedParameters) + " but found constructor with parameters " + getReadableClassesOutput(parameterTypes));
                } else {
                    return;
                }
            }
        }

        try {
            constructor.newInstance();
        } catch (InstantiationException e) {
            throw new RuntimeException("Can not instantiate instance of " + clazz, e);
        } catch (IllegalAccessException e) {
            // Fixed by setAccessible(true)
            throw new RuntimeException(e);
        } catch (InvocationTargetException e) {
            final Throwable cause = e.getCause();

            // It's okay case if we expect some exception from this constructor
            if (expectedTypeOfException != null || expectedExceptionMessage != null) {
                if (expectedTypeOfException != null && !expectedTypeOfException.equals(cause.getClass())) {
                    throw new IllegalStateException("For " + clazz + " expected exception of type = " + expectedTypeOfException + ", but was exception of type = " + e.getCause().getClass());
                }

                if (expectedExceptionMessage != null && !expectedExceptionMessage.equals(cause.getMessage())) {
                    throw new IllegalStateException("For " + clazz + " expected exception message = '" + expectedExceptionMessage + "', but was = '" + cause.getMessage() + "'", e.getCause());
                }

                // Everything is okay
            } else {
                throw new IllegalStateException("For " + clazz + " no exception was expected", e);
            }
        } catch (IllegalArgumentException e) {
            throw new RuntimeException("Looks like constructor of " + clazz + " is not default", e);
        }
    }
1012401
public static boolean isPrimitiveArray(Class<?> clazz) {
		Assert.notNull(clazz, "Class must not be null");
		return (clazz.isArray() && clazz.getComponentType().isPrimitive());
	}
776857
private boolean isDate(Class clazz)
    {
        return clazz.isAssignableFrom(Date.class) || clazz.isAssignableFrom(java.sql.Date.class)
                || clazz.isAssignableFrom(Timestamp.class) || clazz.isAssignableFrom(Time.class)
                || clazz.isAssignableFrom(Calendar.class);
    }
731181
private boolean isCollectionClass(Class<?> clazz) {
        if (clazz == RESTBaseEntityUpdateCollectionV1.class || clazz == RESTBaseEntityCollectionV1.class) {
            return true;
        } else if (clazz.getSuperclass() != null) {
            return isCollectionClass(clazz.getSuperclass());
        } else {
            return false;
        }
    }
419548
public static void initializeClass(Class clazz) {
		try {
			Class.forName(clazz.getName(), true, Thread.currentThread().getContextClassLoader());
		}
		catch (ClassNotFoundException e) {
			throw new RuntimeException(e);
		}
	}
463769
public boolean isArtefact(@SuppressWarnings("rawtypes") Class theClazz) {
        String className = theClazz.getName();
        for (Class<?> artefactClass : allArtefactClasses) {
            if (className.equals(artefactClass.getName())) {
                return true;
            }
        }
        return false;
    }
181433
public static Class<?> resolvePrimitiveIfNecessary(Class<?> clazz) {
		Assert.notNull(clazz, "Class must not be null");
		return (clazz.isPrimitive() && clazz != void.class? primitiveTypeToWrapperMap.get(clazz) : clazz);
	}
702513
@SuppressWarnings("unchecked")
    <T> T staticMockMarker(Class<T> clazz) {
        return (T) classToMarker.get(clazz);
    }