Package org.osgi.util.converter
Class CustomConverterImpl.ConvertingWrapper
java.lang.Object
org.osgi.util.converter.CustomConverterImpl.ConvertingWrapper
- All Implemented Interfaces:
Converting,InternalConverting,Specifying<Converting>
- Enclosing class:
CustomConverterImpl
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate Objectprivate final InternalConvertingprivate booleanprivate final Object -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiondefaultValue(Object defVal) The default value to use when the object cannot be converted or in case of conversion from anullvalue.When converting between map-like types use case-insensitive mapping of keys.voidSet the current converter.Treat the source object as the specified class.Treat the source object as a JavaBean.Treat the source object as a DTO even if the source object has methods or is otherwise not recognized as a DTO.Treat the target object as the specified class.Treat the target object as a JavaBean.Treat the target object as a DTO even if it has methods or is otherwise not recognized as a DTO.<T> TSpecify the target object type for the conversion as a class object.<T> TSpecify the target object type as a Java Reflection Type object.<T> Tto(TypeReference<T> ref) Specify the target object type as aTypeReference.toString()view()Return a live view over the backing object that reflects any changes to the original object.
-
Field Details
-
del
-
object
-
defaultValue
-
hasDefault
private volatile boolean hasDefault
-
-
Constructor Details
-
ConvertingWrapper
ConvertingWrapper(Object obj, InternalConverting c)
-
-
Method Details
-
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<Converting>- Returns:
- The current
Convertingobject so that additional calls can be chained.
-
defaultValue
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<Converting>- Parameters:
defVal- The default value.- Returns:
- The current
Convertingobject so that additional calls can be chained.
-
keysIgnoreCase
Description copied from interface:SpecifyingWhen converting between map-like types use case-insensitive mapping of keys.- Specified by:
keysIgnoreCasein interfaceSpecifying<Converting>- Returns:
- The current
Convertingobject so that additional calls can be chained.
-
setConverter
Description copied from interface:InternalConvertingSet the current converter.- Specified by:
setConverterin interfaceInternalConverting- Parameters:
c- The current converter.
-
sourceAs
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<Converting>- Parameters:
type- The class to treat the object as.- Returns:
- The current
Convertingobject so that additional calls can be chained.
-
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<Converting>- Returns:
- The current
Convertingobject so that additional calls can be chained.
-
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<Converting>- Returns:
- The current
Convertingobject so that additional calls can be chained.
-
targetAs
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<Converting>- Parameters:
cls- The class to treat the object as.- Returns:
- The current
Convertingobject so that additional calls can be chained.
-
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<Converting>- Returns:
- The current
Convertingobject so that additional calls can be chained.
-
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<Converting>- Returns:
- The current
Convertingobject so that additional calls can be chained.
-
to
Description copied from interface:ConvertingSpecify the target object type for the conversion as a class object.- Specified by:
toin interfaceConverting- Parameters:
cls- The class to convert to.- Returns:
- The converted object.
-
to
Description copied from interface:ConvertingSpecify the target object type as aTypeReference. If the target class carries generics information a TypeReference should be used as this preserves the generic information whereas a Class object has this information erased. Example use:List<String> result = converter.convert(Arrays.asList(1, 2, 3)) .to(new TypeReference<List<String>>() {});- Specified by:
toin interfaceConverting- Parameters:
ref- A type reference to the object being converted to.- Returns:
- The converted object.
-
to
Description copied from interface:ConvertingSpecify the target object type as a Java Reflection Type object.- Specified by:
toin interfaceConverting- Parameters:
type- A Type object to represent the target type to be converted to.- Returns:
- The converted object.
-
toString
-