in deltaspike/core/api/src/main/java/org/apache/deltaspike/core/util/ClassUtils.java [122:182]
public static boolean isProxyableClass(Type type)
{
Class clazz = null;
if (type instanceof Class)
{
clazz = (Class) type;
}
if (type instanceof ParameterizedType && ((ParameterizedType) type).getRawType() instanceof Class)
{
clazz = (Class) ((ParameterizedType) type).getRawType();
}
if (clazz == null)
{
return false;
}
// classes which don’t have a non-private constructor with no parameters
try
{
Constructor constructor = clazz.getConstructor();
if (Modifier.isPrivate(constructor.getModifiers()))
{
return false;
}
}
catch (NoSuchMethodException e)
{
return false;
}
// classes which are declared final
if (Modifier.isFinal(clazz.getModifiers()))
{
return false;
}
// classes which have non-static, final methods with public, protected or default visibility,
for (Method method : clazz.getMethods())
{
if (method.getDeclaringClass() == Object.class)
{
continue;
}
if (!method.isBridge() && !method.isSynthetic() && !Modifier.isStatic(method.getModifiers()) &&
!Modifier.isPrivate(method.getModifiers()) && Modifier.isFinal(method.getModifiers()))
{
return false;
}
}
// primitive types,
// and array types.
if (clazz.isPrimitive() || clazz.isArray())
{
return false;
}
return true;
}