public final class PackageMethods extends Object
Modifier and Type | Class and Description |
---|---|
static class |
PackageMethods.MartiniPackageSetter
An internal class used for setting the
MartiniPackage of the ThreadLocal |
(package private) static class |
PackageMethods.PackageInheritableThreadLocal |
Modifier and Type | Field and Description |
---|---|
(package private) static ThreadLocal<EnhancedStack<MartiniPackage>> |
context |
Constructor and Description |
---|
PackageMethods() |
Modifier and Type | Method and Description |
---|---|
static MartiniPackage |
getPackage()
Get the package assigned to the current context.
|
static String |
getPackageProperty(String key)
Get the value of a package property.
|
static String |
getPackageProperty(String key,
String defaultValue)
Get the value of a package property.
|
static String[] |
getPackagePropertyArray(String key)
Get the value of a package property as an array.
|
static String[] |
getPackagePropertyArray(String key,
String[] defaultValue)
Get the value of a package property as an array.
|
static String |
getPackagePropertyComment(String key)
Get the comment of a package property, useful for understanding the property's purpose.
|
static String |
removePackageProperty(String key)
Delete a package property.
|
static String |
savePackageProperty(String key,
String value)
Save a package property.
|
static void |
savePackagePropertyComment(String key,
String comment)
Add a comment to a package property, useful for providing a description of the property.
|
static ThreadLocal<EnhancedStack<MartiniPackage>> context
public static MartiniPackage getPackage()
public static String savePackageProperty(String key, String value)
Save a package property.
Package properties are local only to a package.
This one-liner saves the property to the package in the current context;
specifically in the package's package.properties
file.
Example usage:
'key'.saveTOROProperty('value')
key
- the property keyvalue
- the property valueIllegalStateException
- if package has not been setpublic static void savePackagePropertyComment(String key, String comment)
Add a comment to a package property, useful for providing a description of the property.
Package properties are local only to a package.
This one-liner saves the property comment to the package in the current context;
specifically in the package's package.properties
file.
'key'.savePackagePropertyComment('This is a comment describing a property.')
key
- the property keycomment
- the comment to the keyIllegalStateException
- if package has not been setpublic static String getPackagePropertyComment(String key)
Get the comment of a package property, useful for understanding the property's purpose.
Package properties are local only to a package.
This one-liner fetches the property comment from the package in the current context;
specifically in the package's package.properties
file.
Example usage:
'key'.getPackagePropertyComment()
key
- the property keyIllegalStateException
- if package has not been setpublic static String[] getPackagePropertyArray(String key, String[] defaultValue)
Get the value of a package property as an array. Every comma-separated value in the property is assigned to one array element.
Package properties are local only to a package.
This one-liner fetches the property from the package in the current context;
specifically in the package's package.properties
file.
Example usage:
'key'.getPackagePropertyArray(['default', 'values'])
key
- the property keydefaultValue
- the value to return if the property doesn't existdefaultValue
if the property doesn't existIllegalStateException
- if package has not been setpublic static String[] getPackagePropertyArray(String key)
Get the value of a package property as an array. Every comma-separated value in the property is assigned to one array element.
Package properties are local only to a package.
This one-liner fetches the property from the package in the current context;
specifically in the package's package.properties
file.
Example usage:
'key'.getPackagePropertyArray()
key
- the property keynull
if the property doesn't existIllegalStateException
- if package has not been setpublic static String getPackageProperty(String key)
Get the value of a package property.
Package properties are local only to a package.
This one-liner fetches the property from the package in the current context;
specifically in the package's package.properties
file.
Example usage:
'key'.getPackageProperty()
key
- the property keynull
if the property doesn't existIllegalStateException
- if package has not been setpublic static String getPackageProperty(String key, String defaultValue)
Get the value of a package property.
Package properties are local only to a package.
This one-liner fetches the property from the package in the current context;
specifically in the package's package.properties
file.
Example usage:
'key'.getPackageProperty('defaultValue')
key
- the property keydefaultValue
- the value to return if the property doesn't existdefaultValue
if the property doesn't existIllegalStateException
- if package has not been setpublic static String removePackageProperty(String key)
Delete a package property.
Package properties are local only to a package.
This one-liner removes the property from the package in the current context;
specifically in the package's package.properties
file.
'key'.removePackageProperty()
key
- the property keyIllegalStateException
- if package has not been setCopyright © 2021. All rights reserved.