Precompile pattern for checking of classes in javax package in ReflectUtils

Signed-off-by: dreis2211 <christoph.dreis@freenet.de>
This commit is contained in:
Christoph Dreis 2016-10-14 01:05:13 +02:00 committed by dreis2211
parent 3ad72f8a44
commit 82a6eff20c
1 changed files with 5 additions and 1 deletions

View File

@ -24,9 +24,13 @@ import java.lang.reflect.Modifier;
import java.lang.reflect.ParameterizedType;
import java.lang.reflect.Type;
import java.lang.reflect.TypeVariable;
import java.util.regex.Pattern;
public class ReflectUtils
{
private static final Pattern JAVAX_CLASSNAME_PATTERN = Pattern.compile("^javax*\\..*");
private static class GenericRef
{
// The base class reference lookup started from
@ -236,7 +240,7 @@ public class ReflectUtils
Class<?> clazz = (Class<?>)type;
// prevent spinning off into Serialization and other parts of the
// standard tree that we could care less about
if (clazz.getName().matches("^javax*\\..*"))
if (JAVAX_CLASSNAME_PATTERN.matcher(clazz.getName()).matches())
{
return false;
}