Skip to content

Commit 57bda81

Browse files
authored
Merge pull request #208 from abayer/expose-object2groovy
Add new public object2Groovy method for use in other contexts.
2 parents b3d7ea3 + 5bcd897 commit 57bda81

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

src/main/java/org/jenkinsci/plugins/workflow/cps/Snippetizer.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,17 @@ static String step2Groovy(Step s) throws UnsupportedOperationException {
7979
return object2Groovy(new StringBuilder(), s, false).toString();
8080
}
8181

82+
/**
83+
* Publicly accessible version of {@link #object2Groovy(StringBuilder, Object, boolean)} that translates an object into
84+
* the equivalent Pipeline Groovy string.
85+
*
86+
* @param o The object to translate.
87+
* @return A string translation of the object.
88+
*/
89+
public static String object2Groovy(Object o) throws UnsupportedOperationException {
90+
return object2Groovy(new StringBuilder(), o, false).toString();
91+
}
92+
8293
/**
8394
* Renders the invocation syntax to re-create a given object 'o' into 'b'
8495
*

0 commit comments

Comments
 (0)