public class LabelParser extends Object
The following are considered valid label strings.
my:label: a user label owned by the currently logged in user. If no user is logged in, this defaults to the global label of the same name..
label: a global label.
~username:label: a user label owned by the specified user.
Modifier and Type | Field and Description |
---|---|
static String |
GLOBAL_LABEL_PREFIX |
static char[] |
INVALID_CHARACTERS
Deprecated.
since 5.10. Use
INVALID_LABEL_CHARACTERS |
static int |
MAX_LABEL_NAME_LENGTH |
static int |
MAX_LABEL_PREFIX_LENGTH |
static String |
NAMESPACE_DELIMITER |
static String |
PERSONAL_LABEL_PREFIX |
static String |
TEAM_LABEL_PREFIX |
static String |
USER_LABEL_PREFIX |
Constructor and Description |
---|
LabelParser() |
Modifier and Type | Method and Description |
---|---|
static ParsedLabelName |
create(Label label) |
static ParsedLabelName |
create(String labelName,
String userName) |
static String |
getInvalidCharactersAsString() |
static boolean |
isLabelOwnedByUser(String labelString,
com.atlassian.user.User user)
Returns true if the label is a personal label and is owned by the specified user, false otherwise.
|
static boolean |
isPersonalLabel(String labelString)
Returns true if the label is a personal label, false otherwise.
|
static boolean |
isValidLabelLength(ParsedLabelName labelName) |
static boolean |
isValidNameLength(ParsedLabelName labelName) |
static boolean |
isValidPrefixLength(ParsedLabelName labelName) |
static ParsedLabelName |
parse(String labelString)
Deprecated.
since 6.0. Use
parse(String, User) instead. |
static @Nullable ParsedLabelName |
parse(@NonNull String labelString,
@Nullable com.atlassian.user.User user) |
static String |
render(Label label) |
static String |
render(ParsedLabelName parsedLabelName) |
static String |
render(ParsedLabelName parsedLabelName,
boolean ignoreCurrentUser) |
static String |
render(ParsedLabelName parsedLabelName,
com.atlassian.user.User currentUser)
The pure render function without side effects
|
@Deprecated public static final char[] INVALID_CHARACTERS
INVALID_LABEL_CHARACTERS
public static final int MAX_LABEL_NAME_LENGTH
public static final int MAX_LABEL_PREFIX_LENGTH
public static final String NAMESPACE_DELIMITER
public static final String PERSONAL_LABEL_PREFIX
public static final String TEAM_LABEL_PREFIX
public static final String GLOBAL_LABEL_PREFIX
public static final String USER_LABEL_PREFIX
public static boolean isValidLabelLength(ParsedLabelName labelName)
public static boolean isValidNameLength(ParsedLabelName labelName)
public static boolean isValidPrefixLength(ParsedLabelName labelName)
public static boolean isPersonalLabel(String labelString)
labelString
- a string representation of exactly one label, optionally including a namespace.
E.g. "my:favourite"
, "team:confluence"
or "blah"
. Should not be null.public static boolean isLabelOwnedByUser(String labelString, com.atlassian.user.User user)
labelString
- must be user label or personal labeluser
- user to check againstpublic static @Nullable ParsedLabelName parse(@NonNull String labelString, @Nullable com.atlassian.user.User user)
@Deprecated public static ParsedLabelName parse(String labelString)
parse(String, User)
instead.public static String getInvalidCharactersAsString()
public static ParsedLabelName create(String labelName, String userName)
public static ParsedLabelName create(Label label)
public static String render(ParsedLabelName parsedLabelName)
public static String render(ParsedLabelName parsedLabelName, boolean ignoreCurrentUser)
public static String render(ParsedLabelName parsedLabelName, com.atlassian.user.User currentUser)
Copyright © 2003–2020 Atlassian. All rights reserved.