Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Version 0.6 #6

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
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