Package org.osgi.util.converter
Class AbstractSpecifying<T extends Specifying<T>>
- java.lang.Object
-
- org.osgi.util.converter.AbstractSpecifying<T>
-
- All Implemented Interfaces:
Specifying<T>
- Direct Known Subclasses:
ConvertingImpl,FunctioningImpl
abstract class AbstractSpecifying<T extends Specifying<T>> extends java.lang.Object implements Specifying<T>
-
-
Field Summary
Fields Modifier and Type Field Description protected java.lang.ObjectdefaultValueprotected booleanhasDefaultprotected booleankeysIgnoreCaseprotected booleanliveViewprotected java.lang.Class<?>sourceAsClassprotected booleansourceAsDTOprotected booleansourceAsJavaBeanprotected java.lang.Class<?>targetAsClassprotected booleantargetAsDTOprotected booleantargetAsJavaBean
-
Constructor Summary
Constructors Constructor Description AbstractSpecifying()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private TcastThis()TdefaultValue(java.lang.Object defVal)The default value to use when the object cannot be converted or in case of conversion from anullvalue.TkeysIgnoreCase()When converting between map-like types use case-insensitive mapping of keys.TsourceAs(java.lang.Class<?> cls)Treat the source object as the specified class.TsourceAsBean()Treat the source object as a JavaBean.TsourceAsDTO()Treat the source object as a DTO even if the source object has methods or is otherwise not recognized as a DTO.TtargetAs(java.lang.Class<?> cls)Treat the target object as the specified class.TtargetAsBean()Treat the target object as a JavaBean.TtargetAsDTO()Treat the target object as a DTO even if it has methods or is otherwise not recognized as a DTO.Tview()Return a live view over the backing object that reflects any changes to the original object.
-
-
-
Field Detail
-
defaultValue
protected volatile java.lang.Object defaultValue
-
hasDefault
protected volatile boolean hasDefault
-
liveView
protected volatile boolean liveView
-
keysIgnoreCase
protected volatile boolean keysIgnoreCase
-
sourceAsClass
protected volatile java.lang.Class<?> sourceAsClass
-
sourceAsDTO
protected volatile boolean sourceAsDTO
-
sourceAsJavaBean
protected volatile boolean sourceAsJavaBean
-
targetAsClass
protected volatile java.lang.Class<?> targetAsClass
-
targetAsDTO
protected volatile boolean targetAsDTO
-
targetAsJavaBean
protected volatile boolean targetAsJavaBean
-
-
Method Detail
-
castThis
private T castThis()
-
defaultValue
public T defaultValue(java.lang.Object defVal)
Description copied from interface:SpecifyingThe default value to use when the object cannot be converted or in case of conversion from anullvalue.- Specified by:
defaultValuein interfaceSpecifying<T extends Specifying<T>>- Parameters:
defVal- The default value.- Returns:
- The current
Convertingobject so that additional calls can be chained.
-
keysIgnoreCase
public T keysIgnoreCase()
Description copied from interface:SpecifyingWhen converting between map-like types use case-insensitive mapping of keys.- Specified by:
keysIgnoreCasein interfaceSpecifying<T extends Specifying<T>>- Returns:
- The current
Convertingobject so that additional calls can be chained.
-
sourceAs
public T sourceAs(java.lang.Class<?> cls)
Description copied from interface:SpecifyingTreat the source object as the specified class. This can be used to disambiguate a type if it implements multiple interfaces or extends multiple classes.- Specified by:
sourceAsin interfaceSpecifying<T extends Specifying<T>>- Parameters:
cls- The class to treat the object as.- Returns:
- The current
Convertingobject so that additional calls can be chained.
-
sourceAsBean
public T sourceAsBean()
Description copied from interface:SpecifyingTreat the source object as a JavaBean. By default objects will not be treated as JavaBeans, this has to be specified using this method.- Specified by:
sourceAsBeanin interfaceSpecifying<T extends Specifying<T>>- Returns:
- The current
Convertingobject so that additional calls can be chained.
-
sourceAsDTO
public T sourceAsDTO()
Description copied from interface:SpecifyingTreat the source object as a DTO even if the source object has methods or is otherwise not recognized as a DTO.- Specified by:
sourceAsDTOin interfaceSpecifying<T extends Specifying<T>>- Returns:
- The current
Convertingobject so that additional calls can be chained.
-
targetAs
public T targetAs(java.lang.Class<?> cls)
Description copied from interface:SpecifyingTreat the target object as the specified class. This can be used to disambiguate a type if it implements multiple interfaces or extends multiple classes.- Specified by:
targetAsin interfaceSpecifying<T extends Specifying<T>>- Parameters:
cls- The class to treat the object as.- Returns:
- The current
Convertingobject so that additional calls can be chained.
-
targetAsBean
public T targetAsBean()
Description copied from interface:SpecifyingTreat the target object as a JavaBean. By default objects will not be treated as JavaBeans, this has to be specified using this method.- Specified by:
targetAsBeanin interfaceSpecifying<T extends Specifying<T>>- Returns:
- The current
Convertingobject so that additional calls can be chained.
-
targetAsDTO
public T targetAsDTO()
Description copied from interface:SpecifyingTreat the target object as a DTO even if it has methods or is otherwise not recognized as a DTO.- Specified by:
targetAsDTOin interfaceSpecifying<T extends Specifying<T>>- Returns:
- The current
Convertingobject so that additional calls can be chained.
-
view
public T view()
Description copied from interface:SpecifyingReturn a live view over the backing object that reflects any changes to the original object. This is only possible with conversions toMap,Collection,ListandSet. 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.- Specified by:
viewin interfaceSpecifying<T extends Specifying<T>>- Returns:
- The current
Convertingobject so that additional calls can be chained.
-
-