[GitHub] commons-text pull request #62: TEXT-101: Moved RandomStringUtils to Commons-...

2017-09-29 Thread ameyjadiye
Github user ameyjadiye closed the pull request at:

https://github.com/apache/commons-text/pull/62


---

-
To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
For additional commands, e-mail: dev-h...@commons.apache.org



[GitHub] commons-text pull request #62: TEXT-101: Moved RandomStringUtils to Commons-...

2017-09-25 Thread ameyjadiye
Github user ameyjadiye commented on a diff in the pull request:

https://github.com/apache/commons-text/pull/62#discussion_r140843601
  
--- Diff: src/main/java/org/apache/commons/text/RandomStringGenerator.java 
---
@@ -324,6 +324,40 @@ public Builder withinRange(final int minimumCodePoint, 
final int maximumCodePoin
 
 /**
  * 
+ * Specifies the array of minimum and maximum char allowed in the
+ * generated string.
+ * 
+ *
+ * For example:
+ * 
+ * {@code
+ * char [][] pairs = {{'0','9'}};
+ * char [][] pairs = {{'a','z'}};
+ * char [][] pairs = {{'a','z'},{'0','9'}};
+ * }
+ * 
+ *
+ * @param pairs array of charachters array, expected is to pass 
min, max pairs through this arg.
+ * @return {@code this}, to allow method chaining.
+ */
+public Builder withinRange(final char[] ... pairs) {
+characterList = new ArrayList();
+for (char[] pair :  pairs) {
+final int minimumCodePoint = pair[0];
+final int maximumCodePoint = pair[1];
--- End diff --

I think we should put that for better exception handling, also check of 
```minimumCodePoint  < maximumCodePoint ```, thanks



---

-
To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
For additional commands, e-mail: dev-h...@commons.apache.org



[GitHub] commons-text pull request #62: TEXT-101: Moved RandomStringUtils to Commons-...

2017-09-25 Thread chtompki
Github user chtompki commented on a diff in the pull request:

https://github.com/apache/commons-text/pull/62#discussion_r140835603
  
--- Diff: src/main/java/org/apache/commons/text/RandomStringGenerator.java 
---
@@ -324,6 +324,40 @@ public Builder withinRange(final int minimumCodePoint, 
final int maximumCodePoin
 
 /**
  * 
+ * Specifies the array of minimum and maximum char allowed in the
+ * generated string.
+ * 
+ *
+ * For example:
+ * 
+ * {@code
+ * char [][] pairs = {{'0','9'}};
+ * char [][] pairs = {{'a','z'}};
+ * char [][] pairs = {{'a','z'},{'0','9'}};
+ * }
+ * 
+ *
+ * @param pairs array of charachters array, expected is to pass 
min, max pairs through this arg.
+ * @return {@code this}, to allow method chaining.
+ */
+public Builder withinRange(final char[] ... pairs) {
+characterList = new ArrayList();
+for (char[] pair :  pairs) {
+final int minimumCodePoint = pair[0];
+final int maximumCodePoint = pair[1];
--- End diff --

Do we want validation on the definition of a `pair` here? Do we want to 
throw an `InvalidParameterException` in this fashion:
```java
for(char[] pair: pairs) {
if (pair.length != 2) {
  throw new InvalidParameterException("A char[] pair should look 
like {'', ''}");
}
}
I'm not sure. I could go either way. Thoughts?
```


---

-
To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
For additional commands, e-mail: dev-h...@commons.apache.org



[GitHub] commons-text pull request #62: TEXT-101: Moved RandomStringUtils to Commons-...

2017-09-06 Thread ameyjadiye
GitHub user ameyjadiye opened a pull request:

https://github.com/apache/commons-text/pull/62

TEXT-101: Moved RandomStringUtils to Commons-text 

Moved **RandomStringUtils** from lang to text along with changed core logic 
which is using **RandomStringGenerator** internally, Test cases are copied from 
commons-lang for making sure its working as it's working in commons-lang.

You can merge this pull request into a Git repository by running:

$ git pull https://github.com/ameyjadiye/commons-text TEXT-101

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/commons-text/pull/62.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #62


commit aebacbabaa3debae909081cbd55475f6f108d141
Author: Amey Jadiye 
Date:   2017-09-06T20:40:11Z

copied RandomStringGenerator required code from master

commit e45738f00417ac0dcae1784c7904dc6fc156ae32
Author: Amey Jadiye 
Date:   2017-09-06T20:41:51Z

TEXT-101 : Moved RandomStringUtils from lang to text with improved core 
logic

commit 00011e92477ca610a313c40ed749512e5443ffa2
Author: Amey Jadiye 
Date:   2017-09-06T20:43:33Z

added Amey's email id




---

-
To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
For additional commands, e-mail: dev-h...@commons.apache.org