Methods Summary |
---|
private static final void | checkBounds(java.lang.Object base, int idx)
if (idx < 0 || idx >= Array.getLength(base)) {
throw new PropertyNotFoundException(
new ArrayIndexOutOfBoundsException(idx).getMessage());
}
|
private static final int | coerce(java.lang.Object property)
if (property instanceof Number) {
return ((Number) property).intValue();
}
if (property instanceof Character) {
return ((Character) property).charValue();
}
if (property instanceof Boolean) {
return (((Boolean) property).booleanValue() ? 1 : 0);
}
if (property instanceof String) {
return Integer.parseInt((String) property);
}
throw new IllegalArgumentException(property != null ? property
.toString() : "null");
|
public java.lang.Class | getCommonPropertyType(javax.el.ELContext context, java.lang.Object base)
if (base != null && base.getClass().isArray()) {
return Integer.class;
}
return null;
|
public java.util.Iterator | getFeatureDescriptors(javax.el.ELContext context, java.lang.Object base)
if (base != null && base.getClass().isArray()) {
FeatureDescriptor[] descs = new FeatureDescriptor[Array.getLength(base)];
for (int i = 0; i < descs.length; i++) {
descs[i] = new FeatureDescriptor();
descs[i].setDisplayName("["+i+"]");
descs[i].setExpert(false);
descs[i].setHidden(false);
descs[i].setName(""+i);
descs[i].setPreferred(true);
descs[i].setValue(RESOLVABLE_AT_DESIGN_TIME, Boolean.FALSE);
descs[i].setValue(TYPE, Integer.class);
}
return Arrays.asList(descs).iterator();
}
return null;
|
public java.lang.Class | getType(javax.el.ELContext context, java.lang.Object base, java.lang.Object property)
if (context == null) {
throw new NullPointerException();
}
if (base != null && base.getClass().isArray()) {
context.setPropertyResolved(true);
int idx = coerce(property);
checkBounds(base, idx);
return base.getClass().getComponentType();
}
return null;
|
public java.lang.Object | getValue(javax.el.ELContext context, java.lang.Object base, java.lang.Object property)
if (context == null) {
throw new NullPointerException();
}
if (base != null && base.getClass().isArray()) {
context.setPropertyResolved(true);
int idx = coerce(property);
if (idx < 0 || idx >= Array.getLength(base)) {
return null;
} else {
return Array.get(base, idx);
}
}
return null;
|
public boolean | isReadOnly(javax.el.ELContext context, java.lang.Object base, java.lang.Object property)
if (context == null) {
throw new NullPointerException();
}
if (base != null && base.getClass().isArray()) {
context.setPropertyResolved(true);
int idx = coerce(property);
checkBounds(base, idx);
}
return this.readOnly;
|
public void | setValue(javax.el.ELContext context, java.lang.Object base, java.lang.Object property, java.lang.Object value)
if (context == null) {
throw new NullPointerException();
}
if (base != null && base.getClass().isArray()) {
context.setPropertyResolved(true);
if (this.readOnly) {
throw new PropertyNotWritableException(message(context,
"resolverNotWriteable", new Object[] { base.getClass()
.getName() }));
}
int idx = coerce(property);
checkBounds(base, idx);
Array.set(base, idx, value);
}
|