Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/.idea/
*.iml
24 changes: 24 additions & 0 deletions src/main/java/com/jagrosh/jagtag/Parser.java
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,30 @@ public synchronized Parser clear()
environment.clear();
return this;
}

/**
* Gets an item from the environment, can be used to retrieve objects after parsing
*
* @param key - the name of the object to retrieve
* @return a possibly null object with the specified key
* @see #getOrDefault(String, Object)
*/
public synchronized <T> T get(String key)
{
return environment.get(key);
}

/**
* Gets an item from the environment, can be used to retrieve objects after parsing
*
* @param key - the name of the object to retrieve
* @param defaultValue - the default value to return in case no object was found for the specified key
* @return the object stored for the key or the default value
*/
public synchronized <T> T getOrDefault(String key, T defaultValue)
{
return environment.getOrDefault(key, defaultValue);
}

/**
* Parses a String of JagTag code, utilizing the object that have been added
Expand Down