Populate either the object o via setters or the Collection col by adding
elements of type cl

@param o the object
@param subroot of XML data
@param col a collection
@param cl the class
@throws Throwable on error
547164
private void populate(final Element subroot,
                        final Object o,
                        final Collection<Object> col,
                        final Class cl) throws Throwable {
    if (cb.skipElement(subroot)) {
      return;
    }
    
    Method meth = null;

    Class elClass = cb.forElement(subroot);

    if (col == null) {
      /* We must have a setter */
      meth = findSetter(o, subroot);

      if (meth == null) {
        error("No setter for " + subroot);

        return;
      }

      /* We require a single parameter */

      final Class[] parClasses = meth.getParameterTypes();
      if (parClasses.length != 1) {
        error("Invalid setter method " + subroot);
        throw new SAXException("Invalid setter method " + subroot);
      }

      elClass = parClasses[0];
    } else if (cl != null) {
      elClass = cl;
    }

    if (elClass == null) {
      error("No class for element " + subroot);
      return;
    }
    
    if (!XmlUtil.hasChildren(subroot)) {
      /* A primitive value for which we should have a setter */

      final Object val = simpleValue(elClass, subroot);
      if (val == null) {
        error("Unsupported par class " + elClass +
              " for field " + subroot);
        throw new SAXException("Unsupported par class " + elClass +
                                  " for field " + subroot);
      }

      assign(val, subroot, col, o, meth);

      return;
    }

    /* There are children to this element. It either represents a complex type
     * or a collection.
     */

    if (Collection.class.isAssignableFrom(elClass)) {
      final Collection<Object> colVal;

      if (elClass.getName().equals("java.util.Set")) {
        colVal = new TreeSet<>();
      } else if (elClass.getName().equals("java.util.List")) {
        colVal = new ArrayList<>();
      } else if (elClass.getName().equals("java.util.Collection")) {
        colVal = new ArrayList<>();
      } else {
        error("Unsupported element class " + elClass +
              " for field " + subroot);
        return;
      }

      assign(colVal, subroot, col, o, meth);

      // Figure out the class of the elements
      /* I thought I might be able to extract it from the generic info -
       * Doesn't appear to be the case.
       */

      final Type[] gpts = meth.getGenericParameterTypes();

      /* Should only be one parameter */
      if (gpts.length != 1) {
        error("Unsupported type " + elClass +
                      " with name " + subroot);
        return;
      }

      final Type gpt = gpts[0];

      if (!(gpt instanceof ParameterizedType)) {
        error("Unsupported type " + elClass +
                      " with name " + subroot);
        return;
      }

      final ParameterizedType aType = (ParameterizedType)gpt;

      final Type[] parameterArgTypes = aType.getActualTypeArguments();

      /* Should only be one arg */
      if (parameterArgTypes.length != 1) {
        error("Unsupported type " + elClass +
                      " with name " + subroot);
        return;
      }

      final Type parameterArgType = parameterArgTypes[0];

      final Class colElType = (Class)parameterArgType;
      /*/
      ConfInfo ci = meth.getAnnotation(ConfInfo.class);

      String colElTypeName;

      if (ci == null) {
        colElTypeName = "java.lang.String";
      } else {
        colElTypeName = ci.elementType();
      }
      */

      for (final Element el: XmlUtil.getElementsArray(subroot)) {
        populate(el, o, colVal, /*Class.forName(colElTypeName)*/colElType);
      }

      return;
    }

    /* Asssume a complex type */

    final Object val = fromClass(elClass);

    assign(val, subroot, col, o, meth);

    for (final Element el: XmlUtil.getElementsArray(subroot)) {
      populate(el, val, null, null);
    }
  }
288277
public void error(Object o) {
        if (o instanceof Throwable) {
            logger.error(o, (Throwable) o);
        } else {
            logger.error(o);
        }
    }
843
protected void writeObject(Object o)
	{
		if (o == null)
		{
			return;
		}
		getPersistenceDelegate(o.getClass()).writeObject(o, this);
	}
544578
public void setField(Object o, String fieldName, Object newValue) {
        if (o == null) {
            throw new IllegalArgumentException("No object to set on provided");
        }
        Field field = findField(o, fieldName);
        if (field == null) {
            throw new IllegalArgumentException(o.getClass() + " does not have a field " + fieldName);
        } else {
            if (!field.isAccessible()) {
                field.setAccessible(true);
            }
            try {
                field.set(o, newValue);
            } catch (IllegalAccessException e) {
                throw new IllegalArgumentException("Unable to set " + newValue + " for " + fieldName, e);
            }
        }
    }
770194
public static void populateColumnAndSuperColumnMaps(EntityMetadata m, Map<String, Field> columnNameToFieldMap,
            Map<String, Field> superColumnNameToFieldMap, final KunderaMetadata kunderaMetadata)
    {

        getEmbeddableType(m, columnNameToFieldMap, superColumnNameToFieldMap, kunderaMetadata);
    }
841969
@SuppressWarnings("unchecked")
    private void setValue(List<Element> elements, String attrName, Object pojo,
                          CustomPropertyDescriptor field) {
        XmlNode attrXmlNode = field.getAnnotation(XmlNode.class);
        log.debug("要赋值的fieldName为{}", field.getName());
        final XmlTypeConvert convert = XmlTypeConverterUtil.resolve(attrXmlNode, field);

        Class<? extends Collection> collectionClass;
        Class<? extends Collection> real = (Class<? extends Collection>) field.getRealType();

        if (attrXmlNode != null) {
            collectionClass = attrXmlNode.arrayType();
            if (!collectionClass.equals(real) && !real.isAssignableFrom(collectionClass)) {
                log.warn("用户指定的集合类型[{}]不是字段的实际集合类型[{}]的子类，使用字段的实际集合类型", collectionClass, real);
                collectionClass = real;
            }
        } else {
            collectionClass = real;
        }

        if (!StringUtils.isEmpty(attrXmlNode.arrayRoot()) && !elements.isEmpty()) {
            elements = elements.get(0).elements(attrXmlNode.arrayRoot());
        }

        //将数据转换为用户指定数据
        List<?> list = elements.stream().map(d -> convert.read(d, attrName))
            .collect(Collectors.toList());

        if (!trySetValue(list, pojo, field, collectionClass)) {
            //使用注解标记的类型赋值失败并且注解的集合类型与实际字段类型不符时尝试使用字段实际类型赋值
            if (!trySetValue(list, pojo, field, real)) {
                log.warn("无法为字段[{}]赋值", field.getName());
            }
        }
    }
533781
@Override
    void parseTablesAndParams(VoltXMLElement stmtNode) {
        m_tableList.clear();
        // Parse parameters first to satisfy a dependency of expression parsing
        // which happens during table scan parsing.
        parseParameters(stmtNode);

        assert(stmtNode.children.size() > 1);
        AbstractParsedStmt childStmt = null;
        for (VoltXMLElement childSQL : stmtNode.children) {
            if (childSQL.name.equals(SELECT_NODE_NAME)) {
                childStmt = new ParsedSelectStmt(null, m_paramValues, m_db);
                // Assign every child a unique ID
                childStmt.setStmtId(AbstractParsedStmt.NEXT_STMT_ID++);
                childStmt.m_parentStmt = m_parentStmt;
                childStmt.setParentAsUnionClause();

            }
            else if (childSQL.name.equals(UNION_NODE_NAME)) {
                childStmt = new ParsedUnionStmt(null, m_paramValues, m_db);
                // Set the parent before recursing to children.
                childStmt.m_parentStmt = m_parentStmt;
            }
            else {
                // skip Order By, Limit/Offset. They will be processed later
                // by the 'parse' method
                continue;
            }
            childStmt.m_paramsById.putAll(m_paramsById);
            childStmt.parseTablesAndParams(childSQL);
            promoteUnionParametersFromChild(childStmt);
            m_children.add(childStmt);
            // Add statement's tables to the consolidated list
            m_tableList.addAll(childStmt.m_tableList);

            // m_tableAliasListAsJoinOrder is not interesting for UNION
            // m_tableAliasMap may have same alias table from different children
            addStmtTablesFromChildren(childStmt.getScanEntrySet());
        }
    }
342335
public static <T> void addAll(Collection<T> col, Enumeration<T> e) {
		while (e.hasMoreElements())
			col.add(e.nextElement());
	}
1314846
public void assignField(ConnectionSource connectionSource, Object data, Object val, boolean parentObject,
			ObjectCache objectCache) throws SQLException {

		if (logger.isLevelEnabled(Level.TRACE)) {
			logger.trace("assiging from data {}, val {}: {}", (data == null ? "null" : data.getClass()),
					(val == null ? "null" : val.getClass()), val);
		}
		// if this is a foreign object then val is the foreign object's id val
		if (foreignRefField != null && val != null) {
			// get the current field value which is the foreign-id
			Object foreignRef = extractJavaFieldValue(data);
			/*
			 * See if we don't need to create a new foreign object. If we are refreshing and the id field has not
			 * changed then there is no need to create a new foreign object and maybe lose previously refreshed field
			 * information.
			 */
			if (foreignRef != null && foreignRef.equals(val)) {
				return;
			}
			// awhitlock: raised as OrmLite issue: bug #122
			Object cachedVal;
			ObjectCache foreignCache = foreignDao.getObjectCache();
			if (foreignCache == null) {
				cachedVal = null;
			} else {
				cachedVal = foreignCache.get(getType(), val);
			}
			if (cachedVal != null) {
				val = cachedVal;
			} else if (!parentObject) {
				// the value we are to assign to our field is now the foreign object itself
				val = createForeignObject(connectionSource, val, objectCache);
			}
		}

		if (fieldSetMethod == null) {
			try {
				field.set(data, val);
			} catch (IllegalArgumentException e) {
				if (val == null) {
					throw SqlExceptionUtil.create("Could not assign object '" + val + "' to field " + this, e);
				} else {
					throw SqlExceptionUtil.create(
							"Could not assign object '" + val + "' of type " + val.getClass() + " to field " + this, e);
				}
			} catch (IllegalAccessException e) {
				throw SqlExceptionUtil.create(
						"Could not assign object '" + val + "' of type " + val.getClass() + "' to field " + this, e);
			}
		} else {
			try {
				fieldSetMethod.invoke(data, val);
			} catch (Exception e) {
				throw SqlExceptionUtil
						.create("Could not call " + fieldSetMethod + " on object with '" + val + "' for " + this, e);
			}
		}
	}
287850
@Override
	public void updateClob(final int columnIndex, final Clob x) throws SQLException {
		wrapped.updateClob(columnIndex, x);
	}
973692
private static Class _loadClass(ClassLoading cl, String className, Class defaultValue, Set<Throwable> exceptions) {
	className = className.trim();
	if (StringUtil.isEmpty(className)) return defaultValue;

	Class clazz = checkPrimaryTypesBytecodeDef(className, null);
	if (clazz != null) return clazz;

	// array in the format boolean[] or java.lang.String[]
	if (className.endsWith("[]")) {

	    StringBuilder pureCN = new StringBuilder(className);
	    int dimensions = 0;
	    do {
		pureCN.delete(pureCN.length() - 2, pureCN.length());
		dimensions++;
	    }
	    while (pureCN.lastIndexOf("[]") == pureCN.length() - 2);

	    clazz = __loadClass(cl, pureCN.toString(), null, exceptions);

	    if (clazz != null) {

		for (int i = 0; i < dimensions; i++)
		    clazz = toArrayClass(clazz);
		return clazz;
	    }
	}

	// array in the format [C or [Ljava.lang.String;
	else if (className.charAt(0) == '[') {

	    StringBuilder pureCN = new StringBuilder(className);
	    int dimensions = 0;

	    do {
		pureCN.delete(0, 1);
		dimensions++;
	    }
	    while (pureCN.charAt(0) == '[');

	    clazz = __loadClass(cl, pureCN.toString(), null, exceptions);
	    if (clazz != null) {
		for (int i = 0; i < dimensions; i++)
		    clazz = toArrayClass(clazz);
		return clazz;
	    }
	}
	return __loadClass(cl, className, defaultValue, exceptions);
    }
79265
protected void populateBean(final T resultBean, final String[] nameMapping, final CsvBindingErrors bindingErrors) {
        
        // map each column to its associated field on the bean
        for( int i = 0; i < nameMapping.length; i++ ) {
            final String fieldName = nameMapping[i];
            final Object fieldValue = processedColumns.get(i);
            
            // don't call a set-method in the bean if there is no name mapping for the column or no result to store
            if( fieldName == null || fieldValue == null || bindingErrors.hasFieldErrors(fieldName)) {
                continue;
            }
            
            // invoke the setter on the bean
            final Method setMethod = cache.getSetMethod(resultBean, fieldName, fieldValue.getClass());
            try {
                setMethod.invoke(resultBean, fieldValue);
                
            } catch(final Exception e) {
                throw new SuperCsvReflectionException(String.format("error invoking method %s()", setMethod.getName()), e);
            }
            
        }
        
    }
1099697
@SuppressWarnings("unchecked")
  private <T> Node registerClass(final Class<T> c)
      throws ClassHierarchyException {
    if (c.isArray()) {
      throw new UnsupportedOperationException("Can't register array types");
    }
    try {
      return getAlreadyBoundNode(c);
    } catch (final NameResolutionException ignored) {
      // node not bound yet
    }

    final Node n = buildPathToNode(c);

    if (n instanceof ClassNode) {
      final ClassNode<T> cn = (ClassNode<T>) n;
      final Class<T> superclass = (Class<T>) c.getSuperclass();
      if (superclass != null) {
        try {
          ((ClassNode<T>) getAlreadyBoundNode(superclass)).putImpl(cn);
        } catch (final NameResolutionException e) {
          throw new IllegalStateException(e);
        }
      }
      for (final Class<?> interf : c.getInterfaces()) {
        try {
          ((ClassNode<T>) getAlreadyBoundNode(interf)).putImpl(cn);
        } catch (final NameResolutionException e) {
          throw new IllegalStateException(e);
        }
      }
    }
    return n;
  }
663147
public final void setObjectTypeNode(final ObjectTypeNode objectTypeNode) {
        this.objectTypeNode = objectTypeNode;

        NodeReferenceSetter setter= new NodeReferenceSetter();
        ObjectTypeNodeParser parser = new ObjectTypeNodeParser(objectTypeNode);
        parser.accept(setter);
    }
547607
private void configure(Object obj, XmlParser.Node cfg, int i) throws ClassNotFoundException,
            NoSuchMethodException, InvocationTargetException, IllegalAccessException
    {
        XmlParser.Node node = null;
        try
        {
            for (; i < cfg.size(); i++)
            {
                Object o = cfg.get(i);
                if (o instanceof String) continue;
                node = (XmlParser.Node) o;

                String tag = node.getTag();
                if ("Set".equals(tag))
                    set(obj, node);
                else if ("Put".equals(tag))
                    put(obj, node);
                else if ("Call".equals(tag))
                    call(obj, node);
                else if ("Get".equals(tag))
                    get(obj, node);
                else if ("New".equals(tag))
                    newObj(obj, node);
                else if ("Ref".equals(tag))
                    refObj(obj, node);
                else
                    throw new IllegalStateException("Unknown tag: " + tag);
            }
        }
        catch(InvocationTargetException e)
        {
            log.warn("Exception at "+node.toString(),e.getTargetException());
            throw e;
        }
        catch (Error e)
        {
            log.debug(node);
            throw e;
        }
        catch (Exception e)
        {
            log.debug(node);
            if (e instanceof NoSuchMethodException) throw (NoSuchMethodException) e;
            if (e instanceof InvocationTargetException) throw (InvocationTargetException) e;
            if (e instanceof IllegalAccessException) throw (IllegalAccessException) e;
            if (e instanceof RuntimeException) throw (RuntimeException) e;
        }
    }
171046
function(nodeList, parent) {
            // One level down
            nodeDepth++;

            // Create corresponding tree node if not already there for this depth
            if(!tree[nodeDepth]) {
                tree[nodeDepth] = [];
            }


            // Parse each node at this depth for attributes and any children
            for(var j=0; j<nodeList.length; j++) {
                var currentNode = nodeList[j];

                // Instantiate a new Column for each node
                var oColumn = new YAHOO.widget.Column(currentNode);
                
                // Cross-reference Column ID back to the original object literal definition
                currentNode.yuiColumnId = oColumn._sId;
                
                // Add the new Column to the flat list
                flat.push(oColumn);

                // Assign its parent as an attribute, if applicable
                if(parent) {
                    oColumn._oParent = parent;
                }

                // The Column has descendants
                if(YAHOO.lang.isArray(currentNode.children)) {
                    oColumn.children = currentNode.children;

                    // Determine COLSPAN value for this Column
                    var terminalChildNodes = 0;
                    var countTerminalChildNodes = function(ancestor) {
                        var descendants = ancestor.children;
                        // Drill down each branch and count terminal nodes
                        for(var k=0; k<descendants.length; k++) {
                            // Keep drilling down
                            if(YAHOO.lang.isArray(descendants[k].children)) {
                                countTerminalChildNodes(descendants[k]);
                            }
                            // Reached branch terminus
                            else {
                                terminalChildNodes++;
                            }
                        }
                    };
                    countTerminalChildNodes(currentNode);
                    oColumn._nColspan = terminalChildNodes;

                    // Cascade certain properties to children if not defined on their own
                    var currentChildren = currentNode.children;
                    for(var k=0; k<currentChildren.length; k++) {
                        var child = currentChildren[k];
                        if(oColumn.className && (child.className === undefined)) {
                            child.className = oColumn.className;
                        }
                        if(oColumn.editor && (child.editor === undefined)) {
                            child.editor = oColumn.editor;
                        }
                        //TODO: Deprecated
                        if(oColumn.editorOptions && (child.editorOptions === undefined)) {
                            child.editorOptions = oColumn.editorOptions;
                        }
                        if(oColumn.formatter && (child.formatter === undefined)) {
                            child.formatter = oColumn.formatter;
                        }
                        if(oColumn.resizeable && (child.resizeable === undefined)) {
                            child.resizeable = oColumn.resizeable;
                        }
                        if(oColumn.sortable && (child.sortable === undefined)) {
                            child.sortable = oColumn.sortable;
                        }
                        if(oColumn.hidden) {
                            child.hidden = true;
                        }
                        if(oColumn.width && (child.width === undefined)) {
                            child.width = oColumn.width;
                        }
                        if(oColumn.minWidth && (child.minWidth === undefined)) {
                            child.minWidth = oColumn.minWidth;
                        }
                        if(oColumn.maxAutoWidth && (child.maxAutoWidth === undefined)) {
                            child.maxAutoWidth = oColumn.maxAutoWidth;
                        }
                        // Backward compatibility
                        if(oColumn.type && (child.type === undefined)) {
                            child.type = oColumn.type;
                        }
                        if(oColumn.type && !oColumn.formatter) {
                            YAHOO.log("The property type has been" +
                            " deprecated in favor of formatter", "warn", oColumn.toString());
                            oColumn.formatter = oColumn.type;
                        }
                        if(oColumn.text && !YAHOO.lang.isValue(oColumn.label)) {
                            YAHOO.log("The property text has been" +
                            " deprecated in favor of label", "warn", oColumn.toString());
                            oColumn.label = oColumn.text;
                        }
                        if(oColumn.parser) {
                            YAHOO.log("The property parser is no longer supported",
                            "warn", this.toString());
                        }
                        if(oColumn.sortOptions && ((oColumn.sortOptions.ascFunction) ||
                                (oColumn.sortOptions.descFunction))) {
                            YAHOO.log("The properties sortOptions.ascFunction and " +
                            " sortOptions.descFunction have been deprecated in favor " +
                            " of sortOptions.sortFunction", "warn", oColumn.toString());
                        }
                    }

                    // The children themselves must also be parsed for Column instances
                    if(!tree[nodeDepth+1]) {
                        tree[nodeDepth+1] = [];
                    }
                    parseColumns(currentChildren, oColumn);
                }
                // This Column does not have any children
                else {
                    oColumn._nKeyIndex = keys.length;
                    oColumn._nColspan = 1;
                    keys.push(oColumn);
                }

                // Add the Column to the top-down tree
                tree[nodeDepth].push(oColumn);
            }
            nodeDepth--;
        }
1202657
private static void setBasicValue(Object entity, Field member, String columnName, UDTValue row,
            CassandraType dataType, MetamodelImpl metamodel)
    {
    	if(row.isNull(columnName)){
        	return;
        }
        Object retVal = null;
        switch (dataType)
        {
        case BYTES:
            // case CUSTOM:
            retVal = row.getBytes(columnName);
            if (retVal != null)
            {
                setFieldValue(entity, member, ((ByteBuffer) retVal).array());
            }
            break;

        case BOOLEAN:
            retVal = row.getBool(columnName);
            setFieldValue(entity, member, retVal);
            break;

        case BIGINT:
            // bigints in embeddables and element collections are mapped/defined
            // by Long
        case LONG:
        case COUNTER:
            retVal = row.getLong(columnName);
            setFieldValue(entity, member, retVal);
            break;

        case DECIMAL:
            retVal = row.getDecimal(columnName);
            setFieldValue(entity, member, retVal);
            break;

        case DOUBLE:
            retVal = row.getDouble(columnName);
            setFieldValue(entity, member, retVal);
            break;

        case FLOAT:
            retVal = row.getFloat(columnName);
            setFieldValue(entity, member, retVal);
            break;

        case INET:
            retVal = row.getInet(columnName);
            setFieldValue(entity, member, retVal);
            break;

        case INT:
            retVal = row.getInt(columnName);
            retVal = setIntValue(member, retVal);
            setFieldValue(entity, member, retVal);
            break;

        case ASCII:
        case STRING:
        case CHARACTER:
            try
            {
                row.getBytes(columnName);
            }
            catch (Exception e)
            {
                // do nothing
            }
            retVal = row.getString(columnName);
            retVal = setTextValue(entity, member, retVal);
            setFieldValue(entity, member, retVal);
            break;

        case TIMESTAMP:
            retVal = row.getTimestamp(columnName);
            if (retVal != null && member != null)
                retVal = CassandraDataTranslator.decompose(member.getType(),
                        ByteBufferUtil.bytes(((Date) retVal).getTime()).array(), true);
            setFieldValue(entity, member, retVal);
            break;

        case UUID:
            // case TIMEUUID:
            retVal = row.getUUID(columnName);
            setFieldValue(entity, member, retVal);
            break;

        case LIST:
            Class listAttributeTypeClass = PropertyAccessorHelper.getGenericClass(member);
            Class listClazz = null;
            boolean isElementCollectionList = false;
            if (listAttributeTypeClass.isAssignableFrom(byte[].class))
            {

                listClazz = ByteBuffer.class;
            }
            else if (listAttributeTypeClass.isAnnotationPresent(Embeddable.class))
            {
                isElementCollectionList = true;
                listClazz = UDTValue.class;
            }
            else
            {
                listClazz = listAttributeTypeClass;
            }
            retVal = row.getList(columnName, listClazz);
            Collection resultList = new ArrayList();
            if (isElementCollectionList)
            {
                Iterator collectionItems = ((Collection) retVal).iterator();
                while (collectionItems.hasNext())
                {
                    resultList.add(setUDTValue(entity, listAttributeTypeClass, (UDTValue) collectionItems.next(),
                            metamodel));
                }
            }

            if (retVal != null && !((List) retVal).isEmpty() && !isElementCollectionList)
            {
                if (listAttributeTypeClass.isAssignableFrom(byte[].class))
                {
                    setFieldValue(entity, member, CassandraDataTranslator.marshalCollection(BytesType.class,
                            (Collection) retVal, listAttributeTypeClass, ArrayList.class));
                }
                else
                {
                    Iterator collectionItems = ((Collection) retVal).iterator();
                    while (collectionItems.hasNext())
                    {
                        resultList.add(collectionItems.next());
                    }
                    setFieldValue(entity, member, resultList);
                }

            }
            else if (retVal != null && !((Collection) retVal).isEmpty())
            {
                setFieldValue(entity, member, resultList);
            }
            break;

        case SET:
            Class setAttributeTypeClass = PropertyAccessorHelper.getGenericClass(member);
            Class setClazz = null;
            boolean isElementCollectionSet = false;
            if (setAttributeTypeClass.isAssignableFrom(byte[].class))
            {

                setClazz = ByteBuffer.class;
            }
            else if (setAttributeTypeClass.isAnnotationPresent(Embeddable.class))
            {
                isElementCollectionSet = true;
                setClazz = UDTValue.class;
            }
            else
            {
                setClazz = setAttributeTypeClass;
            }
            retVal = row.getSet(columnName, setClazz);
            Collection resultSet = new HashSet();
            if (isElementCollectionSet)
            {
                Iterator collectionItems = ((Collection) retVal).iterator();
                while (collectionItems.hasNext())
                {
                    resultSet.add(setUDTValue(entity, setAttributeTypeClass, (UDTValue) collectionItems.next(),
                            metamodel));
                }
            }

            if (retVal != null && !((Set) retVal).isEmpty() && !isElementCollectionSet)
            {
                if (setAttributeTypeClass.isAssignableFrom(byte[].class))
                {
                    setFieldValue(entity, member, CassandraDataTranslator.marshalCollection(BytesType.class,
                            (Collection) retVal, setAttributeTypeClass, HashSet.class));
                }
                else
                {
                    Iterator collectionItems = ((Collection) retVal).iterator();
                    while (collectionItems.hasNext())
                    {
                        resultSet.add(collectionItems.next());
                    }
                    setFieldValue(entity, member, resultSet);
                }
            }
            else if (retVal != null && !((Collection) retVal).isEmpty())
            {
                setFieldValue(entity, member, resultSet);
            }
            break;
        /*
         * ASCII, BIGINT, BLOB, BOOLEAN, COUNTER, DECIMAL, DOUBLE, FLOAT, INET,
         * INT, TEXT, TIMESTAMP, UUID, VARCHAR, VARINT, TIMEUUID, LIST, SET,
         * MAP, CUSTOM;
         */
        case MAP:
            List<Class<?>> mapGenericClasses = PropertyAccessorHelper.getGenericClasses(member);

            Class keyClass = CassandraValidationClassMapper.getValidationClassInstance(mapGenericClasses.get(0), true);
            Class valueClass = CassandraValidationClassMapper
                    .getValidationClassInstance(mapGenericClasses.get(1), true);
            Class mapValueClazz = null;
            boolean isElementCollectionMap = false;
            if (mapGenericClasses.get(1).isAssignableFrom(byte[].class))
            {

                mapValueClazz = ByteBuffer.class;
            }
            else if (mapGenericClasses.get(1).isAnnotationPresent(Embeddable.class))
            {
                isElementCollectionMap = true;
                mapValueClazz = UDTValue.class;
            }
            else
            {
                mapValueClazz = mapGenericClasses.get(1);
            }
            retVal = row.getMap(columnName, mapGenericClasses.get(0).isAssignableFrom(byte[].class) ? ByteBuffer.class
                    : mapGenericClasses.get(0), mapValueClazz);

            Map resultMap = new HashMap();

            if (isElementCollectionMap)
            {
                Iterator keys = ((Map) retVal).keySet().iterator();
                while (keys.hasNext())
                {
                    Object keyValue = keys.next();
                    resultMap.put(
                            keyValue,
                            setUDTValue(entity, mapGenericClasses.get(1), (UDTValue) ((Map) retVal).get(keyValue),
                                    metamodel));
                }
            }

            boolean isByteBuffer = mapGenericClasses.get(0).isAssignableFrom(byte[].class)
                    || mapGenericClasses.get(1).isAssignableFrom(byte[].class);

            // set the values.
            if (retVal != null && !((Map) retVal).isEmpty() && !isElementCollectionMap)
            {
                if (isByteBuffer)
                {
                    setFieldValue(entity, member,
                            CassandraDataTranslator.marshalMap(mapGenericClasses, keyClass, valueClass, (Map) retVal));
                }
                else
                {
                    Iterator keys = ((Map) retVal).keySet().iterator();
                    while (keys.hasNext())
                    {
                        Object keyValue = keys.next();
                        resultMap.put(keyValue, ((Map) retVal).get(keyValue));
                    }
                    setFieldValue(entity, member, resultMap);
                }
            }
            else if (retVal != null && !((Map) retVal).isEmpty())
            {
                setFieldValue(entity, member, resultMap);
            }
            break;
        }

    }