Package com.atlassian.confluence.pages
Record Class IndexableAttachment
java.lang.Object
java.lang.Record
com.atlassian.confluence.pages.IndexableAttachment
- All Implemented Interfaces:
Searchable
,SearchableAttachment
public record IndexableAttachment(Attachment attachment)
extends Record
implements SearchableAttachment
A wrapper around an
Attachment
that implements the SearchableAttachment
interface.- Since:
- 9.3
-
Constructor Summary
ConstructorsConstructorDescriptionIndexableAttachment
(Attachment attachment) Creates an instance of aIndexableAttachment
record class. -
Method Summary
Modifier and TypeMethodDescriptionReturns the value of theattachment
record component.final boolean
Indicates whether some other object is "equal to" this one.Return any comment associated with this attachmentReturn the contents of the attachment as an InputStreamgetContentsAsStream
(AttachmentManager attachmentManager) Gets the MIME content-type of this attachment.static String
getDescriptionForMimeType
(String mimeType, String fileExtension) Gets the filename of this attachment.long
getId()
When we un-index something (say, a page), we also need to un-index everything contained within that page (comments, attachments), because presumably they're all about to go away.final int
hashCode()
Returns a hash code value for this object.boolean
Allows an object to tell the search indexer that it is not allowed to be indexedstatic IndexableAttachment
of
(Attachment attachment) final String
toString()
Returns a string representation of this record class.
-
Constructor Details
-
IndexableAttachment
Creates an instance of aIndexableAttachment
record class.- Parameters:
attachment
- the value for theattachment
record component
-
-
Method Details
-
of
-
getContentType
Description copied from interface:SearchableAttachment
Gets the MIME content-type of this attachment. If there is no content-type, return "application/x-unknown". Should never return null.- Specified by:
getContentType
in interfaceSearchableAttachment
- Returns:
- the MIME content-type of the attachment, or "application/x-unknown" if the MIME type is unknown
-
getFileName
Description copied from interface:SearchableAttachment
Gets the filename of this attachment. If there is no filename, return the empty string. This method should never return null.- Specified by:
getFileName
in interfaceSearchableAttachment
- Returns:
- the filename of this attachment, or the empty string if there is no filename
-
getContentsAsStream
Description copied from interface:SearchableAttachment
Return the contents of the attachment as an InputStream- Specified by:
getContentsAsStream
in interfaceSearchableAttachment
- Returns:
- an InputStream set at the start of the attachment's contents.
-
getContentsAsStream
-
getComment
Description copied from interface:SearchableAttachment
Return any comment associated with this attachment- Specified by:
getComment
in interfaceSearchableAttachment
-
getNiceType
- Specified by:
getNiceType
in interfaceSearchableAttachment
-
getDescriptionForMimeType
- Parameters:
mimeType
- the mime type to be described. Should not be nullfileExtension
- the file extension to help with the deriving of the description.- Returns:
- A more displayable description for the supplied mime type. If a blank String is supplied then null will be returned.
-
getNiceFileSize
- Specified by:
getNiceFileSize
in interfaceSearchableAttachment
-
getDownloadPath
- Specified by:
getDownloadPath
in interfaceSearchableAttachment
-
getId
public long getId()- Specified by:
getId
in interfaceSearchable
-
getSearchableDependants
Description copied from interface:Searchable
When we un-index something (say, a page), we also need to un-index everything contained within that page (comments, attachments), because presumably they're all about to go away.- Specified by:
getSearchableDependants
in interfaceSearchable
-
isIndexable
public boolean isIndexable()Description copied from interface:Searchable
Allows an object to tell the search indexer that it is not allowed to be indexed- Specified by:
isIndexable
in interfaceSearchable
-
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared withObjects::equals(Object,Object)
. -
attachment
Returns the value of theattachment
record component.- Returns:
- the value of the
attachment
record component
-