Package com.atlassian.jira.issue.fields
Class FieldId
java.lang.Object
com.atlassian.jira.issue.fields.FieldId
Field identifier for both custom and system fields.
Identifiers of system fields are always strings with their human-readable names (e.g. "priority"), while custom fields can be identified by a number (e.g. 10000) or a full textual representation (e.g. "customfield_10000"). This class helps avoid the confusion when handling all these formats.
Methods of creation:
FieldId.fromCustomFieldId(10000); // a custom field, full ID: "customfield_1000"
FieldId.fromFullId("description"); // a system field
FieldId.fromFullId("customfield_1001"); // a custom field with numerial ID 1001
Use toFullId() to get a full textual form for all the types of fields:
FieldId.fromFullId("summary").toFullId() // => "summary"
FieldId.fromCustomFieldId(10000).toFullId() // => "customfield_10000"
-
Method Summary
Modifier and TypeMethodDescriptionbooleanstatic FieldIdfromCustomFieldId(long id) Creates a custom field ID from a numerical IDstatic FieldIdfromFullId(String id) Creates a FieldId from a textual ID in its full format, e.g.longReturns a numerical custom field ID.Returns a numerical custom field ID or null when it's a system field.inthashCode()booleanbooleantoFullId()Returns full textual ID for the fieldtoString()
-
Method Details
-
fromCustomFieldId
Creates a custom field ID from a numerical ID- Throws:
IllegalArgumentException- when ID invalid input: '<' 0
-
fromFullId
Creates a FieldId from a textual ID in its full format, e.g. "description" or "customfield_10000"- Throws:
NullPointerException- when given nullNumberFormatException- when custom field ID is not a number
-
toString
-
toFullId
Returns full textual ID for the field -
isCustomField
public boolean isCustomField() -
isSystemField
public boolean isSystemField() -
getCustomFieldId
public long getCustomFieldId()Returns a numerical custom field ID. The caller has to check if it's a custom, not a system, field usingisCustomField()- Throws:
IllegalStateException- when the ID is of a system field
-
getCustomFieldIdOrNull
Returns a numerical custom field ID or null when it's a system field. -
equals
-
hashCode
public int hashCode()
-