Copyright© 2008-2026 Sitevision AB, all rights reserved.
@Requireable(value="LinkTargetBuilder") public interface LinkTargetBuilder extends Builder<LinkTarget>
LinkPageUtil.
LinkTargetBuilder has one mandatory attribute:
LinkTargetBuilder also has some optional attributes:
null.
false.
Using the LinkTargetBuilder is pretty straightforward, if you remember that it is stateful. Conceptually you would typically use it like this:
When you have built a LinkTarget instance, you can re-use the LinkTargetBuilder 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
WebResourceFactory.getLinkTargetBuilder().
See WebResourceFactory for how to obtain an instance of the
WebResourceFactory interface.
LinkPageUtil| Modifier and Type | Method and Description |
|---|---|
LinkTarget |
build()
Creates a LinkTarget instance using current state of this builder.
|
LinkTargetBuilder |
setDescription(String aDescription)
Sets the description.
|
LinkTargetBuilder |
setExternalTarget(String aURL)
Sets the target.
|
LinkTargetBuilder |
setInternalTarget(Node aNode)
Sets the target.
|
LinkTargetBuilder |
setMailTarget(String aMailAddress)
Sets the target.
|
LinkTargetBuilder |
setOpenInNewWindow(boolean aOpenInNewWindow)
Sets open in new window.
|
LinkTargetBuilder |
setPhoneTarget(String aPhoneNumber)
Sets the target.
|
LinkTargetBuilder 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.LinkTargetBuilder setExternalTarget(String aURL) throws IllegalArgumentException
aURL - the link target URLIllegalArgumentException - if aURL is null or whitespace onlyLinkTargetBuilder setMailTarget(String aMailAddress) throws IllegalArgumentException
aMailAddress - a mail addressIllegalArgumentException - if aMailAddress is null, whitespace only or an invalid mail address.MailUtil.isValidAddress(String)LinkTargetBuilder setPhoneTarget(String aPhoneNumber) throws IllegalArgumentException
aPhoneNumber - a phone numberIllegalArgumentException - if aPhoneNumber is null, whitespace only or an invalid phone number.LinkTargetBuilder setDescription(String aDescription)
aDescription - the descriptionLinkTargetBuilder setOpenInNewWindow(boolean aOpenInNewWindow)
aOpenInNewWindow - whether or not the target should be opened in new windowLinkTarget build() throws IllegalStateException
Note! The 'open in new window' state is ignored when creating a LinkTarget with a mail or telephone target (these target types can never be opened in a new window).
build in interface Builder<LinkTarget>IllegalStateException - if there are no link target.Sitevision - Content Management Made Easy
Sitevision is an advanced Java enterprise portal product that implements Java Content Repository (JSR 283).
Copyright© 2008-2026 Sitevision AB, all rights reserved.