@SuppressWarnings("unchecked")
  public <E extends Enum<E>> Getter<GettableByIndexData, E> enumGetter(
      DatastaxColumnKey key, Class<?> enumClass) {

    if (key.getDataType() != null) {
      final Class<?> javaClass = key.getDataType() != null ? key.getDataType().asJavaClass() : null;
      if (Number.class.isAssignableFrom(javaClass)) {
        return new OrdinalEnumGetter<GettableByIndexData, E>(
            new DatastaxIntegerGetter(key.getIndex()), (Class<E>) enumClass);
      } else if (String.class.equals(javaClass)) {
        return new StringEnumGetter<GettableByIndexData, E>(
            new DatastaxStringGetter(key.getIndex()), (Class<E>) enumClass);
      }
    } else {
      return new EnumUnspecifiedTypeGetter<GettableByIndexData, E>(
          new DatastaxObjectGetter(key.getIndex()), (Class<E>) enumClass);
    }
    return null;
  }
  @SuppressWarnings("unchecked")
  @Override
  public <P> Getter<GettableByIndexData, P> newGetter(
      Type target, DatastaxColumnKey key, ColumnDefinition<?, ?> columnDefinition) {
    Class<?> targetClass = TypeHelper.toClass(target);
    if (Date.class.equals(targetClass)) {
      return (Getter<GettableByIndexData, P>) new DatastaxDateGetter(key.getIndex());
    }

    if (boolean.class.equals(targetClass) || Boolean.class.equals(targetClass)) {
      return (Getter<GettableByIndexData, P>) new DatastaxBooleanGetter(key.getIndex());
    }

    if (InetAddress.class.equals(targetClass)) {
      return (Getter<GettableByIndexData, P>) new DatastaxInetAddressGetter(key.getIndex());
    }

    if (TupleValue.class.equals(targetClass)) {
      return (Getter<GettableByIndexData, P>) new DatastaxTupleValueGetter(key.getIndex());
    }

    if (Collection.class.isAssignableFrom(targetClass)) {

      Type elementType = TypeHelper.getComponentTypeOfListOrArray(target);
      Class<?> dataTypeClass = Object.class;
      Class<?> dataTypeElt = null;
      DataType dtElt = null;
      if (key.getDataType() != null) {
        DataType dataType = key.getDataType();
        dataTypeClass = dataType.asJavaClass();
        if (dataType.isCollection()) {
          dtElt = key.getDataType().getTypeArguments().get(0);
          dataTypeElt = dtElt.asJavaClass();
        }
      } else {
        dataTypeElt = TypeHelper.toClass(elementType);
      }

      if (dataTypeElt != null) {
        if (TypeHelper.areEquals(elementType, dataTypeElt)) {
          if (Set.class.equals(dataTypeClass)) {
            if (targetClass.isAssignableFrom(dataTypeClass)) {
              return new DatastaxSetGetter(key.getIndex(), TypeHelper.toClass(elementType));
            }
          }
          if (List.class.equals(dataTypeClass)) {
            if (targetClass.isAssignableFrom(dataTypeClass)) {
              return new DatastaxListGetter(key.getIndex(), TypeHelper.toClass(elementType));
            }
          }
        } else {
          Converter<?, ?> converter = getConverter(elementType, dataTypeElt, dtElt);

          if (converter != null) {
            if (Set.class.equals(dataTypeClass)) {
              if (targetClass.isAssignableFrom(dataTypeClass)) {
                return new DatastaxSetWithConverterGetter(key.getIndex(), dataTypeElt, converter);
              }
            }
            if (List.class.equals(dataTypeClass)) {
              if (targetClass.isAssignableFrom(dataTypeClass)) {
                return new DatastaxListWithConverterGetter(key.getIndex(), dataTypeElt, converter);
              }
            }
          }
        }
      }
    }
    if (Map.class.equals(targetClass)) {
      Tuple2<Type, Type> keyValueTypeOfMap = TypeHelper.getKeyValueTypeOfMap(target);

      Class<?> dtKeyType = null;
      Class<?> dtValueType = null;
      DataType dtKey = null;
      DataType dtValue = null;
      if (key.getDataType() != null) {
        List<DataType> typeArguments = key.getDataType().getTypeArguments();
        if (typeArguments.size() == 2) {
          dtKey = typeArguments.get(0);
          dtKeyType = dtKey.asJavaClass();
          dtValue = typeArguments.get(1);
          dtValueType = dtValue.asJavaClass();
        }
      } else {
        dtKeyType = TypeHelper.toClass(keyValueTypeOfMap.first());
        dtValueType = TypeHelper.toClass(keyValueTypeOfMap.second());
      }
      if (dtKeyType != null && dtValueType != null) {
        if (TypeHelper.areEquals(keyValueTypeOfMap.first(), dtKeyType)
            && TypeHelper.areEquals(keyValueTypeOfMap.second(), dtValueType)) {
          return new DatastaxMapGetter(
              key.getIndex(),
              TypeHelper.toClass(keyValueTypeOfMap.first()),
              TypeHelper.toClass(keyValueTypeOfMap.second()));
        } else {
          Converter<?, ?> keyConverter = getConverter(keyValueTypeOfMap.first(), dtKeyType, dtKey);
          Converter<?, ?> valueConverter =
              getConverter(keyValueTypeOfMap.second(), dtValueType, dtValue);

          if (keyConverter != null && valueConverter != null) {
            return new DatastaxMapWithConverterGetter(
                key.getIndex(), dtKeyType, dtValueType, keyConverter, valueConverter);
          }
        }
      }
    }

    if (Tuples.isTuple(target)) {
      if (key.getDataType() != null && key.getDataType() instanceof TupleType) {
        TupleType tt = (TupleType) key.getDataType();

        List<DataType> typeArguments = tt.getTypeArguments();

        TypeVariable<? extends Class<?>>[] typeParameters = targetClass.getTypeParameters();

        if (typeArguments.size() <= typeParameters.length) {
          return (Getter<GettableByIndexData, P>)
              DatastaxTupleGetter.newInstance(datastaxMapperFactory, target, tt, key.getIndex());
        }
      }
    }

    if (TypeHelper.isEnum(target)) {
      final Getter<GettableByIndexData, ? extends Enum> getter =
          enumGetter(key, TypeHelper.toClass(target));
      if (getter != null) {
        return (Getter<GettableByIndexData, P>) getter;
      }
    }

    final GetterFactory<GettableByIndexData, DatastaxColumnKey> rowGetterFactory =
        getterFactories.get(targetClass);

    if (rowGetterFactory != null) {
      return rowGetterFactory.newGetter(target, key, columnDefinition);
    }

    final Getter<GettableByIndexData, P> getter =
        jodaTimeGetterFactory.newGetter(target, key, columnDefinition);

    if (getter != null) {
      return getter;
    }

    if (key.getDataType() != null && key.getDataType() instanceof UserType) {
      UserType ut = (UserType) key.getDataType();
      return (Getter<GettableByIndexData, P>)
          DatastaxUDTGetter.newInstance(datastaxMapperFactory, target, ut, key.getIndex());
    }

    return null;
  }