// If we have a current value, use the actual type to define the wrapper type
typeName = value.getClass().getName();
}
// Find the SCO wrapper type most suitable
TypeManager typeMgr = ownerOP.getExecutionContext().getNucleusContext().getTypeManager();
StoreManager storeMgr = ownerOP.getExecutionContext().getStoreManager();
boolean fullWrapper = (storeMgr instanceof BackedSCOStoreManager);
Class wrapperType = null;
if (fullWrapper)
{
wrapperType = typeMgr.getWrappedTypeBackedForType(typeName);
}
else
{
wrapperType = typeMgr.getWrapperTypeForType(typeName);
}
if (wrapperType == null)
{
if (value != null && typeMgr.isSecondClassWrapper(typeName))
{
// The passed in value is a wrapper type already, so just return it!
SCO sco = (SCO)value;
if (replaceField)
{
// Replace the field with this value
ownerOP.replaceField(fmd.getAbsoluteFieldNumber(), sco);
}
return sco;
}
else
{
// typeName not supported directly (no SCO wrapper for the precise type)
if (instantiatedType != null)
{
// Try the instantiated type
if (fullWrapper)
{
wrapperType = typeMgr.getWrappedTypeBackedForType(instantiatedType.getName());
}
else
{
wrapperType = typeMgr.getWrapperTypeForType(instantiatedType.getName());
}
}
if (wrapperType == null)
{
// Try the declared type
if (fullWrapper)
{
wrapperType = typeMgr.getWrappedTypeBackedForType(declaredType.getName());
}
else
{
wrapperType = typeMgr.getWrapperTypeForType(declaredType.getName());
}
}
}
}
if (wrapperType == null)