Package org.osgi.util.converter
Class ConvertingImpl
- All Implemented Interfaces:
Converting,InternalConverting,Specifying<Converting>
class ConvertingImpl
extends AbstractSpecifying<Converting>
implements Converting, InternalConverting
-
Field Summary
FieldsModifier and TypeFieldDescription(package private) InternalConverterprivate static final Collection<Class<?>> private Objectprivate Class<?> private Class<?> private Typeprivate Type[]Fields inherited from class org.osgi.util.converter.AbstractSpecifying
defaultValue, hasDefault, keysIgnoreCase, liveView, sourceAsClass, sourceAsDTO, sourceAsJavaBean, targetAsClass, targetAsDTO, targetAsJavaBean -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprivate static ObjectasBoxedArray(Object obj) private Collection<?> private Collection<?> private ObjectconvertArrayToSingleValue(Class<?> cls) private ObjectconvertCollectionToSingleValue(Class<?> cls) (package private) ObjectconvertCollectionValue(Object element) private ObjectconvertMapElement(Object element, int typeIdx) private ObjectconvertMapEntryToSingleValue(Class<?> cls) (package private) ObjectconvertMapKey(Object key) private ObjectconvertMapToSingleValue(Class<?> cls) (package private) ObjectconvertMapValue(Object value) private <T> TconvertToArray(Class<?> componentClz, Type componentType) private <T> Tprivate Collection<?> private <T> Tprivate Objectprivate <T> TconvertToDTO(Class<?> sourceCls, Class<?> targetAsCls) private ObjectconvertToInterface(Class<?> sourceCls, Class<?> targetCls) private ObjectconvertToJavaBean(Class<?> sourceCls, Class<?> targetCls) private Mapprivate Mapprivate Objectprivate static MapcreateMapFromBeanAccessors(Object obj, Class<?> sourceCls) private MapcreateMapFromDTO(Object obj, InternalConverter ic) private static MapcreateMapFromInterface(Object obj, Class<?> srcCls) private static ObjectcreateMapOrCollection(Class<?> cls, int initialSize) private ObjectcreateProxy(Class<?> cls, Map<?, ?> data) private static Class<?> getConstructableType(Class<?> targetCls) getInterfaces(Class<?> cls) getInterfaces0(Class<?> cls) private Map<?, ?> getPropertiesDelegate(Object obj, Class<?> cls) getSetters(Class<?> cls) private static voidprivate voidhandleDTOField(Object obj, Field field, Set<String> handledFields, Map result, InternalConverter ic) private static voidprivate ObjecthandleNull(Class<?> cls) private booleanhasGetProperties(Class<?> cls) private static booleanisCopyRequiredType(Class<?> cls) private static booleanprivate booleanisMarkerAnnotation(Class<?> annClass) private static booleanisWriteableJavaBean(Class<?> cls) private Map<?, ?> mapView(Object obj, Class<?> sourceCls, InternalConverter ic) (package private) static TypevoidSet the current converter.<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.private Objectprivate <T> TMethods inherited from class org.osgi.util.converter.AbstractSpecifying
defaultValue, keysIgnoreCase, sourceAs, sourceAsBean, sourceAsDTO, targetAs, targetAsBean, targetAsDTO, viewMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.osgi.util.converter.Specifying
defaultValue, keysIgnoreCase, sourceAs, sourceAsBean, sourceAsDTO, targetAs, targetAsBean, targetAsDTO, view
-
Field Details
-
INTERFACE_IMPLS
-
NO_MAP_VIEW_TYPES
-
converter
-
object
-
sourceClass
-
targetClass
-
typeArguments
-
targetType
-
-
Constructor Details
-
ConvertingImpl
ConvertingImpl(InternalConverter c, Object obj)
-
-
Method Details
-
setConverter
Description copied from interface:InternalConvertingSet the current converter.- Specified by:
setConverterin interfaceInternalConverting- Parameters:
c- The current converter.
-
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.
-
convertArrayToSingleValue
-
convertCollectionToSingleValue
-
convertMapToSingleValue
-
convertMapEntryToSingleValue
-
convertToArray
-
convertToCollectionType
private <T> T convertToCollectionType() -
convertToCollectionDelegate
-
convertToCollection
private <T> T convertToCollection() -
convertToDTO
-
reifyType
-
getNames
-
convertToMap
-
convertCollectionValue
-
convertMapKey
-
convertMapValue
-
convertMapElement
-
convertToMapDelegate
-
convertToMapType
-
convertToDictionary
-
convertToJavaBean
-
convertToInterface
-
createProxy
-
handleNull
-
isMapType
-
trySpecialCases
-
isMarkerAnnotation
-
tryStandardMethods
private <T> T tryStandardMethods() -
collectionView
-
asCollection
-
asBoxedArray
-
createMapFromBeanAccessors
-
createMapFromDTO
-
createMapFromInterface
-
createMapOrCollection
-
getConstructableType
-
getInterfaces
-
getInterfaces0
-
handleDTOField
-
handleBeanMethod
-
handleInterfaceMethod
-
mapView
-
hasGetProperties
-
getPropertiesDelegate
-
isCopyRequiredType
-
isWriteableJavaBean
-
getSetters
-