public void setValue(Object arg) { setProperty(TeiidSqlLexicon.Constant.VALUE_PROP_NAME, arg); if (arg == null) { assignType(DataTypeName.NULL); } else { Class<?> type = arg.getClass(); Class<?> originalType = type; while (type.isArray() && !type.getComponentType().isPrimitive()) { type = type.getComponentType(); } DataTypeName dataTypeName = getTeiidParser().getDataTypeService().retrieveDataTypeName(type); if (dataTypeName != null && originalType.isArray()) { // array of a runtime-type assignType(dataTypeName.getArrayType()); } else if (dataTypeName != null) { assignType(dataTypeName); } else if (originalType.isArray() && !originalType.getComponentType().isPrimitive()) assignType(DataTypeName.OBJECT_ARRAY); else assignType(DataTypeName.OBJECT); } }
public void setType(Class<?> type) { DataTypeName dataTypeName = getDataTypeService().retrieveDataTypeName(type); assignType(dataTypeName); }