- java.lang.Object
-
- org.mal_lang.langspec.Lang
-
public final class Lang extends Object
Immutable class representing a MAL language.- Since:
- 1.0.0
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static LangfromBuilder(LangBuilder builder)Creates a newLangobject from aLangBuilder.AssetgetAsset(String name)Returns the asset with the namenamein thisLangobject.List<Asset>getAssets()Returns a list of all assets in thisLangobject.List<Association>getAssociations()Returns a list of all associations in thisLangobject.List<Category>getCategories()Returns a list of all categories in thisLangobject.CategorygetCategory(String name)Returns the category with the namenamein thisLangobject.StringgetDefine(String key)Returns the value of the define with the keykeyin thisLangobject.Map<String,String>getDefines()Returns all defines in thisLangobject.StringgetLicense()Returns the license of thisLangobject.StringgetNotice()Returns the notice of thisLangobject.booleanhasAsset(String name)Returns whethernameis the name of an asset in thisLangobject.booleanhasCategory(String name)Returns whethernameis the name of a category in thisLangobject.booleanhasDefine(String key)Returns whetherkeyis the key of a define in thisLangobject.booleanhasLicense()Returns whether thisLangobject has a license.booleanhasNotice()Returns whether thisLangobject has a notice.JsonObjecttoJson()Returns the JSON representation of thisLangobject.
-
-
-
Method Detail
-
hasDefine
public boolean hasDefine(String key)
Returns whetherkeyis the key of a define in thisLangobject.- Parameters:
key- the key of the define- Returns:
- whether
keyis the key of a define in thisLangobject - Throws:
NullPointerException- ifkeyisnull- Since:
- 1.0.0
-
getDefine
public String getDefine(String key)
Returns the value of the define with the keykeyin thisLangobject.- Parameters:
key- the key of the define- Returns:
- the value of the define with the key
keyin thisLangobject - Throws:
NullPointerException- ifkeyisnullIllegalArgumentException- ifkeyis not the key of a define in thisLangobject- Since:
- 1.0.0
-
getDefines
public Map<String,String> getDefines()
Returns all defines in thisLangobject.- Returns:
- all defines in this
Langobject - Since:
- 1.0.0
-
hasCategory
public boolean hasCategory(String name)
Returns whethernameis the name of a category in thisLangobject.- Parameters:
name- the name of the category- Returns:
- whether
nameis the name of a category in thisLangobject - Throws:
NullPointerException- ifnameisnull- Since:
- 1.0.0
-
getCategory
public Category getCategory(String name)
Returns the category with the namenamein thisLangobject.- Parameters:
name- the name of the category- Returns:
- the category with the name
namein thisLangobject - Throws:
NullPointerException- ifnameisnullIllegalArgumentException- ifnameis not the name of a category in thisLangobject- Since:
- 1.0.0
-
getCategories
public List<Category> getCategories()
Returns a list of all categories in thisLangobject.- Returns:
- a list of all categories in this
Langobject - Since:
- 1.0.0
-
hasAsset
public boolean hasAsset(String name)
Returns whethernameis the name of an asset in thisLangobject.- Parameters:
name- the name of the asset- Returns:
- whether
nameis the name of an asset in thisLangobject - Throws:
NullPointerException- ifnameisnull- Since:
- 1.0.0
-
getAsset
public Asset getAsset(String name)
Returns the asset with the namenamein thisLangobject.- Parameters:
name- the name of the asset- Returns:
- the asset with the name
namein thisLangobject - Throws:
NullPointerException- ifnameisnullIllegalArgumentException- ifnameis not the name of an asset in thisLangobject- Since:
- 1.0.0
-
getAssets
public List<Asset> getAssets()
Returns a list of all assets in thisLangobject.- Returns:
- a list of all assets in this
Langobject - Since:
- 1.0.0
-
getAssociations
public List<Association> getAssociations()
Returns a list of all associations in thisLangobject.- Returns:
- a list of all associations in this
Langobject - Since:
- 1.0.0
-
hasLicense
public boolean hasLicense()
Returns whether thisLangobject has a license.- Returns:
- whether this
Langobject has a license - Since:
- 1.0.0
-
getLicense
public String getLicense()
Returns the license of thisLangobject.- Returns:
- the license of this
Langobject - Throws:
UnsupportedOperationException- if thisLangobject does not have a license- Since:
- 1.0.0
-
hasNotice
public boolean hasNotice()
Returns whether thisLangobject has a notice.- Returns:
- whether this
Langobject has a notice - Since:
- 1.0.0
-
getNotice
public String getNotice()
Returns the notice of thisLangobject.- Returns:
- the notice of this
Langobject - Throws:
UnsupportedOperationException- if thisLangobject does not have a notice- Since:
- 1.0.0
-
toJson
public JsonObject toJson()
Returns the JSON representation of thisLangobject.- Returns:
- the JSON representation of this
Langobject - Since:
- 1.0.0
-
fromBuilder
public static Lang fromBuilder(LangBuilder builder)
Creates a newLangobject from aLangBuilder.- Parameters:
builder- theLangBuilder- Returns:
- a new
Langobject - Throws:
NullPointerException- ifbuilderisnull- Since:
- 1.0.0
-
-