Package org.osgi.util.converter
Interface Specifying<T extends Specifying<T>>
-
- Type Parameters:
T
- EitherConverting
orSpecifying
.
- All Known Subinterfaces:
Converting
,Functioning
@ProviderType public interface Specifying<T extends Specifying<T>>
This is the base interface for theConverting
andFunctioning
interfaces and defines the common modifiers that can be applied to these.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description T
defaultValue(java.lang.Object defVal)
The default value to use when the object cannot be converted or in case of conversion from anull
value.T
keysIgnoreCase()
When converting between map-like types use case-insensitive mapping of keys.T
sourceAs(java.lang.Class<?> cls)
Treat the source object as the specified class.T
sourceAsBean()
Treat the source object as a JavaBean.T
sourceAsDTO()
Treat the source object as a DTO even if the source object has methods or is otherwise not recognized as a DTO.T
targetAs(java.lang.Class<?> cls)
Treat the target object as the specified class.T
targetAsBean()
Treat the target object as a JavaBean.T
targetAsDTO()
Treat the target object as a DTO even if it has methods or is otherwise not recognized as a DTO.T
view()
Return a live view over the backing object that reflects any changes to the original object.
-
-
-
Method Detail
-
defaultValue
T defaultValue(java.lang.Object defVal)
The default value to use when the object cannot be converted or in case of conversion from anull
value.- Parameters:
defVal
- The default value.- Returns:
- The current
Converting
object so that additional calls can be chained.
-
keysIgnoreCase
T keysIgnoreCase()
When converting between map-like types use case-insensitive mapping of keys.- Returns:
- The current
Converting
object so that additional calls can be chained.
-
sourceAs
T sourceAs(java.lang.Class<?> cls)
Treat the source object as the specified class. This can be used to disambiguate a type if it implements multiple interfaces or extends multiple classes.- Parameters:
cls
- The class to treat the object as.- Returns:
- The current
Converting
object so that additional calls can be chained.
-
sourceAsBean
T sourceAsBean()
Treat the source object as a JavaBean. By default objects will not be treated as JavaBeans, this has to be specified using this method.- Returns:
- The current
Converting
object so that additional calls can be chained.
-
sourceAsDTO
T sourceAsDTO()
Treat the source object as a DTO even if the source object has methods or is otherwise not recognized as a DTO.- Returns:
- The current
Converting
object so that additional calls can be chained.
-
targetAs
T targetAs(java.lang.Class<?> cls)
Treat the target object as the specified class. This can be used to disambiguate a type if it implements multiple interfaces or extends multiple classes.- Parameters:
cls
- The class to treat the object as.- Returns:
- The current
Converting
object so that additional calls can be chained.
-
targetAsBean
T targetAsBean()
Treat the target object as a JavaBean. By default objects will not be treated as JavaBeans, this has to be specified using this method.- Returns:
- The current
Converting
object so that additional calls can be chained.
-
targetAsDTO
T targetAsDTO()
Treat the target object as a DTO even if it has methods or is otherwise not recognized as a DTO.- Returns:
- The current
Converting
object so that additional calls can be chained.
-
view
T view()
Return a live view over the backing object that reflects any changes to the original object. This is only possible with conversions toMap
,Collection
,List
andSet
. The live view object will cease to be live as soon as modifications are made to it. Note that conversions to an interface or annotation will always produce a live view that cannot be modified. This modifier has no effect with conversions to other types.- Returns:
- The current
Converting
object so that additional calls can be chained.
-
-