QPropertyDefinition def = getApplicablePropertyDefinition(qName, type, false);
int targetType = def.getRequiredType();
if (targetType == PropertyType.UNDEFINED) {
targetType = type;
}
QValue qvs;
if (targetType == PropertyType.UNDEFINED) {
qvs = ValueFormat.getQValue(value, session.getNamePathResolver(), session.getQValueFactory());
targetType = qvs.getType();
} else {
Value targetValue = ValueHelper.convert(value, targetType, session.getValueFactory());
qvs = ValueFormat.getQValue(targetValue, session.getNamePathResolver(), session.getQValueFactory());
}
return createProperty(qName, targetType, def, new QValue[] {qvs});