Rob Spoor

+ Follow
since Oct 27, 2005
Rob likes ...
Chrome Eclipse IDE Java Spring Ubuntu VI Editor Windows
Forum Moderator
Rob Spoor currently moderates these forums:
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads

Recent posts by Rob Spoor

11.0.4 has also been released, if you want to stick with LTS versions. So has 8u221.
3 days ago
I don't know, you would have to try both and measure how they perform. That doesn't mean run the code once; for proper measurements you need to have your code run several thousands of times. JMH can help with that.
6 days ago

Nesamani Raman wrote:Thanks for your kind reply, Rob.

I wanted to know if I have multiple patterns to be excluded, how to approach it?

Should I first combine all the exclusion patterns using "|" and then use or is there an efficient/simpler way? I am not sure if I my approach is correct. Please guide.

You could use (?!s2|s3|s4)s1, or you could use (?!s2)(?!s3)(?!s4)s1. They both do the same, but performance may become a factor.

@Fred: with constant strings concatenated you can get the same readability. For instance:
1 week ago

Nesamani Raman wrote:Hey Knute, many thanks for your reply.

@Rob, what are the other ways in which I can accomplish the exclusion of a pattern?

Why do you need other ways? If any are possible, they will be too complex and not be readable.
1 week ago
An exclamation mark doesn't mean negation (or anything else), except when using it in a negative lookahead or lookbehind. What Knute posted is an example of a negative lookahead. It means "at this point I don't want s2; at this point I want s1".
1 week ago

Claude Moore wrote:Technically you're right, you can serialize in Json a non-java-serializable class, for example with Gson or Jackson library.
Moreover, in Java  you got serialization for (near) free, so that many times declaring an Object as Serializable is more an habit that a real need.

Classic Java serialization is awful, and Oracle knows it; they are working quite hard to replace it. The problem is that it doesn't easily support forward and/or backward compatibility. If you don't define an explicit serialVersionUid, every change to the class will cause a new value to be generated which will break any previously serialized data. If you do define a serialVersionUid explicitly you still can run into problems if you add or remove fields.

Arun Singh Raaj wrote:Thanks for replying.

Does @Transient annotation exclude the specific field while sending the JSON data? or it's specific to only Serialization? Does @Transient work in non-'Serializable' class?

For serializable classes you should use the transient keyword. @Transient doesn't mean anything in that context. For JSON or XML serialization it's also useless because they have their own annotations (@XmlTransient for JAXB, @JsonIgnore for Jackson, etc). For JPA, @javax.persistence.Transient does mean a field or method will not get stored in the database. There's also a java.beans.Transient which I have never used before, but its JavaDoc seems to indicate it's pretty useless unless you're using introspection.
1 week ago
You can find the out-of-the-box actuators at In this case, the mappings one seems to be what you need, but its output is quite verbose.
3 weeks ago
Download WinSCP, it's a great tool for SFTP / SCP copying.
1 month ago
If you read through my comments again, you'll notice I warned about this already (2 weeks ago), and even provided a few suggestions.
1 month ago