Interface ContentDomainResolver
-
public interface ContentDomainResolver
Contract of the Content Domain Resolver.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description String
entityToId(Object entity)
Converts the given entity to an ID.String
getDomainPrefix(Object entity)
Gets the domain prefix for the givenentity
.Object
idToEntity(String id)
Converts the given ID to an entity.
-
-
-
Method Detail
-
idToEntity
Object idToEntity(String id) throws ContentDomainException
Converts the given ID to an entity. In case the given ID is unknownnull
is returned. In case of any other inability to return an entity anIllegalStateException
is thrown. Note thatContentDomain
implementations might result in other unchecked exceptions.- Parameters:
id
- Entity identifier. Its form is:domain_namespace-domain_id
, e.g.pageversion-26424
. Must not benull
.- Returns:
- The actual entity instance that is represented by the given ID, or
null
if no entity exists for the given ID. - Throws:
ContentDomainException
- In case the given ID is illegal, no content domain can be found, or theContentDomain
specific resolver throws the same exception.
-
entityToId
String entityToId(Object entity) throws ContentDomainException
Converts the given entity to an ID. In case of any inability to return an ID anIllegalStateException
is thrown. Note thatContentDomain
implementations might result in other unchecked exceptions.- Parameters:
entity
- Entity instance.- Returns:
- Entity identifier.
- Throws:
ContentDomainException
- In case the given entity is not part of aContentDomain
, or theContentDomain
specific resolver throws the same exception.
-
getDomainPrefix
String getDomainPrefix(Object entity) throws ContentDomainException
Gets the domain prefix for the givenentity
.- Parameters:
entity
- the entity, may not be null.- Returns:
- the domain prefix of the entity.
- Throws:
NullPointerException
- ifentity
isnull
.ContentDomainException
- In case the given entity is not part of aContentDomain
.
-
-