default ByteMatchStatement convert()

in aws-wafv2-rulegroup/src/main/java/com/amazonaws/wafv2/rulegroup/converters/StatementConverter.java [116:138]


    default ByteMatchStatement convert(com.amazonaws.wafv2.rulegroup.ByteMatchStatement source) {
        ByteMatchStatement.Builder result = ByteMatchStatement.builder();

        if (!(source.getSearchStringBase64() == null ^ source.getSearchString() == null)) {
            throw new TerminalException("You must only specify exactly one of SearchString and SearchStringBase64");
        } else if (source.getSearchString() != null) {
            result.searchString(StatementCommonsConverter.INSTANCE.convertSearchString(
                    source.getSearchString()));
        } else if (source.getSearchStringBase64() != null) {
            result.searchString(SdkBytes.fromByteArray(Base64.decode(source.getSearchStringBase64())));
        }

        if (source.getTextTransformations() != null) {
            result.textTransformations(source.getTextTransformations().stream()
                    .map(textTransformation -> StatementCommonsConverter.INSTANCE.convert(textTransformation))
                    .collect(Collectors.toList()));
        }

        result.positionalConstraint(source.getPositionalConstraint());
        result.fieldToMatch(StatementCommonsConverter.INSTANCE.convert(source.getFieldToMatch()));

        return result.build();
    }