Hi,

On Tue, Feb 2, 2021 at 12:57 AM Andreas Schaefer
<schaef...@me.com.invalid> wrote:
> ...How can I define a multi-value string with No or just ONE entry?
>
> When I try:
>
> - set test to “one”,            // It is a String[] multi-value but with two 
> values where the 2nd is empty
> - set test to ,                 // The parsing fails

If you need this it requires changes in the parser + JCR processing
code to define a way to mark such a statement as targeting a
multi-value property and process it accordingly.

The jcr-repoinit code at [1] does:

  if (values.size() > 1) {
    Value[] pValues = convertToValues(values);
    n.setProperty(pName, pValues, type);
  } else {
    Value pValue = convertToValue(values.get(0));
    n.setProperty(pName, pValue, type);
  }

So it clearly needs more than one value to create a multi-value
property, and there's no way to express that currently in the reponit
language.

If you agree, please create a SLING- ticket with your requirements,
and patches are welcome of course!

-Bertrand

[1] 
https://github.com/apache/sling-org-apache-sling-jcr-repoinit/blob/5a14f4c3c96381f44310316689fdd4bd048bf436/src/main/java/org/apache/sling/jcr/repoinit/impl/NodePropertiesVisitor.java#L84

Reply via email to