- 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 Lang
fromBuilder(LangBuilder builder)
Creates a newLang
object from aLangBuilder
.Asset
getAsset(String name)
Returns the asset with the namename
in thisLang
object.List<Asset>
getAssets()
Returns a list of all assets in thisLang
object.List<Association>
getAssociations()
Returns a list of all associations in thisLang
object.List<Category>
getCategories()
Returns a list of all categories in thisLang
object.Category
getCategory(String name)
Returns the category with the namename
in thisLang
object.String
getDefine(String key)
Returns the value of the define with the keykey
in thisLang
object.Map<String,String>
getDefines()
Returns all defines in thisLang
object.String
getLicense()
Returns the license of thisLang
object.String
getNotice()
Returns the notice of thisLang
object.boolean
hasAsset(String name)
Returns whethername
is the name of an asset in thisLang
object.boolean
hasCategory(String name)
Returns whethername
is the name of a category in thisLang
object.boolean
hasDefine(String key)
Returns whetherkey
is the key of a define in thisLang
object.boolean
hasLicense()
Returns whether thisLang
object has a license.boolean
hasNotice()
Returns whether thisLang
object has a notice.JsonObject
toJson()
Returns the JSON representation of thisLang
object.
-
-
-
Method Detail
-
hasDefine
public boolean hasDefine(String key)
Returns whetherkey
is the key of a define in thisLang
object.- Parameters:
key
- the key of the define- Returns:
- whether
key
is the key of a define in thisLang
object - Throws:
NullPointerException
- ifkey
isnull
- Since:
- 1.0.0
-
getDefine
public String getDefine(String key)
Returns the value of the define with the keykey
in thisLang
object.- Parameters:
key
- the key of the define- Returns:
- the value of the define with the key
key
in thisLang
object - Throws:
NullPointerException
- ifkey
isnull
IllegalArgumentException
- ifkey
is not the key of a define in thisLang
object- Since:
- 1.0.0
-
getDefines
public Map<String,String> getDefines()
Returns all defines in thisLang
object.- Returns:
- all defines in this
Lang
object - Since:
- 1.0.0
-
hasCategory
public boolean hasCategory(String name)
Returns whethername
is the name of a category in thisLang
object.- Parameters:
name
- the name of the category- Returns:
- whether
name
is the name of a category in thisLang
object - Throws:
NullPointerException
- ifname
isnull
- Since:
- 1.0.0
-
getCategory
public Category getCategory(String name)
Returns the category with the namename
in thisLang
object.- Parameters:
name
- the name of the category- Returns:
- the category with the name
name
in thisLang
object - Throws:
NullPointerException
- ifname
isnull
IllegalArgumentException
- ifname
is not the name of a category in thisLang
object- Since:
- 1.0.0
-
getCategories
public List<Category> getCategories()
Returns a list of all categories in thisLang
object.- Returns:
- a list of all categories in this
Lang
object - Since:
- 1.0.0
-
hasAsset
public boolean hasAsset(String name)
Returns whethername
is the name of an asset in thisLang
object.- Parameters:
name
- the name of the asset- Returns:
- whether
name
is the name of an asset in thisLang
object - Throws:
NullPointerException
- ifname
isnull
- Since:
- 1.0.0
-
getAsset
public Asset getAsset(String name)
Returns the asset with the namename
in thisLang
object.- Parameters:
name
- the name of the asset- Returns:
- the asset with the name
name
in thisLang
object - Throws:
NullPointerException
- ifname
isnull
IllegalArgumentException
- ifname
is not the name of an asset in thisLang
object- Since:
- 1.0.0
-
getAssets
public List<Asset> getAssets()
Returns a list of all assets in thisLang
object.- Returns:
- a list of all assets in this
Lang
object - Since:
- 1.0.0
-
getAssociations
public List<Association> getAssociations()
Returns a list of all associations in thisLang
object.- Returns:
- a list of all associations in this
Lang
object - Since:
- 1.0.0
-
hasLicense
public boolean hasLicense()
Returns whether thisLang
object has a license.- Returns:
- whether this
Lang
object has a license - Since:
- 1.0.0
-
getLicense
public String getLicense()
Returns the license of thisLang
object.- Returns:
- the license of this
Lang
object - Throws:
UnsupportedOperationException
- if thisLang
object does not have a license- Since:
- 1.0.0
-
hasNotice
public boolean hasNotice()
Returns whether thisLang
object has a notice.- Returns:
- whether this
Lang
object has a notice - Since:
- 1.0.0
-
getNotice
public String getNotice()
Returns the notice of thisLang
object.- Returns:
- the notice of this
Lang
object - Throws:
UnsupportedOperationException
- if thisLang
object does not have a notice- Since:
- 1.0.0
-
toJson
public JsonObject toJson()
Returns the JSON representation of thisLang
object.- Returns:
- the JSON representation of this
Lang
object - Since:
- 1.0.0
-
fromBuilder
public static Lang fromBuilder(LangBuilder builder)
Creates a newLang
object from aLangBuilder
.- Parameters:
builder
- theLangBuilder
- Returns:
- a new
Lang
object - Throws:
NullPointerException
- ifbuilder
isnull
- Since:
- 1.0.0
-
-