public Object get(final Object object, final Object property) {
if (property instanceof Number) {
try {
return ((CharSequence) object).charAt(((Number) property).intValue());
} catch (IndexOutOfBoundsException e) {
throw new ScriptRuntimeException(StringUtil.concat("index out of bounds:", property));
}
}
if ("length".equals(property) || "size".equals(property)) {
return ((CharSequence) object).length();
}
if ("isEmpty".equals(property)) {
return ((CharSequence) object).length() == 0;
}
throw new ScriptRuntimeException(StringUtil.concat("Invalid property or can't read: java.lang.CharSequence#", property));
}