public static boolean isConstantKey ( Key < ? > key ) { Type type = key . getTypeLiteral ( ) . getType ( ) ; if ( ! ( type instanceof Class ) ) { return false ; } Class clazz = ( Class ) type ; return clazz == String . class || clazz == Class . class || clazz . isPrimitive ( ) || Number . class . isAssignableFrom ( clazz ) || Character . class . isAssignableFrom ( clazz ) || Boolean . class . isAssignableFrom ( clazz ) || clazz . isEnum ( ) ; }
Returns true if the provided key is a valid constant key i . e . if a constant binding can be legally created for it .