Interface IProfile
- All Known Implementing Classes:
Profile
,ProfileDependenciesModule.TestableProfile
Clients can access any part of folder hierarchy setting by properly constructed key. Keys consist
of path to target folder and key name, all splitted with /
delimiter. Clients may use
ProfileKeys.of(...)
for convenience.
Clients can modify and remove existing folder values or add new. To apply changes clients need to
execute flush()
method.
Example of usage:
// get string value of path to infobase publication location // it is stored in folder with name "Config" with key "WebDirectory" String publicationLocation = profile.getStringValue(ProfileKeys.of("Config", "WebDirectory")); ... // set new value of path to infobase publication location with other web server // these changes will affect 1C:Enteprise Designer work profile.setStringValue(ProfileKeys.of("Config", "WebDirectory"), "D:/example_publication_folder/"); profile.setStringValue(ProfileKeys.of("Config", "WebServer"), "Apache 2.2"); // apply changes profile.flush();
IProfile
is a handle of underlying profile resource. Once it was read, it is no longer in
sync state with underlying resource. Clients can use sync()
method to sync the profile with
underlying resource.
Instances are not thread-safe and have no protection against concurrent profile underlying resources access.
- See Also:
- Restriction:
- This interface is not intended to be extended by clients.
- Restriction:
- This interface is not intended to be implemented by clients.
-
Method Summary
Modifier and TypeMethodDescriptionvoid
delete()
Delete this profile and underlying resource.void
flush()
Flush the profile.getBooleanValue
(String key) Returns theboolean
value associated with the specifiedkey
in this profile.getNumberValue
(String key) Returns theBigDecimal
value associated with the specifiedkey
in this profile.getStringValue
(String key) Returns the string value associated with the specifiedkey
in this profile.<T extends Value>
TReturns the genericValue
associated with the specifiedkey
in this profile.void
Removes the value associated with the specifiedkey
in this profile, if any.void
setBooleanValue
(String key, boolean value) Associate aboolean
value with the specifiedkey
in this profile.void
setNumberValue
(String key, BigDecimal value) Associate aBigDecimal
value with the specifiedkey
in this profile.void
setStringValue
(String key, String value) Associate aString
value with the specifiedkey
in this profile.void
Associate a genericValue
with the specifiedkey
in this profile.void
sync()
Ensures that future reads from this profile reflect any changes that were saved to the profile resource (from any sourcees - DT IDE or 1C:Enterprise processes) prior to thesync
invocation.
-
Method Details
-
getValue
Returns the genericValue
associated with the specifiedkey
in this profile. Key consist of path to target folder and key name, all splitted with/
delimiter.- Parameters:
key
- the value key, cannot benull
- Returns:
- the value or
null
if the profile has no value associated withkey
-
setValue
Associate a genericValue
with the specifiedkey
in this profile. Key consist of path to target folder and key name, all splitted with/
delimiter.- Parameters:
key
- the value key, cannot benull
value
- the value to associate, cannot benull
-
remove
Removes the value associated with the specifiedkey
in this profile, if any. Key consist of path to target folder and key name, all splitted with/
delimiter.- Parameters:
key
- the value key, cannot benull
-
getStringValue
Returns the string value associated with the specifiedkey
in this profile. Key consist of path to target folder and key name, all splitted with/
delimiter.This is convenience method that executes
getValue(String)
method and extracts actual value.- Parameters:
key
- the value key, cannot benull
- Returns:
- the value or
null
if the profile has no value associated withkey
- Throws:
ClassCastException
- if value associated with the specifiedkey
is not aString
value
-
setStringValue
Associate aString
value with the specifiedkey
in this profile. Key consist of path to target folder and key name, all splitted with/
delimiter. This is convenience method that wraps actual value and executessetValue(String, Value)
.- Parameters:
key
- the value key, cannot benull
value
- the value to associate, cannot benull
-
getBooleanValue
Returns theboolean
value associated with the specifiedkey
in this profile. Key consist of path to target folder and key name, all splitted with/
delimiter.This is convenience method that executes
getValue(String)
method and extracts actual value.- Parameters:
key
- the value key, cannot benull
- Returns:
- the value or
null
if the profile has no value associated withkey
- Throws:
ClassCastException
- if value associated with the specifiedkey
is not aboolean
value
-
setBooleanValue
Associate aboolean
value with the specifiedkey
in this profile. Key consist of path to target folder and key name, all splitted with/
delimiter. This is convenience method that wraps actual value and executessetValue(String, Value)
.- Parameters:
key
- the value key, cannot benull
value
- the value to associate, cannot benull
-
getNumberValue
Returns theBigDecimal
value associated with the specifiedkey
in this profile. Key consist of path to target folder and key name, all splitted with/
delimiter.This is convenience method that executes
getValue(String)
method and extracts actual value.- Parameters:
key
- the value key, cannot benull
- Returns:
- the value or
null
if the profile has no value associated withkey
- Throws:
ClassCastException
- if value associated with the specifiedkey
is not aBigDecimal
value
-
setNumberValue
Associate aBigDecimal
value with the specifiedkey
in this profile. Key consist of path to target folder and key name, all splitted with/
delimiter. This is convenience method that wraps actual value and executessetValue(String, Value)
.- Parameters:
key
- the value key, cannot benull
value
- the value to associate, cannot benull
-
flush
Flush the profile. All profile changes will be applied to the underlying resources.- Throws:
IOException
- if an I/0 error occurred
-
sync
Ensures that future reads from this profile reflect any changes that were saved to the profile resource (from any sourcees - DT IDE or 1C:Enterprise processes) prior to thesync
invocation.All changes will be cleared.
- Throws:
IOException
- if an I/0 error occurred
-
delete
Delete this profile and underlying resource. Once a profile has been deleted, attempting any method on the corresponding instance will fail with anIllegalStateException
.- Throws:
IOException
- if an I/0 error occurred
-