class StrictMessageWrapper implements IMessage {

    @Override
    public void addField(String name, Object value) {
        IFieldStructure fieldStructure = messageStructure.getFields().get(name);
        if (fieldStructure == null) {
            message.addField(name, value);
            return;
        }

        if (value == null) {
            message.addField(name, requiredNotNull(value, fieldStructure));
            return;
        }

        if (fieldStructure.isComplex()) {
            if (fieldStructure.isCollection()) {
                message.addField(name, castValueToCollection(value, StrictMessageWrapper.class));
            } else {
                Object element = value;
                if (value instanceof List<?>) {
                    element = extractValueFromCollection((List<?>)value);
                }
                message.addField(name, checkElement(requiredNotNull(element, fieldStructure), StrictMessageWrapper.class));
            }
        } else {
            try {
                Class<?> clazz = getClass().getClassLoader().loadClass(fieldStructure.getJavaType().value());

                if (fieldStructure.isCollection()) {
                    message.addField(name, castValueToCollection(value, clazz));
                } else {
                    Object element = value;
                    if (value instanceof List<?>) {
                        element = extractValueFromCollection((List<?>)value);
                    }
                    message.addField(name, checkElement(requiredNotNull(element, fieldStructure), clazz));
                }
            } catch (ClassNotFoundException e) {
                throw new EPSCommonException("Unknown field type: " + fieldStructure.getJavaType().value(), e);
            }
        }
    }

    public  StrictMessageWrapper(IMessage message, IMessageStructure messageStructure);

}