public String getFundamentalValueAsJson()

in api/applib/src/main/java/org/apache/causeway/applib/util/schema/CommonDtoUtils.java [200:260]


    public String getFundamentalValueAsJson(
            final @NonNull ValueType valueType,
            final @Nullable ValueDto valueDto) {

        if(valueDto==null) {
            return null;
        }
        switch(valueType) {
        case REFERENCE:
        case COMPOSITE:
        case COLLECTION:
            throw _Exceptions.unsupportedOperation("valueType %s is not fundamental", valueType);

        case STRING:
            return valueDto.getString();
        case BYTE:
            return _NullSafe.toString(valueDto.getByte());
        case SHORT:
            return _NullSafe.toString(valueDto.getShort());
        case INT:
            return _NullSafe.toString(valueDto.getInt());
        case LONG:
            return _NullSafe.toString(valueDto.getLong());
        case FLOAT:
            return _NullSafe.toString(valueDto.getFloat());
        case DOUBLE:
            return _NullSafe.toString(valueDto.getDouble());
        case BOOLEAN:
            return _NullSafe.toString(valueDto.isBoolean());
        case CHAR:
            final String aChar = valueDto.getChar();
            if(_Strings.isNullOrEmpty(aChar)) { return null; }
            return ""+aChar.charAt(0);
        case BIG_DECIMAL:
            return _NullSafe.toString(valueDto.getBigDecimal());
        case BIG_INTEGER:
            return _NullSafe.toString(valueDto.getBigInteger());
        case LOCAL_DATE:
            return _NullSafe.toString(valueDto.getLocalDate());
        case LOCAL_TIME:
            return _NullSafe.toString(valueDto.getLocalTime());
        case LOCAL_DATE_TIME:
            return _NullSafe.toString(valueDto.getLocalDateTime());
        case OFFSET_DATE_TIME:
            return _NullSafe.toString(valueDto.getOffsetDateTime());
        case OFFSET_TIME:
            return _NullSafe.toString(valueDto.getOffsetTime());
        case ZONED_DATE_TIME:
            return _NullSafe.toString(valueDto.getZonedDateTime());
        case ENUM:
            return dtoToJson(valueDto.getEnum());
        case BLOB:
            return dtoToJson(valueDto.getBlob());
        case CLOB:
            return dtoToJson(valueDto.getClob());
        case VOID:
            return null;
        default:
            throw _Exceptions.unmatchedCase(valueType);
        }
    }