Package com.atlassian.confluence.labels
Class LabelParser
java.lang.Object
com.atlassian.confluence.labels.LabelParser
The Label parser understands the formatting of label strings.
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.
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic ParsedLabelName
static ParsedLabelName
static String
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) Deprecated, for removal: This API element is subject to removal in a future version.since 9.3 useisPersonalLabel(String, ConfluenceUser)
static boolean
isPersonalLabel
(String labelString, ConfluenceUser user) Returns true if the label is a personal label for the given user, false otherwise.static boolean
isValidLabelLength
(ParsedLabelName labelName) static boolean
isValidNameLength
(ParsedLabelName labelName) static boolean
isValidPrefixLength
(ParsedLabelName labelName) static @Nullable ParsedLabelName
static ParsedLabelName
Deprecated.since 6.0.static String
Deprecated, for removal: This API element is subject to removal in a future version.since 9.3 userender(Label, ConfluenceUser)
static String
render
(Label label, @Nullable ConfluenceUser user) static String
render
(ParsedLabelName parsedLabelName) Deprecated, for removal: This API element is subject to removal in a future version.since 9.3 userender(ParsedLabelName, User)
static String
render
(ParsedLabelName parsedLabelName, boolean ignoreCurrentUser) Deprecated, for removal: This API element is subject to removal in a future version.since 9.3 userender(ParsedLabelName, User)
static String
render
(ParsedLabelName parsedLabelName, @Nullable com.atlassian.user.User currentUser) The pure render function without side effectsstatic String
renderWithNamespace
(Label label) static String
renderWithOwnerPrefix
(Label label)
-
Field Details
-
INVALID_CHARACTERS
Deprecated.since 5.10. UseINVALID_LABEL_CHARACTERS
-
MAX_LABEL_NAME_LENGTH
public static final int MAX_LABEL_NAME_LENGTH- See Also:
-
MAX_LABEL_PREFIX_LENGTH
public static final int MAX_LABEL_PREFIX_LENGTH- See Also:
-
NAMESPACE_DELIMITER
- See Also:
-
PERSONAL_LABEL_PREFIX
-
TEAM_LABEL_PREFIX
-
GLOBAL_LABEL_PREFIX
-
USER_LABEL_PREFIX
- See Also:
-
-
Constructor Details
-
LabelParser
public LabelParser()
-
-
Method Details
-
isValidLabelLength
-
isValidNameLength
-
isValidPrefixLength
-
isPersonalLabel
Deprecated, for removal: This API element is subject to removal in a future version.since 9.3 useisPersonalLabel(String, ConfluenceUser)
Returns true if the label is a personal label for the current user, false otherwise.- Parameters:
labelString
- a string representation of exactly one label, optionally including a namespace. E.g."my:favourite"
,"team:confluence"
or"blah"
. Should not be null.- Returns:
- true if the label is a personal label, false otherwise.
-
isPersonalLabel
Returns true if the label is a personal label for the given user, false otherwise.- Parameters:
labelString
- a string representation of exactly one label, optionally including a namespace. E.g."my:favourite"
,"team:confluence"
or"blah"
. Should not be null.- Returns:
- true if the label is a personal label, false otherwise.
- Since:
- 9.3
-
isLabelOwnedByUser
Returns true if the label is a personal label and is owned by the specified user, false otherwise. Returns false, if the specified labelString is not a personal or user label (as no other label types have user ownership).- Parameters:
labelString
- must be user label or personal labeluser
- user to check against- Returns:
- true if the label is a personal label and is owned by the specified user, false otherwise.
-
parse
public static @Nullable ParsedLabelName parse(@NonNull String labelString, @Nullable com.atlassian.user.User user) - Since:
- 6.0
-
parse
Deprecated.since 6.0. Useparse(String, User)
instead. -
getInvalidCharactersAsString
-
create
-
create
-
render
Deprecated, for removal: This API element is subject to removal in a future version.since 9.3 userender(Label, ConfluenceUser)
-
render
- Since:
- 9.3
-
render
@Deprecated(since="9.3", forRemoval=true) public static String render(ParsedLabelName parsedLabelName) Deprecated, for removal: This API element is subject to removal in a future version.since 9.3 userender(ParsedLabelName, User)
-
render
@Deprecated(since="9.3", forRemoval=true) public static String render(ParsedLabelName parsedLabelName, boolean ignoreCurrentUser) Deprecated, for removal: This API element is subject to removal in a future version.since 9.3 userender(ParsedLabelName, User)
-
render
public static String render(ParsedLabelName parsedLabelName, @Nullable com.atlassian.user.User currentUser) The pure render function without side effects- Since:
- 7.7.0
-
renderWithOwnerPrefix
- Since:
- 9.3
-
renderWithNamespace
- Since:
- 9.3
-