本文整理了Java中java.lang.Class.getClassCache()
方法的一些代码示例,展示了Class.getClassCache()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Class.getClassCache()
方法的具体详情如下:
包路径:java.lang.Class
类名称:Class
方法名:getClassCache
暂无
代码示例来源:origin: robovm/robovm
/**
* Returns an array containing {@code Class} objects for all public classes
* and interfaces that are members of this class. This includes public
* members inherited from super classes and interfaces. If there are no such
* class members or if this object represents a primitive type then an array
* of length 0 is returned.
*
* @return the public class members of the class represented by this object.
*/
public Class<?>[] getClasses() {
return getClassCache().getClasses(true);
}
代码示例来源:origin: robovm/robovm
/**
* Returns an array containing all the annotations of this class. If there are no annotations
* then an empty array is returned.
*
* @see #getDeclaredAnnotations()
*/
public Annotation[] getAnnotations() {
return getClassCache().getAnnotations(true);
}
代码示例来源:origin: robovm/robovm
/**
* Returns the annotations that are directly defined on the class
* represented by this {@code Class}. Annotations that are inherited are not
* included in the result. If there are no annotations at all, an empty
* array is returned.
*
* @see #getAnnotations()
*/
public Annotation[] getDeclaredAnnotations() {
return getClassCache().getDeclaredAnnotations(true);
}
代码示例来源:origin: robovm/robovm
/**
* Returns an array containing {@code Constructor} objects for all
* constructors declared in the class represented by this {@code Class}. If
* there are no constructors or if this {@code Class} represents an array
* class, a primitive type, or void then an empty array is returned.
*
* @see #getConstructors()
*/
public Constructor<?>[] getDeclaredConstructors() {
return getClassCache().getDeclaredConstructors(true);
}
代码示例来源:origin: robovm/robovm
/**
* Returns the name of the class represented by this {@code Class}. For a
* description of the format which is used, see the class definition of
* {@link Class}.
*/
public String getName() {
return getClassCache().getName();
}
代码示例来源:origin: robovm/robovm
private List<Class<?>> buildClassesList(List<Class<?>> result, Set<String> seen, boolean publicOnly) {
for (Class<?> c = clazz; c != null; c = c.getSuperclass()) {
for (Class<?> f : c.getClassCache().getDeclaredClasses(false, publicOnly)) {
String s = f.toString();
if (!seen.contains(s)) {
result.add(f);
seen.add(s);
}
}
}
return result;
}
代码示例来源:origin: robovm/robovm
/**
* Returns an array containing {@code Constructor} objects for all public
* constructors for this {@code Class}. If there
* are no public constructors or if this {@code Class} represents an array
* class, a primitive type or void then an empty array is returned.
*
* @see #getDeclaredConstructors()
*/
public Constructor<?>[] getConstructors() {
return getClassCache().getDeclaredPublicConstructors(true);
}
代码示例来源:origin: robovm/robovm
/**
* Returns an array containing {@code Method} objects for all methods
* declared in the class represented by this {@code Class}. If there are no
* methods or if this {@code Class} represents an array class, a primitive
* type or void then an empty array is returned.
*
* @see #getMethods()
*/
public Method[] getDeclaredMethods() {
return getClassCache().getDeclaredMethods(true);
}
代码示例来源:origin: robovm/robovm
/**
* Returns a {@code Field} object for the field with the given name
* which is declared in the class represented by this {@code Class}.
*
* @throws NoSuchFieldException if the requested field can not be found.
* @see #getField(String)
*/
public Field getDeclaredField(String name) throws NoSuchFieldException {
if (name == null) {
throw new NullPointerException("name == null");
}
return getClassCache().getDeclaredField(true, name);
}
代码示例来源:origin: robovm/robovm
/**
* Returns an array containing {@code Class} objects for all classes and
* interfaces that are declared as members of the class which this {@code
* Class} represents. If there are no classes or interfaces declared or if
* this class represents an array class, a primitive type or void, then an
* empty array is returned.
*/
public Class<?>[] getDeclaredClasses() {
return getClassCache().getDeclaredClasses(true);
}
代码示例来源:origin: robovm/robovm
/**
* Returns an array containing {@code Field} objects for all fields declared
* in the class represented by this {@code Class}. If there are no fields or
* if this {@code Class} represents an array class, a primitive type or void
* then an empty array is returned.
*
* @see #getFields()
*/
public Field[] getDeclaredFields() {
return getClassCache().getDeclaredFields(true);
}
代码示例来源:origin: robovm/robovm
/**
* Returns an array containing {@code Field} objects for all public fields
* for the class C represented by this {@code Class}. Fields may be declared
* in C, the interfaces it implements or in the superclasses of C. The
* elements in the returned array are in no particular order.
*
* <p>If there are no public fields or if this class represents an array class,
* a primitive type or {@code void} then an empty array is returned.
*
* @see #getDeclaredFields()
*/
public Field[] getFields() {
return getClassCache().getFields(true);
}
代码示例来源:origin: robovm/robovm
/**
* Returns a {@code Constructor} object which represents the public
* constructor matching the given parameter types.
* {@code (Class[]) null} is equivalent to the empty array.
*
* <p>See {@link #getMethod} for details of the search order.
* Use {@link #getDeclaredConstructor} if you don't want to search superclasses.
*
* @throws NoSuchMethodException
* if the constructor can not be found.
*/
@SuppressWarnings("unchecked")
public Constructor<T> getConstructor(Class<?>... parameterTypes) throws NoSuchMethodException {
return getClassCache().getConstructor(true, parameterTypes);
}
代码示例来源:origin: robovm/robovm
/**
* Returns an array containing {@code Method} objects for all public methods
* for the class C represented by this {@code Class}. Methods may be
* declared in C, the interfaces it implements or in the superclasses of C.
* The elements in the returned array are in no particular order.
*
* <p>If there are no public methods or if this {@code Class} represents a
* primitive type or {@code void} then an empty array is returned.
*
* @see #getDeclaredMethods()
*/
public Method[] getMethods() {
return getClassCache().getMethods(true);
}
代码示例来源:origin: robovm/robovm
private List<Field> buildFieldsList(List<Field> result, Set<String> seen, boolean publicOnly) {
for (Class<?> c = clazz; c != null; c = c.getSuperclass()) {
for (Field f : c.getClassCache().getDeclaredFields(false, publicOnly)) {
String s = f.toString();
if (!seen.contains(s)) {
result.add(f);
seen.add(s);
}
}
for (Class<?> intf : c.getInterfaces()) {
intf.getClassCache().buildFieldsList(result, seen, publicOnly);
}
}
return result;
}
代码示例来源:origin: robovm/robovm
/**
* Returns the annotation if it exists.
*/
private <A extends Annotation> A getDeclaredAnnotation(Class<A> annotationClass) {
if (annotationClass == null) {
throw new NullPointerException("annotationClass == null");
}
Annotation[] annos = getClassCache().getDeclaredAnnotations(false);
for (int i = annos.length-1; i >= 0; --i) {
if (annos[i].annotationType() == annotationClass) {
return (A) annos[i];
}
}
return null;
}
代码示例来源:origin: robovm/robovm
/**
* Returns a {@code Constructor} object which represents the constructor
* matching the given parameter types that is declared by the class
* represented by this {@code Class}.
* {@code (Class[]) null} is equivalent to the empty array.
*
* <p>Use {@link #getConstructor} if you want to search superclasses.
*
* @throws NoSuchMethodException
* if the requested constructor can not be found.
*/
@SuppressWarnings("unchecked")
public Constructor<T> getDeclaredConstructor(Class<?>... parameterTypes)
throws NoSuchMethodException {
return getClassCache().getDeclaredConstructor(true, parameterTypes);
}
代码示例来源:origin: robovm/robovm
/**
* Returns a {@code Field} object which represents the public field with the
* given name. This method first searches the class C represented by
* this {@code Class}, then the interfaces implemented by C and finally the
* superclasses of C.
*
* @throws NoSuchFieldException
* if the field can not be found.
* @see #getDeclaredField(String)
*/
public Field getField(String name) throws NoSuchFieldException {
if (name == null) {
throw new NullPointerException("name == null");
}
return getClassCache().getField(true, name);
}
代码示例来源:origin: robovm/robovm
/**
* Returns a {@code Method} object which represents the method matching the
* given name and parameter types that is declared by the class
* represented by this {@code Class}.
* {@code (Class[]) null} is equivalent to the empty array.
*
* <p>See {@link #getMethod} if you want to search superclasses.
*
* @throws NoSuchMethodException
* if the requested method can not be found.
* @throws NullPointerException
* if {@code name} is {@code null}.
*/
public Method getDeclaredMethod(String name, Class<?>... parameterTypes)
throws NoSuchMethodException {
return getClassCache().getDeclaredMethod(true, name, parameterTypes);
}
代码示例来源:origin: robovm/robovm
private List<Method> buildMethodsList(List<Method> result, Set<MethodHashKey> seen, boolean publicOnly) {
for (Class<?> c = clazz; c != null; c = c.getSuperclass()) {
for (Method m : c.getClassCache().getDeclaredMethods(false, publicOnly)) {
MethodHashKey key = new MethodHashKey(m);
if (!seen.contains(key)) {
result.add(m);
seen.add(key);
}
}
}
for (Class<?> c = clazz; c != null; c = c.getSuperclass()) {
for (Class<?> intf : c.getInterfaces()) {
intf.getClassCache().buildMethodsList(result, seen, publicOnly);
}
}
return result;
}
内容来源于网络,如有侵权,请联系作者删除!