You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sling.apache.org by "Bertrand Delacretaz (Jira)" <ji...@apache.org> on 2021/03/18 10:11:00 UTC

[jira] [Commented] (SLING-10236) Introduce Operation.asRepoInitString

    [ https://issues.apache.org/jira/browse/SLING-10236?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17304011#comment-17304011 ] 

Bertrand Delacretaz commented on SLING-10236:
---------------------------------------------

I see the idea but that might not be trivial to implement. The operations objects are created by the parser, like at [1], and at that point to input is already tokenized and AFAIK would have to be reconstructed anyway.

How about a {{getParametersList()}} method that provides a (lazily created) List of name/value pairs that can be used as desired? I'm worried that reconstructing the input from parameters is not really useful except for informational purposes, with a {{getParametersList()}} method that reconstruction can happen in the clients based on their actual needs, with less code to write overall.

[1] https://github.com/apache/sling-org-apache-sling-repoinit-parser/blob/287ca1c4f8c2269e2b20938d7f54e24f6d40c244/src/main/javacc/RepoInitGrammar.jjt#L689

> Introduce Operation.asRepoInitString
> ------------------------------------
>
>                 Key: SLING-10236
>                 URL: https://issues.apache.org/jira/browse/SLING-10236
>             Project: Sling
>          Issue Type: Improvement
>          Components: Repoinit
>            Reporter: Angela Schreiber
>            Priority: Major
>
> for SLING-10219 (and maybe other use cases too) it would be great if {{org.apache.sling.repoinit.parser.operations.Operation}} would come with a {{asRepoInitString}} method that would allow to obtain the original repo-init statements.
> I was checking if {{toString}} would allow to extract  that (with a bit of extra effort) but unfortunately the default implementation is:
> {code}
>     public String toString() {
>         return this.getClass().getSimpleName() + " " + this.getParametersDescription();
>     }
> {code}
> and {{getParametersDescription}} isn't implemented in a consistent way and in some cases doesn't reveal all information needed.
> further more even the {{toString}} method isn't consistent across the various operation implementations (e.g. {{RegisterPrivilege.toString}} actually coming close to the original statement and not including the simple class name)



--
This message was sent by Atlassian Jira
(v8.3.4#803005)