E
- the generic type of the linked
EntityBean
.public interface Link<E extends EntityBean>
EntityBean
. It acts as a reference that can be evaluated
lazily. It will hold the primary key
of the linked bean.EntityBeanLink
,
IdLink
Modifier and Type | Method and Description |
---|---|
Id<E> |
getId() |
E |
getTarget()
|
boolean |
isResolved() |
Id<E> getId()
unique identifier
of the linked bean
. When
creating new Bean
s a link may hold a transient EntityBean
as target
that has no ID assigned, yet. In such case this method will return null
.boolean isResolved()
true
if the link target
is already resolved, false
otherwise
(if getTarget()
may trigger lazy loading and could also fail if called without an open
transaction).E getTarget()
EntityBean
.Link
can be evaluated lazily. In such case the first call of this method will resolve the
linked EntityBean
from the database. That can be a relatively expensive operation and requires an
open transaction. Use isResolved()
to distinguish and prevent undesired link resolving.ID
was
transferred and this link can not be resolved. In that case this method may return null
. Please
note that id
and target
can not both be null. In case a link
property is empty it will contain null
instead of an empty Link
so you can always
properly distinguish the scenarios.null
if the link can not be resolved.Copyright © 2001–2016 mmm-Team. All rights reserved.