-
Enhancement
-
Resolution: Won't Fix
-
P4
-
None
-
6
-
x86
-
windows_xp
A DESCRIPTION OF THE REQUEST :
Currently, the JDK does not provide a way of dynamically accessing all Classes for which isPrimitive() returns true.
JUSTIFICATION :
There are scenarios where it would be desirable to iterate over the Classes for which isPrimitive() returns true WITHOUT an 8-fold case distinction. Ideally, this would be realized via an enum named "Primitive" (or something like that), similar to the PrimitiveType.Kind enum of the mirror API. Also, problems arising in wrapping situations should be eased by the implementation of utility methods.
---------- BEGIN SOURCE ----------
public enum Primitive {
BOOLEAN,
BYTE,
CHAR,
DOUBLE,
FLOAT,
INTEGER,
LONG,
SHORT;
public Class getWrappedClass() {...}
public Class getWrapperClass() {...}
public Object getDefaultValue() {...}
}
The method getDefaultValue() would return wrapped values of the primitives that are used for initialization e.g. of arrays of the corresponding types (i.e. false resp. the different flavors of zero)
---------- END SOURCE ----------
###@###.### 2005-04-25 20:21:28 GMT
Currently, the JDK does not provide a way of dynamically accessing all Classes for which isPrimitive() returns true.
JUSTIFICATION :
There are scenarios where it would be desirable to iterate over the Classes for which isPrimitive() returns true WITHOUT an 8-fold case distinction. Ideally, this would be realized via an enum named "Primitive" (or something like that), similar to the PrimitiveType.Kind enum of the mirror API. Also, problems arising in wrapping situations should be eased by the implementation of utility methods.
---------- BEGIN SOURCE ----------
public enum Primitive {
BOOLEAN,
BYTE,
CHAR,
DOUBLE,
FLOAT,
INTEGER,
LONG,
SHORT;
public Class getWrappedClass() {...}
public Class getWrapperClass() {...}
public Object getDefaultValue() {...}
}
The method getDefaultValue() would return wrapped values of the primitives that are used for initialization e.g. of arrays of the corresponding types (i.e. false resp. the different flavors of zero)
---------- END SOURCE ----------
###@###.### 2005-04-25 20:21:28 GMT
- relates to
-
JDK-6176992 (reflect) Add support to java.lang.Class for wrapper type conversions
- Open
-
JDK-6183524 (reflect) should create and use an enum-based variant of java.lang.reflect.Modifiers
- Closed