Skip to content

Commit

Permalink
norm() functions for PolyStrings
Browse files Browse the repository at this point in the history
  • Loading branch information
semancik committed Apr 27, 2015
1 parent e50fd32 commit 82b326f
Showing 1 changed file with 32 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,39 @@ public String norm(String orig) {
polyString.recompute(prismContext.getDefaultPolyStringNormalizer());
return polyString.getNorm();
}

/**
* Normalize a PolyString value.
*
* @param orig original value to normalize
* @return normalized value
*/
public String norm(PolyString orig) {
if (orig == null){
return null;
}
if (orig.getNorm() != null) {
return orig.getNorm();
}
orig.recompute(prismContext.getDefaultPolyStringNormalizer());
return orig.getNorm();
}

/**
* Normalize a PolyStringType value.
*
* @param orig original value to normalize
* @return normalized value
*/
public String norm(PolyStringType orig) {
if (orig == null){
return null;
}
PolyString polyString = orig.toPolyString();
return norm(polyString);
}


/**
* Converts whatever it gets to a string. But it does it in a sensitive way.
* E.g. it tries to detect collections and returns the first element (if there is only one).
Expand Down

0 comments on commit 82b326f

Please sign in to comment.