// 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 = fmd.getMetaDataManager().getOMFContext().getTypeManager();
boolean fullWrapper = ownerSM.getStoreManager().getSupportedOptions().contains("ContainerQueueing");
Class wrapperType = null;
if (fullWrapper)
{
wrapperType = typeMgr.getSecondClassWrapper(typeName);
}
else
{
wrapperType = typeMgr.getSecondClassWrapperSimple(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
ownerSM.replaceField(fmd.getAbsoluteFieldNumber(), sco, false);
}
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.getSecondClassWrapper(instantiatedType.getName());
}
else
{
wrapperType = typeMgr.getSecondClassWrapperSimple(instantiatedType.getName());
}
}
if (wrapperType == null)
{
// Try the declared type
if (fullWrapper)
{
wrapperType = typeMgr.getSecondClassWrapper(declaredType.getName());
}
else
{
wrapperType = typeMgr.getSecondClassWrapperSimple(declaredType.getName());
}
}
}
}
if (wrapperType == null)