Methods Summary |
---|
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 instanceof List) {
return Integer.class;
}
return null;
|
public java.util.Iterator | getFeatureDescriptors(javax.el.ELContext context, java.lang.Object base)
if (base instanceof List) {
FeatureDescriptor[] descs = new FeatureDescriptor[((List) base).size()];
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 instanceof List) {
context.setPropertyResolved(true);
List list = (List) base;
int idx = coerce(property);
if (idx < 0 || idx >= list.size()) {
return null;
}
Object obj = list.get(idx);
return (obj != null) ? obj.getClass() : null;
}
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 instanceof List) {
context.setPropertyResolved(true);
List list = (List) base;
int idx = coerce(property);
if (idx < 0 || idx >= list.size()) {
return null;
}
return list.get(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 instanceof List) {
context.setPropertyResolved(true);
List list = (List) base;
int idx = coerce(property);
if (idx < 0 || idx >= list.size()) {
throw new PropertyNotFoundException(
new ArrayIndexOutOfBoundsException(idx).getMessage());
}
return this.readOnly || UNMODIFIABLE.equals(list.getClass());
}
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 instanceof List) {
context.setPropertyResolved(true);
List list = (List) base;
if (this.readOnly) {
throw new PropertyNotWritableException(message(context,
"resolverNotWriteable", new Object[] { base.getClass()
.getName() }));
}
int idx = coerce(property);
try {
list.set(idx, value);
} catch (UnsupportedOperationException e) {
throw new PropertyNotWritableException(e);
} catch (IndexOutOfBoundsException e) {
throw new PropertyNotFoundException(e);
}
}
|