Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save roundrop/5849316 to your computer and use it in GitHub Desktop.
Save roundrop/5849316 to your computer and use it in GitHub Desktop.
S2RequestProcessor#setProperty(Object, String, Object) の拡張 PHPでよくある感じのattributes[]などでもActionFormにセットされるように拡張
private static final String INDEXED_DELIM = "[";
private static final String INDEXED_DELIM2 = "]";
@Override
protected void setProperty(Object bean, String name, Object value) {
if (bean == null) {
return;
}
int startIndexedIndex = name.indexOf(INDEXED_DELIM);
int endIndexedIndex = name.indexOf(INDEXED_DELIM2);
if (endIndexedIndex - startIndexedIndex == 1) {
name = StringUtil.replace(name, INDEXED_DELIM, "");
name = StringUtil.replace(name, INDEXED_DELIM2, "");
}
super.setProperty(bean, name, value);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment