Skip to content

Commit

Permalink
ability to get config items via var args
Browse files Browse the repository at this point in the history
  • Loading branch information
lmajano committed Apr 12, 2024
1 parent 3c748a9 commit 9fde4f8
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 3 deletions.
15 changes: 13 additions & 2 deletions src/main/java/ortus/boxlang/runtime/context/BaseBoxContext.java
Original file line number Diff line number Diff line change
Expand Up @@ -965,8 +965,19 @@ public IStruct getConfig() {
*
* @return
*/
public Object getConfigItem( Key itemKey ) {
return getConfig().get( itemKey );
public Object getConfigItem( Key... itemKey ) {
IStruct config = getConfig();
Object lastResult = null;

for ( Key key : itemKey ) {
if ( config.containsKey( key ) ) {
lastResult = config.get( key );
} else {
break;
}
}

return lastResult;
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -522,7 +522,7 @@ public Key[] getAssignmentKeys( Key... keys ) {
*
* @return
*/
public Object getConfigItem( Key itemKey );
public Object getConfigItem( Key... itemKey );

/**
* Convenience method to retrieve a config item with with an optional default
Expand Down

0 comments on commit 9fde4f8

Please sign in to comment.