Skip to content

Commit dfed65f

Browse files
committed
ScriptInfo: generalize attr values to Object
This will come in handy shortly when we switch to SJEP.
1 parent 1e9c40d commit dfed65f

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/main/java/org/scijava/script/ScriptInfo.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -347,7 +347,7 @@ private void parseParam(final String param) throws ScriptException {
347347
}
348348

349349
private void parseParam(final String param,
350-
final HashMap<String, String> attrs) throws ScriptException
350+
final HashMap<String, Object> attrs) throws ScriptException
351351
{
352352
final String[] tokens = param.trim().split("[ \t\n]+");
353353
checkValid(tokens.length >= 1, param);
@@ -371,11 +371,11 @@ private void parseParam(final String param,
371371
}
372372

373373
/** Parses a comma-delimited list of {@code key=value} pairs into a map. */
374-
private HashMap<String, String> parseAttrs(final String attrs)
374+
private HashMap<String, Object> parseAttrs(final String attrs)
375375
throws ScriptException
376376
{
377377
// TODO: We probably want to use a real CSV parser.
378-
final HashMap<String, String> attrsMap = new HashMap<String, String>();
378+
final HashMap<String, Object> attrsMap = new HashMap<String, Object>();
379379
for (final String token : attrs.split(",")) {
380380
if (token.isEmpty()) continue;
381381
final int equals = token.indexOf("=");
@@ -402,18 +402,18 @@ private void checkValid(final boolean valid, final String param)
402402

403403
/** Adds an output for the value returned by the script itself. */
404404
private void addReturnValue() throws ScriptException {
405-
final HashMap<String, String> attrs = new HashMap<String, String>();
405+
final HashMap<String, Object> attrs = new HashMap<String, Object>();
406406
attrs.put("type", "OUTPUT");
407407
addItem(ScriptModule.RETURN_VALUE, Object.class, attrs);
408408
}
409409

410410
private <T> void addItem(final String name, final Class<T> type,
411-
final Map<String, String> attrs) throws ScriptException
411+
final Map<String, Object> attrs) throws ScriptException
412412
{
413413
final DefaultMutableModuleItem<T> item =
414414
new DefaultMutableModuleItem<T>(this, name, type);
415415
for (final String key : attrs.keySet()) {
416-
final String value = attrs.get(key);
416+
final Object value = attrs.get(key);
417417
assignAttribute(item, key, value);
418418
}
419419
if (item.isInput()) registerInput(item);

0 commit comments

Comments
 (0)