private Data convertValToData(String name, Object valObj) {
        final Data.Builder<?> builder = Data.builder().withName(name);

        if (valObj != null) {
            final LoggingConfig loggingConfig = loggingConfigProvider.get();
            if (valObj instanceof Collection<?>) {
                Collection<?> collection = (Collection<?>) valObj;

                if (loggingConfig.getMaxListElements() >= 0
                    && collection.size() > loggingConfig.getMaxListElements()) {
                    final String collectionValue = collection.stream()
                            .limit(loggingConfig.getMaxListElements())
                            .map(Objects::toString)
                            .collect(Collectors.joining(", "));
                    builder.withValue(collectionValue + "...(" + collection.size() +
                                      " elements in total).");
                } else {
                    final String collectionValue = collection.stream()
                            .map(Objects::toString)
                            .collect(Collectors.joining(", "));
                    builder.withValue(collectionValue);
                }
            } else if (HasName.class.isAssignableFrom(valObj.getClass())) {
                builder.withValue(((HasName) valObj).getName());
            } else if (isLeafPropertyType(valObj.getClass())) {
                final String value;
                if (shouldRedact(name.toLowerCase(), valObj.getClass())) {
                    value = "********";
                } else {
                    if (loggingConfig.getMaxDataElementStringLength() > 0) {
                        final String stringVal = valObj.toString();
                        if (stringVal.length() > loggingConfig.getMaxDataElementStringLength()) {
                            value = stringVal.substring(0,
                                    loggingConfig.getMaxDataElementStringLength() - 1)
                                    + "...";
                        } else {
                            value = stringVal;
                        }
                    } else {
                        value = valObj.toString();
                    }
                }
                builder.withValue(value);
            } else {
                getDataItems(valObj).forEach(builder::addData);
            }
        }
        return builder.build();

    }
Create {@link Data} items from properties of the supplied POJO

@param obj POJO from which to extract properties
@return List of {@link Data} items representing properties of the supplied POJO
stroom-event-logging/stroom-event-logging-impl/src/main/java/stroom/event/logging/impl/StroomEventLoggingServiceImpl.java