Class AbstractNullableBean<T>
java.lang.Object
ch.tocco.nice2.templating.spi.freemarker.bean.AbstractNullableBean<T>
- All Implemented Interfaces:
NullableBean
- Direct Known Subclasses:
AbstractDateBean
,BinaryBean
,DurationBean
,PhoneBean
Base class for beans which may contain null delegates.
-
Field Summary
-
Constructor Summary
-
Method Summary
-
Field Details
-
delegate
-
-
Constructor Details
-
AbstractNullableBean
-
-
Method Details
-
isNull
public boolean isNull()- Specified by:
isNull
in interfaceNullableBean
- Returns:
- true, if the bean contains a null value, else false.
-
or
Description copied from interface:NullableBean
Get the value or a given fallback value, if the value is null.- Specified by:
or
in interfaceNullableBean
- Parameters:
fallback
- the fallback value- Returns:
- the bean itself or the given fallback, if the value is null.
-
strict
Description copied from interface:NullableBean
Get the value or null, if the value is null. Please note, that freemarker doesn't allow null values, so you should handle them somehow if no exception should be thrown. The following expressions are equivalent: 1. user.firstname.strict()!'fallback' 2. user.firstname.or('fallback')- Specified by:
strict
in interfaceNullableBean
- Returns:
- the value or null, if the value is null.
-
getDelegate
-