@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2014 the original author or authors.
|
||||
* Copyright 2002-2017 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -61,19 +61,18 @@ public interface ClassMetadata {
|
||||
boolean isFinal();
|
||||
|
||||
/**
|
||||
* Determine whether the underlying class is independent,
|
||||
* i.e. whether it is a top-level class or a nested class
|
||||
* (static inner class) that can be constructed independent
|
||||
* from an enclosing class.
|
||||
* Determine whether the underlying class is independent, i.e. whether
|
||||
* it is a top-level class or a nested class (static inner class) that
|
||||
* can be constructed independently from an enclosing class.
|
||||
*/
|
||||
boolean isIndependent();
|
||||
|
||||
/**
|
||||
* Return whether the underlying class has an enclosing class
|
||||
* (i.e. the underlying class is an inner/nested class or
|
||||
* a local class within a method).
|
||||
* <p>If this method returns {@code false}, then the
|
||||
* underlying class is a top-level class.
|
||||
* Return whether the underlying class is declared within an enclosing
|
||||
* class (i.e. the underlying class is an inner/nested class or a
|
||||
* local class within a method).
|
||||
* <p>If this method returns {@code false}, then the underlying
|
||||
* class is a top-level class.
|
||||
*/
|
||||
boolean hasEnclosingClass();
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2014 the original author or authors.
|
||||
* Copyright 2002-2017 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -20,6 +20,7 @@ import java.lang.reflect.Modifier;
|
||||
import java.util.LinkedHashSet;
|
||||
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
/**
|
||||
* {@link ClassMetadata} implementation that uses standard reflection
|
||||
@@ -121,11 +122,11 @@ public class StandardClassMetadata implements ClassMetadata {
|
||||
|
||||
@Override
|
||||
public String[] getMemberClassNames() {
|
||||
LinkedHashSet<String> memberClassNames = new LinkedHashSet<String>();
|
||||
LinkedHashSet<String> memberClassNames = new LinkedHashSet<String>(4);
|
||||
for (Class<?> nestedClass : this.introspectedClass.getDeclaredClasses()) {
|
||||
memberClassNames.add(nestedClass.getName());
|
||||
}
|
||||
return memberClassNames.toArray(new String[memberClassNames.size()]);
|
||||
return StringUtils.toStringArray(memberClassNames);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2014 the original author or authors.
|
||||
* Copyright 2002-2017 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -28,6 +28,7 @@ import org.springframework.asm.Opcodes;
|
||||
import org.springframework.asm.SpringAsmInfo;
|
||||
import org.springframework.core.type.ClassMetadata;
|
||||
import org.springframework.util.ClassUtils;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
/**
|
||||
* ASM class visitor which looks only for the class name and implemented types,
|
||||
@@ -61,7 +62,7 @@ class ClassMetadataReadingVisitor extends ClassVisitor implements ClassMetadata
|
||||
|
||||
private String[] interfaces;
|
||||
|
||||
private Set<String> memberClassNames = new LinkedHashSet<String>();
|
||||
private Set<String> memberClassNames = new LinkedHashSet<String>(4);
|
||||
|
||||
|
||||
public ClassMetadataReadingVisitor() {
|
||||
@@ -201,7 +202,7 @@ class ClassMetadataReadingVisitor extends ClassVisitor implements ClassMetadata
|
||||
|
||||
@Override
|
||||
public String[] getMemberClassNames() {
|
||||
return this.memberClassNames.toArray(new String[this.memberClassNames.size()]);
|
||||
return StringUtils.toStringArray(this.memberClassNames);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user