Copyright© 2008-2022 Sitevision AB, all rights reserved.
@Requireable(value="LinkValueBuilder") public interface LinkValueBuilder extends Builder<LinkValue>
LinkValueBuilder has one mandatory attribute:
LinkValueBuilder also has some optional attributes:
null
.
null
.
false
.
Using the LinkValueBuilder is pretty straightforward, if you remember that it is stateful. Conceptually you would typically use it like this:
When you have built a LinkValue
instance, you can re-use the LinkValueBuilder to build more instances. Something like:
Tip! The Builder interface documentation
contains
more information about Builders and how to work with them!
An instance of the Sitevision class implementing this interface can be obtained via
MetadataUtil.getLinkValueBuilder()
.
See MetadataUtil
for how to obtain an instance of the MetadataUtil
interface.
Modifier and Type | Method and Description |
---|---|
LinkValue |
build()
Creates a LinkValue instance using current state of this builder.
|
LinkValueBuilder |
setDescription(String aDescription)
Sets the link description.
|
LinkValueBuilder |
setExternalTarget(String anURL)
Sets the target.
|
LinkValueBuilder |
setInternalTarget(Node aNode)
Sets the target.
|
LinkValueBuilder |
setMailTarget(String aMailAddress)
Sets the target.
|
LinkValueBuilder |
setName(String aName)
Sets the link name.
|
LinkValueBuilder |
setOpenInNewWindow(boolean aOpenInNewWindow)
Sets open in new window.
|
LinkValueBuilder |
setPhoneTarget(String aPhoneNumber)
Sets the target.
|
LinkValueBuilder setExternalTarget(String anURL) throws IllegalArgumentException
anURL
- the link target URLIllegalArgumentException
- if anURL
is null
or whitespace onlyLinkValueBuilder setMailTarget(String aMailAddress) throws IllegalArgumentException
aMailAddress
- a mail addressIllegalArgumentException
- if aMailAddress
is null
, whitespace only or an invalid mail address.MailUtil.isValidAddress(String)
LinkValueBuilder setPhoneTarget(String aPhoneNumber) throws IllegalArgumentException
aPhoneNumber
- a phone numberIllegalArgumentException
- if aPhoneNumber
is null
, whitespace only or an invalid phone number.LinkValueBuilder setInternalTarget(Node aNode) throws IllegalArgumentException
aNode
- the target, must be a linkable resource (i.e. a page/article/image/file or such) that isn't trashed.IllegalArgumentException
- if aNode
is null
or not a linkable resource.LinkValueBuilder setName(String aName)
aName
- the link nameLinkValueBuilder setDescription(String aDescription)
aDescription
- the link descriptionLinkValueBuilder setOpenInNewWindow(boolean aOpenInNewWindow)
aOpenInNewWindow
- whether or not the link should be opened in new windowLinkValue build() throws IllegalStateException
build
in interface Builder<LinkValue>
IllegalStateException
- if there are no link target.Sitevision - Portal and Content Management Made Easy
Sitevision is an advanced Java enterprise portal product and a portlet container (JSR 286) that implements Java Content Repository (JSR 283).
Copyright© 2008-2022 Sitevision AB, all rights reserved.