validateProfile method
Profile Name Validation
Ensures the given profile is valid before use.
Rules
- Must not be
nullor empty. - Must not start with
'!'(reserved for logical negation in profile expressions).
Throws
IllegalArgumentExceptionif validation fails.
Example
validateProfile('dev'); // OK
validateProfile(''); // throws
validateProfile('!test'); // throws
Implementation
@protected
void validateProfile(String profile) {
if (profile.isEmpty) {
throw IllegalArgumentException("Invalid profile [$profile]: must contain text");
}
if (profile.startsWith('!')) {
throw IllegalArgumentException("Invalid profile [$profile]: must not begin with ! operator");
}
}