小编Pha*_*a K的帖子

正则表达式在输入中的任何位置找到两个字符

如何在字符串中的任何位置编写正则表达式以匹配两个给定的字符串?

例如,如果我寻找catmat,它应该匹配:

The cat slept on the mat in front of the fire.
At 5:00 pm, I found the cat scratching the wool off the mat.
Run Code Online (Sandbox Code Playgroud)

无论在这些字符串之前是什么.

regex string

46
推荐指数
5
解决办法
15万
查看次数

BeanUtils与ReflectionToStringBuilder的性能(用于Bean类)

我的Web应用程序中有大量的Java bean类,我试图找到一种简单的方法来实现toString()这些bean中的方法.该toString()方法将用于整个应用程序的日志记录,并应打印bean中所有属性的属性值对.

我正在尝试两种选择:
1.BeanUtils.describe()(Apache commons-beanutils)
2.ReflectionToStringBuilder.toString()(Apache commons-lang)

由于这是一个预计会有高流量的Web应用程序,因此实现必须是轻量级的,不应影响性能.(内存使用,处理器使用等是主要考虑因素).

我想根据上面提到的标准知道哪些更好.据我所知,反射是一项繁重的操作,但更多细节和对这两种选项的深入了解将有助于我选择最佳解决方案.

java reflection performance javabeans apache-commons-beanutils

7
推荐指数
2
解决办法
2万
查看次数