public class AttachmentReference extends EntityReference
TOSTRING_SERIALIZER
Modifier | Constructor and Description |
---|---|
|
AttachmentReference(EntityReference reference)
Special constructor that transforms a generic entity reference into an
AttachmentReference . |
|
AttachmentReference(EntityReference reference,
EntityReference parent)
Clone an AttachmentReference, but use the specified parent for its new parent.
|
protected |
AttachmentReference(EntityReference reference,
EntityReference oldReference,
EntityReference newReference)
Clone an AttachmentReference, but replace one of the parent in the chain by a new one.
|
|
AttachmentReference(String fileName,
DocumentReference parent)
Create a new attachment reference based on the attachment name and the parent document reference.
|
Modifier and Type | Method and Description |
---|---|
DocumentReference |
getDocumentReference() |
AttachmentReference |
replaceParent(EntityReference newParent)
Return a clone of this reference, but with its parent replaced by the passed one.
|
AttachmentReference |
replaceParent(EntityReference oldParent,
EntityReference newParent)
Return a clone of this reference, but with one of its parent replaced by another one.
|
protected void |
setParent(EntityReference parent)
Entity reference are immutable since 3.3M2, so this method is now protected.
|
protected void |
setType(EntityType type)
Entity reference are immutable since 3.3M2, so this method is now protected.
|
appendParent, compareTo, equals, equals, equals, equalsNonRecursive, extractFirstReference, extractReference, getName, getParameter, getParameters, getParent, getReversedReferenceChain, getRoot, getType, hashCode, hasParent, removeParent, setName, setParameter, setParameters, size, toString
public AttachmentReference(EntityReference reference)
AttachmentReference
. It checks the
validity of the passed reference (ie correct type and correct parent).reference
- the reference to be transformedIllegalArgumentException
- if the passed reference is not a valid attachment referenceprotected AttachmentReference(EntityReference reference, EntityReference oldReference, EntityReference newReference)
reference
- the reference that is clonedoldReference
- the old parent that will be replacednewReference
- the new parent that will replace oldReference in the chainpublic AttachmentReference(EntityReference reference, EntityReference parent)
reference
- the reference to cloneparent
- the new parent to usepublic AttachmentReference(String fileName, DocumentReference parent)
fileName
- the name of the attachmentparent
- the reference of the documentprotected void setParent(EntityReference parent)
setParent
in class EntityReference
parent
- the parent for this entity, may be null for a root entity.IllegalArgumentException
- if the passed parent is not a valid attachment reference parent (ie an
attachment reference)protected void setType(EntityType type)
setType
in class EntityReference
type
- the type for this entityIllegalArgumentException
- if the passed type is not an attachment typepublic DocumentReference getDocumentReference()
public AttachmentReference replaceParent(EntityReference oldParent, EntityReference newParent)
EntityReference
replaceParent
in class EntityReference
oldParent
- the old parent that will be replacednewParent
- the new parent that will replace oldParent in the chain. If the same as oldParent, this is
returned.public AttachmentReference replaceParent(EntityReference newParent)
EntityReference
replaceParent
in class EntityReference
newParent
- the new parent that will replace the parentCopyright © 2004–2022 XWiki. All rights reserved.