public class WebCmsDomainContext extends Object
WebCmsDomain with its associated WebCmsDomainAware.
Note that both the actual domain and its metadata can be null. A metadata instance is always
optional (but strongly advised), a null domain represents the special no-domain context,
in which case there can still be metadata available depending on your application setup.
If you want to initialize a context for no-domain, you should use the #noDomain(WebCmsDomainAware) factory methods.| Constructor and Description |
|---|
WebCmsDomainContext(WebCmsDomain domain,
Object metadata) |
| Modifier and Type | Method and Description |
|---|---|
<T> T |
getMetadata(Class<T> expectedType)
Retrieve the domain metadata and coerce it to a the expected type.
|
boolean |
hasMetadata() |
boolean |
holdsDomain() |
boolean |
holdsDomain(String domainKey)
Check if the context holds the domain with the specified domain key.
|
boolean |
isMetadataOfType(Class<?> expectedType)
Check if the metadata is of a particular type.
|
boolean |
isNoDomain() |
static WebCmsDomainContext |
noDomain() |
static WebCmsDomainContext |
noDomain(Object metadata) |
public WebCmsDomainContext(WebCmsDomain domain, Object metadata)
public static WebCmsDomainContext noDomain()
public static WebCmsDomainContext noDomain(Object metadata)
metadata - to put on the contextpublic <T> T getMetadata(Class<T> expectedType)
ClassCastException will be thrown if the metadata is not of the right type.T - metadata typeexpectedType - the metadata should havepublic boolean isMetadataOfType(Class<?> expectedType)
false.expectedType - for the metadatapublic boolean hasMetadata()
public boolean holdsDomain()
public boolean holdsDomain(String domainKey)
domainKey - to check forpublic boolean isNoDomain()
holdsDomain())Copyright © 2020. All rights reserved.