|
|
@@ -71,10 +71,10 @@ public final class IntrospectionHelper { |
|
|
|
|
|
|
|
// Set up PRIMITIVE_TYPE_MAP |
|
|
|
static { |
|
|
|
Class[] primitives = { Boolean.TYPE, Byte.TYPE, Character.TYPE, Short.TYPE, |
|
|
|
Integer.TYPE, Long.TYPE, Float.TYPE, Double.TYPE }; |
|
|
|
Class[] wrappers = { Boolean.class, Byte.class, Character.class, Short.class, |
|
|
|
Integer.class, Long.class, Float.class, Double.class }; |
|
|
|
Class[] primitives = {Boolean.TYPE, Byte.TYPE, Character.TYPE, Short.TYPE, |
|
|
|
Integer.TYPE, Long.TYPE, Float.TYPE, Double.TYPE}; |
|
|
|
Class[] wrappers = {Boolean.class, Byte.class, Character.class, Short.class, |
|
|
|
Integer.class, Long.class, Float.class, Double.class}; |
|
|
|
for (int i = 0; i < primitives.length; i++) { |
|
|
|
PRIMITIVE_TYPE_MAP.put (primitives[i], wrappers[i]); |
|
|
|
} |
|
|
@@ -948,7 +948,7 @@ public final class IntrospectionHelper { |
|
|
|
return new AttributeSetter(m, arg) { |
|
|
|
public void set(Project p, Object parent, String value) |
|
|
|
throws InvocationTargetException, IllegalAccessException { |
|
|
|
m.invoke(parent, (Object[]) new String[] { value }); |
|
|
|
m.invoke(parent, (Object[]) new String[] {value}); |
|
|
|
} |
|
|
|
}; |
|
|
|
} |
|
|
@@ -961,7 +961,7 @@ public final class IntrospectionHelper { |
|
|
|
throw new BuildException("The value \"\" is not a " |
|
|
|
+ "legal value for attribute \"" + attrName + "\""); |
|
|
|
} |
|
|
|
m.invoke(parent, (Object[]) new Character[] { new Character(value.charAt(0)) }); |
|
|
|
m.invoke(parent, (Object[]) new Character[] {new Character(value.charAt(0))}); |
|
|
|
} |
|
|
|
}; |
|
|
|
} |
|
|
@@ -981,7 +981,7 @@ public final class IntrospectionHelper { |
|
|
|
public void set(Project p, Object parent, String value) |
|
|
|
throws InvocationTargetException, IllegalAccessException, BuildException { |
|
|
|
try { |
|
|
|
m.invoke(parent, new Object[] { Class.forName(value) }); |
|
|
|
m.invoke(parent, new Object[] {Class.forName(value)}); |
|
|
|
} catch (ClassNotFoundException ce) { |
|
|
|
throw new BuildException(ce); |
|
|
|
} |
|
|
@@ -993,7 +993,7 @@ public final class IntrospectionHelper { |
|
|
|
return new AttributeSetter(m, arg) { |
|
|
|
public void set(Project p, Object parent, String value) |
|
|
|
throws InvocationTargetException, IllegalAccessException { |
|
|
|
m.invoke(parent, new Object[] { p.resolveFile(value) }); |
|
|
|
m.invoke(parent, new Object[] {p.resolveFile(value)}); |
|
|
|
} |
|
|
|
}; |
|
|
|
} |
|
|
@@ -1005,7 +1005,7 @@ public final class IntrospectionHelper { |
|
|
|
try { |
|
|
|
EnumeratedAttribute ea = (EnumeratedAttribute) reflectedArg.newInstance(); |
|
|
|
ea.setValue(value); |
|
|
|
m.invoke(parent, new Object[] { ea }); |
|
|
|
m.invoke(parent, new Object[] {ea}); |
|
|
|
} catch (InstantiationException ie) { |
|
|
|
throw new BuildException(ie); |
|
|
|
} |
|
|
@@ -1128,7 +1128,7 @@ public final class IntrospectionHelper { |
|
|
|
* |
|
|
|
* @return the lower-cased method name with the prefix removed. |
|
|
|
*/ |
|
|
|
private String getPropertyName(String methodName, String prefix) { |
|
|
|
private static String getPropertyName(String methodName, String prefix) { |
|
|
|
return methodName.substring(prefix.length()).toLowerCase(Locale.US); |
|
|
|
} |
|
|
|
|
|
|
@@ -1342,13 +1342,15 @@ public final class IntrospectionHelper { |
|
|
|
Class useType = type; |
|
|
|
if (type.isPrimitive()) { |
|
|
|
if (value == null) { |
|
|
|
throw new BuildException("Attempt to set primitive " |
|
|
|
+ method.getName().substring(4) + " to null on " + parent); |
|
|
|
throw new BuildException( |
|
|
|
"Attempt to set primitive " |
|
|
|
+ getPropertyName(method.getName(), "set") |
|
|
|
+ " to null on " + parent); |
|
|
|
} |
|
|
|
useType = (Class) PRIMITIVE_TYPE_MAP.get(type); |
|
|
|
} |
|
|
|
if (value == null || useType.isInstance(value)) { |
|
|
|
method.invoke(parent, new Object[] { value }); |
|
|
|
method.invoke(parent, new Object[] {value}); |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|