public class ERXProperties extends Properties implements com.webobjects.foundation.NSKeyValueCoding
getBoolean
off of Boolean which would resolve
the System property as a Boolean object.
Properties can be set in all the following places:
getBoolean
などがあればいいのです。
Name | Description |
---|---|
er.extensions.ERXProperties.RetainDefaultsEnabled | er.extensions.ERXProperties.RetainDefaultsEnabled |
NSProperties.useLoadtimeAppSpecifics | Default is true. |
er.extensions.ERXProperties.loadOptionalProperties | Default is true. When false loads only the standard properties. This will improve application startup time due to not looking for all files repeatedly. TODO - Neither of these property names are standard. Should be camel-case and proper prefix. TODO - What character sets can you use in property names? Only ISO-8859-1? UTF-8? TODO - If this would fallback to calling the System getProperty, we could ask that Project Wonder frameworks only use this class. |
Modifier and Type | Class and Description |
---|---|
static class |
ERXProperties._Properties
_Properties is a subclass of Properties that provides support for including other
Properties files on the fly.
|
static class |
ERXProperties.EncryptedOperator
Encrypted operator supports decrypting values using the default crypter.
|
static class |
ERXProperties.InIpRangeOperator
InIpRangeOperator は指定IPレンジ内のあるプロパティーをセットする処理をサポートします。
|
static class |
ERXProperties.InRangeOperator
InRangeOperator provides support for defining properties that only
get set if a value falls within a specific range of values.
|
static interface |
ERXProperties.Operator
Property operators work like array operators.
|
static class |
ERXProperties.Property |
com.webobjects.foundation.NSKeyValueCoding._BooleanFieldBinding, com.webobjects.foundation.NSKeyValueCoding._BooleanMethodBinding, com.webobjects.foundation.NSKeyValueCoding._FieldBinding, com.webobjects.foundation.NSKeyValueCoding._ForwardingBinding, com.webobjects.foundation.NSKeyValueCoding._KeyBinding, com.webobjects.foundation.NSKeyValueCoding._KeyBindingCreation, com.webobjects.foundation.NSKeyValueCoding._MethodBinding, com.webobjects.foundation.NSKeyValueCoding._NumberFieldBinding, com.webobjects.foundation.NSKeyValueCoding._NumberMethodBinding, com.webobjects.foundation.NSKeyValueCoding._ReflectionKeyBindingCreation, com.webobjects.foundation.NSKeyValueCoding.DefaultImplementation, com.webobjects.foundation.NSKeyValueCoding.ErrorHandling, com.webobjects.foundation.NSKeyValueCoding.MapImplementation, com.webobjects.foundation.NSKeyValueCoding.Null<T>, com.webobjects.foundation.NSKeyValueCoding.UnknownKeyException, com.webobjects.foundation.NSKeyValueCoding.Utility, com.webobjects.foundation.NSKeyValueCoding.ValueAccessor
Modifier and Type | Field and Description |
---|---|
static boolean |
_useLoadtimeAppSpecifics
This boolean controls the behavior of application specific properties.
|
protected String |
applicationNameForAppending
caches the application name that is appended to the key for lookup
|
static String |
DefaultString
default string
|
static String |
UNKNOWN_WONDER_VERSION
constant string used if Wonder version could not be determined
|
defaults
Constructor and Description |
---|
ERXProperties() |
Modifier and Type | Method and Description |
---|---|
static NSArray<ERXProperties.Property> |
allProperties()
全プロパティーの配列を戻します
|
static Map<String,String> |
allPropertiesMap(boolean protectValues)
Returns all of the properties in the system mapped to their evaluated values, sorted by key.
|
static String |
applicationDeveloperProperties()
Returns the application-specific user properties.
|
static String |
applicationMachinePropertiesPath(String fileName)
Returns the path to the application-specific system-wide file "fileName".
|
protected String |
applicationNameForAppending()
Caches the application name for appending to the key.
|
static String |
applicationUserProperties()
Returns the application-specific user properties.
|
static Properties |
applyConfiguration(Properties source,
Properties commandLine)
Apply the current configuration to the supplied properties.
|
static NSArray<String> |
arrayForKey(String s)
Cover method for returning an NSArray for a
given system property.
|
static NSArray<String> |
arrayForKeyWithDefault(String s,
NSArray<String> defaultValue)
Cover method for returning an NSArray for a
given system property and set a default value if not given.
|
static BigDecimal |
bigDecimalForKey(String s)
Cover method for returning a BigDecimal for a
given system property.
|
static BigDecimal |
bigDecimalForKeyWithDefault(String s,
BigDecimal defaultValue)
Cover method for returning a BigDecimal for a
given system property or a default value.
|
static boolean |
booleanForKey(String s)
Cover method for returning a boolean for a
given system property.
|
static boolean |
booleanForKeyWithDefault(String s,
boolean defaultValue)
Cover method for returning a boolean for a
given system property or a default value.
|
static NSArray<String> |
componentsSeparatedByString(String key,
String separator)
Returns an array of strings separated with the given separator string.
|
static NSArray<String> |
componentsSeparatedByStringWithDefault(String key,
String separator,
NSArray<String> defaultValue)
Returns an array of strings separated with the given separator string.
|
static String |
decryptedStringForKey(String propertyName)
Returns the decrypted value for the given property name using
the default crypter if the property propertyName.encrypted=true.
|
static String |
decryptedStringForKeyWithDefault(String propertyName,
String defaultValue)
If the
propertyName.encrypted property is set to true, returns
the plain text value of the given property name, after decrypting it with the
ERXCrypto.defaultCrypter() . |
static String |
decryptedStringForKeyWithEncryptedDefault(String propertyName,
String defaultValue)
Returns the decrypted value for the given property name using the
ERXCrypto.defaultCrypter() . |
static NSDictionary |
dictionaryForKey(String s)
Cover method for returning an NSDictionary for a
given system property.
|
static NSDictionary |
dictionaryForKeyWithDefault(String s,
NSDictionary defaultValue)
dictionaryForKeyWithDefault
Cover method for returning an NSDictionary for a
given system property or the default value.
|
static double |
doubleForKey(String s)
Cover method for returning a double for a
given system property.
|
static double |
doubleForKeyWithDefault(String s,
double defaultValue)
Cover method for returning a double for a
given system property with a default value.
|
static <T extends Enum> |
enumValueForKey(Class<T> enumClass,
String key)
Returns an enum value for a given enum class and system property.
|
static <T extends Enum> |
enumValueForKeyWithDefault(Class<T> enumClass,
String key,
T defaultValue)
Returns an enum value for a given enum class and system property.
|
static void |
evaluatePropertyOperators(Properties originalProperties,
Properties destinationProperties)
For each property in originalProperties, process the keys and values with
the registered property operators and stores the converted value into
destinationProperties.
|
static void |
flattenPropertyNames(Properties properties)
For every application specific property, this method generates a similar property without
the application name in the property key.
|
static float |
floatForKey(String s)
Cover method for returning a float for a
given system property.
|
static float |
floatForKeyWithDefault(String s,
float defaultValue)
Cover method for returning a float for a
given system property with a default value.
|
static ERXProperties |
fromExternalForm(String string)
Load the properties from a String in Property file format.
|
static String |
getActualPath(String path)
Returns actual full path to the given file system path
that could contain symbolic links.
|
String |
getProperty(String key)
Overriding the default getProperty method to first check:
key.<ApplicationName> before checking for key.
|
static boolean |
hasKey(String key)
Checks if a property for the given key exists.
|
static boolean |
hasKey(String key,
boolean ignoreEmptyValue)
Checks if a property for the given key exists.
|
static int |
intForKey(String s)
Cover method for returning an int for a
given system property.
|
static int |
intForKeyWithDefault(String s,
int defaultValue)
Cover method for returning an int for a
given system property with a default value.
|
static String |
logString(Properties properties)
Returns a string suitable for logging.
|
static long |
longForKey(String s)
Cover method for returning a long for a
given system property.
|
static long |
longForKeyWithDefault(String s,
long defaultValue)
Cover method for returning a long for a
given system property with a default value.
|
static NSArray |
optionalConfigurationFiles()
Gets an array of optionally defined configuration files.
|
static String |
pathForPropertiesUnderProjectPath(String projectPath)
Returns the full path to the Properties file under the
given project path.
|
static NSArray |
pathsForUserAndBundleProperties()
Returns an array of paths to the
Properties and
WebObjects.properties files contained in the
application/framework bundles and home directory. |
static NSArray<String> |
pathsForUserAndBundleProperties(boolean reportLoggingEnabled) |
static void |
populateSystemProperties()
Puts handy properties such as
com.webobjects.version
into the system properties. |
static Properties |
propertiesFromArgv(String[] argv)
Sets and returns properties object with the values from
the given command line arguments string array.
|
static Properties |
propertiesFromFile(File file)
Gets the properties for a given file.
|
static Properties |
propertiesFromPath(String path)
Reads a Java properties file at the given path
and returns a
Properties object
as the result. |
static Map<String,String> |
propertiesMap(Properties properties,
boolean protectValues)
Returns all of the properties in the system mapped to their evaluated values, sorted by key.
|
static void |
removeKey(String key)
キーを削除します
|
static void |
setArrayForKey(NSArray array,
String key)
Sets an array in the System properties for
a particular key.
|
static void |
setDictionaryForKey(NSDictionary dictionary,
String key)
Sets a dictionary in the System properties for
a particular key.
|
static void |
setOperatorForKey(ERXProperties.Operator operator,
String key)
Registers a property operator for a particular key.
|
static void |
setStringForKey(String string,
String key)
Sets a string in the System properties for
another string.
|
static String |
sourceVersionString()
Returns the version string of the given framework.
|
static String |
stringFor2Keys(String s1,
String s2)
システム・プロパティーの結果を String で戻します。
最大2つのキーを指定可能で、最初に見つかったキーを使用します。
|
static String |
stringFor2KeysWithDefault(String s1,
String s2,
String defaultValue)
システム・プロパティーの結果を String で戻します。
最大2つのキーを指定可能で、最初に見つかったキーを使用します。
|
static String |
stringFor3Keys(String s1,
String s2,
String s3)
システム・プロパティーの結果を String で戻します。
最大3つのキーを指定可能で、最初に見つかったキーを使用します。
|
static String |
stringFor3KeysWithDefault(String s1,
String s2,
String s3,
String defaultValue)
システム・プロパティーの結果を String で戻します。
最大3つのキーを指定可能で、最初に見つかったキーを使用します。
|
static String |
stringForKey(String s)
Returning an string for a given system
property.
|
static String |
stringForKeyWithDefault(String s,
String defaultValue)
Returning an string for a given system
property.
|
static String |
stringForManyKeys(String[] ss)
システム・プロパティーの結果を String で戻します。
キーは文字列配列で渡され配列要素位置0から開始し最初に見つかったキーを使用します。
|
static String |
stringForManyKeysWithDefault(String[] ss,
String defaultValue)
システム・プロパティーの結果やデフォルト値を String で戻します。
キーは文字列配列で渡され配列要素位置0から開始し最初に見つかったキーを使用します。
|
static void |
systemPropertiesChanged()
システム・プロパティーが変更されたので、キャシュをクリアする
|
void |
takeValueForKey(Object anObject,
String aKey) |
Object |
toExternalForm()
Returns the properties as a String in Property file format.
|
static void |
transferPropertiesFromSourceToDest(Properties source,
Properties dest)
Copies all properties from source to dest.
|
Object |
valueForKey(String aKey) |
static String |
valueFromPlistBundleWithKey(com.webobjects.foundation.NSBundle bundle,
String plist,
String key)
Returns the key in an plist of the given framework.
|
static String |
variantPropertiesInBundle(String userName,
String bundleName)
Returns the application-specific variant properties for the given bundle.
|
static String |
versionStringForApplication()
Returns the version string of the application.
|
static String |
versionStringForFrameworkNamed(String frameworkName)
Returns the version string of the given framework.
|
static String |
wonderVersion()
Returns the version string of the Wonder frameworks.
|
getProperty, list, list, load, load, loadFromXML, propertyNames, save, setProperty, store, store, storeToXML, storeToXML, stringPropertyNames
clear, clone, compute, computeIfAbsent, computeIfPresent, contains, containsKey, containsValue, elements, entrySet, equals, forEach, get, getOrDefault, hashCode, isEmpty, keys, keySet, merge, put, putAll, putIfAbsent, rehash, remove, remove, replace, replace, replaceAll, size, toString, values
public static final String DefaultString
public static final boolean _useLoadtimeAppSpecifics
The old behavior will retain the original property names (including the application name), and will search for an application specific version of each property every time someone reads a property.
The new behavior will analyze all properties after being loaded from their source, and create (or update) generic properties for each application specific one. So, if we are MyApp, foo.bar.MyApp=4 will originate a new property foo.bar=4 (or, if foo.bar already exists, update its value to 4). foo.bar.MyApp is also kept, because we cannot be sure foo.bar.MyApp is an app specific property or a regular property with an ambiguous name.
The advantage of the new method is getting rid of the performance hit each time an app accesses a property, and making application specific properties work for code that uses the native Java System.getProperty call.
public static final String UNKNOWN_WONDER_VERSION
protected String applicationNameForAppending
public static void populateSystemProperties()
com.webobjects.version
into the system properties. This method is called when
the framework is initialized
(when WOApplication.ApplicationWillFinishLaunchingNotification
is posted.)
com.webobjects.version
をシステム・プロパティーへセットします。
フレームワークが初期化される時に呼ばれます。
(WOApplication.ApplicationWillFinishLaunchingNotification 発行時)
public static String versionStringForApplication()
CFBundleShortVersionString
property
in the info.plist
resource and returns
a trimmed version of the value.
CFBundleShortVersionString
in its info.plist
resource.versionStringForFrameworkNamed(java.lang.String)
,
#webObjectsVersion
public static String versionStringForFrameworkNamed(String frameworkName)
CFBundleShortVersionString
property
in the info.plist
resource and returns
a trimmed version of the value.
frameworkName
- CFBundleShortVersionString
in its info.plist
resource.versionStringForApplication()
,
#webObjectsVersion()
,
ERXStringUtilities.removeExtraDotsFromVersionString(String)
public static String sourceVersionString()
SourceVersion
property
in the version.plist
resource and returns
a trimmed version of the value.
SourceVersion
プロパティーを調べ、Trimした結果を戻します
SourceVersion
in its info.plist
resource.versionStringForApplication()
,
#webObjectsVersion
public static String valueFromPlistBundleWithKey(com.webobjects.foundation.NSBundle bundle, String plist, String key)
bundle
- plist
- key
- public static String wonderVersion()
public static NSArray<String> arrayForKey(String s)
s
- public static NSArray<String> arrayForKeyWithDefault(String s, NSArray<String> defaultValue)
s
- defaultValue
- public static boolean booleanForKey(String s)
booleanValue
from
ERXUtilities
.
s
- public static boolean booleanForKeyWithDefault(String s, boolean defaultValue)
booleanValue
from
ERXUtilities
.
s
- defaultValue
- public static NSDictionary dictionaryForKey(String s)
s
- public static NSDictionary dictionaryForKeyWithDefault(String s, NSDictionary defaultValue)
s
- defaultValue
- public static boolean hasKey(String key)
key
- name of the propertytrue
if a property for key existspublic static boolean hasKey(String key, boolean ignoreEmptyValue)
true
as parameter (i.e. 'my.property=
').key
- name of the propertyignoreEmptyValue
- true
if you want to ignore
properties with empty valuestrue
if a property existspublic static int intForKey(String s)
s
- public static long longForKey(String s)
s
- public static float floatForKey(String s)
s
- public static double doubleForKey(String s)
s
- public static BigDecimal bigDecimalForKey(String s)
bigDecimalValueWithDefault
from
ERXValueUtilities
.
s
- public static BigDecimal bigDecimalForKeyWithDefault(String s, BigDecimal defaultValue)
bigDecimalValueWithDefault
from
ERXValueUtilities
.
s
- defaultValue
- public static int intForKeyWithDefault(String s, int defaultValue)
s
- defaultValue
- public static long longForKeyWithDefault(String s, long defaultValue)
s
- defaultValue
- public static float floatForKeyWithDefault(String s, float defaultValue)
s
- defaultValue
- public static double doubleForKeyWithDefault(String s, double defaultValue)
s
- defaultValue
- public static String stringForKey(String s)
System.getProperty(java.lang.String)
s
- public static String stringForKeyWithDefault(String s, String defaultValue)
System.getProperty(java.lang.String)
s
- defaultValue
- public static String decryptedStringForKey(String propertyName)
ERXCrypto.defaultCrypter()
を使用します。
propertyName
- public static String decryptedStringForKeyWithDefault(String propertyName, String defaultValue)
propertyName.encrypted
property is set to true, returns
the plain text value of the given property name, after decrypting it with the
ERXCrypto.defaultCrypter()
. For instance, if you are requesting
my.password and my.password.encrypted
is set to true,
the value of my.password
will be sent to the default crypter's
decrypt() method.
ERXCrypto.defaultCrypter()
を使用します。
propertyName
- defaultValue
- public static String decryptedStringForKeyWithEncryptedDefault(String propertyName, String defaultValue)
ERXCrypto.defaultCrypter()
. This is slightly different than
decryptedStringWithKeyWithDefault in that it does not require the encrypted
property to be set.
ERXCrypto.defaultCrypter()
を使用します。
propertyName
- defaultValue
- public static NSArray<String> componentsSeparatedByString(String key, String separator)
key
- separator
- public static NSArray<String> componentsSeparatedByStringWithDefault(String key, String separator, NSArray<String> defaultValue)
key
- separator
- defaultValue
- public static <T extends Enum> T enumValueForKey(Class<T> enumClass, String key)
null
will be returned. The search for the
enum value is case insensitive, i.e. a property value "foo" will match the enum constant
FOO
.enumClass
- the enum classkey
- the property keypublic static <T extends Enum> T enumValueForKeyWithDefault(Class<T> enumClass, String key, T defaultValue)
FOO
.enumClass
- the enum classkey
- the property keydefaultValue
- the default valuepublic static void setArrayForKey(NSArray array, String key)
array
- key
- public static void setDictionaryForKey(NSDictionary dictionary, String key)
dictionary
- key
- public static void setStringForKey(String string, String key)
string
- key
- public static void removeKey(String key)
key
- - キー
public static void transferPropertiesFromSourceToDest(Properties source, Properties dest)
source
- dest
- public static Properties propertiesFromPath(String path)
Properties
object
as the result. If the file does not exist, returns
an empty properties object.
Properties
オブジェクトとして戻します。
ファイルが存在していなければ、empty プロパティー・オブジェクトが戻ります。
path
- public static Properties propertiesFromFile(File file) throws IOException
file
- IOException
- if the file is not found or cannot be readpublic static Properties propertiesFromArgv(String[] argv)
argv
- public static NSArray pathsForUserAndBundleProperties()
Properties
and
WebObjects.properties
files contained in the
application/framework bundles and home directory.
If ProjectBuilder (for Mac OS X) has the project opened, it will attempt to get the path to the one in the project directory instead of the one in the bundle.
This opened project detection feature is pretty fragile and will change between versions of the dev-tools.
Properties
と
WebObjects.properties
ファイルへのファイル・パス配列を戻します
プロジェクト・ビルダーがプロジェクトを開いていれば、バンドルではなく、プロジェクトへのパスが戻されます。
開いているプロジェクト問題は開発ツールによって違っています。
public static NSArray<String> pathsForUserAndBundleProperties(boolean reportLoggingEnabled)
public static Properties applyConfiguration(Properties source, Properties commandLine)
source
- commandLine
- public static Map<String,String> allPropertiesMap(boolean protectValues)
protectValues
- public static Map<String,String> propertiesMap(Properties properties, boolean protectValues)
properties
- protectValues
- if true
, keys with the word "password" in them will have their values removedpublic static String logString(Properties properties)
properties
- public static NSArray<ERXProperties.Property> allProperties()
public static String pathForPropertiesUnderProjectPath(String projectPath)
projectPath
- public static String applicationDeveloperProperties()
public static String variantPropertiesInBundle(String userName, String bundleName)
userName
- bundleName
- public static String applicationUserProperties()
public static String applicationMachinePropertiesPath(String fileName)
fileName
- public static NSArray optionalConfigurationFiles()
public static String getActualPath(String path)
path
- public static void systemPropertiesChanged()
protected String applicationNameForAppending()
Note: this is redundant with the scheme checked in on March 21, 2005 by clloyd (ben holt did checkin). This scheme requires the user to swizzle the existing properties file with a new one of this type.
public String getProperty(String key)
getProperty
in class Properties
key
- public Object toExternalForm() throws IOException
IOException
public static ERXProperties fromExternalForm(String string)
string
-
public void takeValueForKey(Object anObject, String aKey)
takeValueForKey
in interface com.webobjects.foundation.NSKeyValueCoding
public Object valueForKey(String aKey)
valueForKey
in interface com.webobjects.foundation.NSKeyValueCoding
public static void setOperatorForKey(ERXProperties.Operator operator, String key)
operator
- key
- public static void evaluatePropertyOperators(Properties originalProperties, Properties destinationProperties)
originalProperties
- destinationProperties
- public static void flattenPropertyNames(Properties properties)
Ex: if current application is MyApp, for a property foo.bar.MyApp=true a new property foo.bar=true is generated.
properties
- Properties to updatepublic static String stringFor2Keys(String s1, String s2)
s1
- - キー1(システム・プロパティー内)s2
- - キー2(システム・プロパティー内)public static String stringFor2KeysWithDefault(String s1, String s2, String defaultValue)
s1
- - キー1(システム・プロパティー内)s2
- - キー2(システム・プロパティー内)defaultValue
- - デフォルト値public static String stringFor3Keys(String s1, String s2, String s3)
s1
- - キー1(システム・プロパティー内)s2
- - キー2(システム・プロパティー内)s3
- - キー3(システム・プロパティー内)public static String stringFor3KeysWithDefault(String s1, String s2, String s3, String defaultValue)
s1
- - キー1(システム・プロパティー内)s2
- - キー2(システム・プロパティー内)s3
- - キー3(システム・プロパティー内)defaultValue
- - デフォルト値public static String stringForManyKeys(String[] ss)
ss
- - キーs(システム・プロパティー内)Copyright © 2002 – 2020 Project Wonder.