E
- the generic type of the linked
EntityBean
.public class EntityBeanLink<E extends EntityBean> extends AbstractLink<E>
AbstractLink
based on an already resolved EntityBean
.Modifier | Constructor and Description |
---|---|
protected |
EntityBeanLink()
The constructor (for serialization and strange frameworks).
|
protected |
EntityBeanLink(E bean)
The constructor.
|
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object obj) |
Id<E> |
getId() |
E |
getTarget()
|
boolean |
isResolved() |
static <E extends EntityBean> |
valueOf(E bean) |
hashCode, toString
private final E extends EntityBean bean
protected EntityBeanLink()
protected EntityBeanLink(E bean)
bean
- - see getTarget()
.public boolean isResolved()
true
if the link target
is already resolved, false
otherwise
(if Link.getTarget()
may trigger lazy loading and could also fail if called without an open
transaction).public 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
.public E getTarget()
Link
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 Link.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.public boolean equals(Object obj)
equals
in class AbstractLink<E extends EntityBean>
public static <E extends EntityBean> EntityBeanLink<E> valueOf(E bean)
E
- the generic type of the linked
EntityBean
.bean
- the linked
EntityBean
.EntityBeanLink
instance.Copyright © 2001–2016 mmm-Team. All rights reserved.