I need to ensure that all String attributes of immutable objects (guava Immutables) have no leading and trailing white spaces. Immutable objects are created to represent RESTful API requests. I would like to do better than reject the request when the String attributes contain leading and/or trailing white spaces in the @Value.check method using Precondition.checks. I want to remove the white spaces in the incoming request's String fields when creating the Immutable objects. If that is not possible to do by appropriately styling the Builder (I believe that today this is not possible), then is it possible to re-set the values in the value.check method or by some other means?
--
guava-...@googlegroups.com
Project site: https://github.com/google/guava
This group: http://groups.google.com/group/guava-discuss
This list is for general discussion.
To report an issue: https://github.com/google/guava/issues/new
To get help: http://stackoverflow.com/questions/ask?tags=guava
---
You received this message because you are subscribed to the Google Groups "guava-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to guava-discus...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/guava-discuss/4f8245ca-b1e3-484e-8d45-b1565de6466f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
I need to ensure that all String attributes of immutable objects (guava Immutables) have no leading and trailing white spaces. Immutable objects are created to represent RESTful API requests. I would like to do better than reject the request when the String attributes contain leading and/or trailing white spaces in the @Value.check method using Precondition.checks. I want to remove the white spaces in the incoming request's String fields when creating the Immutable objects. If that is not possible to do by appropriately styling the Builder (I believe that today this is not possible), then is it possible to re-set the values in the value.check method or by some other means?
--
guava-...@googlegroups.com
Project site: https://github.com/google/guava
This group: http://groups.google.com/group/guava-discuss
This list is for general discussion.
To report an issue: https://github.com/google/guava/issues/new
To get help: http://stackoverflow.com/questions/ask?tags=guava
---
You received this message because you are subscribed to the Google Groups "guava-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to guava-discuss+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/guava-discuss/4f8245ca-b1e3-484e-8d45-b1565de6466f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
If you'e pulling the Strings out of some request object and building an immutable data structure from them, can't you trim each of them in the process? Similarly, if untrimmed Strings are valid input, shouldn't your validator just accept them as is?
On Wed, Jun 7, 2017 at 1:54 PM, Gautam Priya <gautam...@gmail.com> wrote:
I need to ensure that all String attributes of immutable objects (guava Immutables) have no leading and trailing white spaces. Immutable objects are created to represent RESTful API requests. I would like to do better than reject the request when the String attributes contain leading and/or trailing white spaces in the @Value.check method using Precondition.checks. I want to remove the white spaces in the incoming request's String fields when creating the Immutable objects. If that is not possible to do by appropriately styling the Builder (I believe that today this is not possible), then is it possible to re-set the values in the value.check method or by some other means?--
guava-...@googlegroups.com
Project site: https://github.com/google/guava
This group: http://groups.google.com/group/guava-discuss
This list is for general discussion.
To report an issue: https://github.com/google/guava/issues/new
To get help: http://stackoverflow.com/questions/ask?tags=guava
---
You received this message because you are subscribed to the Google Groups "guava-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to guava-discus...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/guava-discuss/4f8245ca-b1e3-484e-8d45-b1565de6466f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.