public class Profiles extends Object
Modifier and Type | Field and Description |
---|---|
static Pattern |
PATTERN_PARSE_PROFILE
Pattern to find a string that defines a single profile.
|
static Pattern |
PATTERN_PARSE_PROFILE_PARAMETERS
Pattern to find a string defining a parameter entry of a profile.
|
static Pattern |
PATTERN_VALIDATE_PROFILE_PARAMETERS
Regex to validate the parameters of a profile (the parameters string must
match this expression).
|
static Pattern |
PATTERN_VALIDATE_PROFILES_FROM_CONFIG
Regular expression to validate the structure of (a comma-separated list
of) profiles given via the configuration.
|
static Pattern |
PATTERN_VALIDATE_PROFILES_TAGGED_VALUE
Regular expression to validate the structure of a profiles tagged value.
|
static String |
PROFILES_TAGGED_VALUE
Name of the tagged value that contains the profile information.
|
Constructor and Description |
---|
Profiles() |
Profiles(Collection<ProfileIdentifier> profileIdentifiers) |
Profiles(SortedMap<String,ProfileIdentifier> profileIdentifiers) |
Modifier and Type | Method and Description |
---|---|
boolean |
contains(Profiles other,
List<String> messages) |
boolean |
contains(String ownerName,
Profiles otherProfiles,
String otherOwnerName,
boolean isExplicitProfileSettings,
boolean profileInheritance,
List<String> messages)
Checks if this set of profiles contains another set of profiles.
|
Profiles |
createCopy() |
ProfileIdentifier |
get(int index) |
ProfileIdentifier |
getProfile(String profileName) |
SortedSet<ProfileIdentifier> |
getProfileIdentifiers() |
SortedMap<String,ProfileIdentifier> |
getProfileIdentifiersByName() |
String |
getProfileParameter(String profileName,
String parameterName) |
SortedSet<ProfileIdentifier> |
getProfiles(Set<String> profileNames) |
boolean |
isEmpty() |
static Profiles |
parse(String profilesString,
boolean isProfilesFromConfig) |
ProfileIdentifier |
put(ProfileIdentifier profile)
Adds the given profile to this set of profiles.
|
void |
put(Profiles profiles)
Adds the given profiles to this set of profiles.
|
void |
put(Set<ProfileIdentifier> profiles)
Adds the given profiles to this set of profiles.
|
ProfileIdentifier |
put(String profileName)
Adds a new profile with the given name to this set of profiles.
|
int |
size() |
String |
toString() |
public static final String PROFILES_TAGGED_VALUE
public static final Pattern PATTERN_VALIDATE_PROFILES_FROM_CONFIG
public static final Pattern PATTERN_VALIDATE_PROFILES_TAGGED_VALUE
public static final Pattern PATTERN_PARSE_PROFILE
public static final Pattern PATTERN_VALIDATE_PROFILE_PARAMETERS
public static final Pattern PATTERN_PARSE_PROFILE_PARAMETERS
null
).public Profiles(SortedMap<String,ProfileIdentifier> profileIdentifiers)
public Profiles(Collection<ProfileIdentifier> profileIdentifiers)
public Profiles()
public ProfileIdentifier put(ProfileIdentifier profile)
profile
- the profile to add to this set of profilespublic ProfileIdentifier put(String profileName)
profileName
- the name of the new profile to add to this set of profilespublic static Profiles parse(String profilesString, boolean isProfilesFromConfig) throws MalformedProfileIdentifierException
profilesString
- isProfilesFromConfig
- true
if the profilesString is from the
configuration, false
if it is from the tagged
value 'profilesownerName
- name of the model element that owns the profilesStringMalformedProfileIdentifierException
public SortedMap<String,ProfileIdentifier> getProfileIdentifiersByName()
null
public SortedSet<ProfileIdentifier> getProfileIdentifiers()
null
.public boolean contains(Profiles other, List<String> messages)
other,
- shall not be null
messages
- List to store the reason(s) why this map does not contain the
other map; can be nullpublic Profiles createCopy()
public boolean isEmpty()
public boolean contains(String ownerName, Profiles otherProfiles, String otherOwnerName, boolean isExplicitProfileSettings, boolean profileInheritance, List<String> messages)
Takes into account whether or not the rule for explicit profile settings is enabled, which matters in case that a model element has no profile information.
Useful for:
ownerName
- Name of the owner of these profilesotherProfiles
- profile map that is contained in these profiles (or not)otherOwnerName
- Name of the owner of the other profilesisExplicitProfileSettings
- true
if profiles are explicitly stated (a lack of
profile assignments for a model element thus means that the
element belongs to no profile, and would thus be removed by
the profiler), else false
(in that case, a lack
of profile assignments for a class would mean that it belongs
to all profiles, while for a property it would mean that it
inherits the profiles from the class the property belongs to)profileInheritance
- true if profile inheritance shall be applied (for the
comparison of profiles of a class and one of its properties),
else false (irrelevant if rule for explicit profile settings
is enabled)messages
- used to log the reason(s) why these profiles do not contain
the other profiles; can be null
true
if these profiles contain the other profilespublic int size()
public ProfileIdentifier get(int index)
index
- 0-basednull
if
the set of profiles is empty or if the index is not in range of
the set of profilespublic ProfileIdentifier getProfile(String profileName)
profileName
- null
if no profile with that name
exists in this setpublic SortedSet<ProfileIdentifier> getProfiles(Set<String> profileNames)
profileNames
- null
or empty) but not null
public String getProfileParameter(String profileName, String parameterName)
profileName
- parameterName
- null
if the
profile does not exist, or the profile does not have any
parameters, or the profile does not define that parameter, or
that parameter has no valuepublic void put(Set<ProfileIdentifier> profiles)
profiles
- the profiles to add to this set of profilespublic void put(Profiles profiles)
profiles
- the profiles to add to this set of profilesCopyright © 2018. All rights reserved.