Tabnine Logo
Class.getDeclaredClasses
Code IndexAdd Tabnine to your IDE (free)

How to use
getDeclaredClasses
method
in
java.lang.Class

Best Java code snippets using java.lang.Class.getDeclaredClasses (Showing top 20 results out of 2,565)

origin: spring-projects/spring-loaded

public static Class[] callGetDeclaredClasses(Class thiz)
throws SecurityException
{
  return thiz.getDeclaredClasses();
}
origin: spring-projects/spring-framework

@Override
public String[] getMemberClassNames() {
  LinkedHashSet<String> memberClassNames = new LinkedHashSet<>(4);
  for (Class<?> nestedClass : this.introspectedClass.getDeclaredClasses()) {
    memberClassNames.add(nestedClass.getName());
  }
  return StringUtils.toStringArray(memberClassNames);
}
origin: neo4j/neo4j

public static Collection<Status> all()
{
  Collection<Status> result = new ArrayList<>();
  for ( Class<?> child : Status.class.getDeclaredClasses() )
  {
    if ( child.isEnum() && Status.class.isAssignableFrom( child ) )
    {
      @SuppressWarnings( "unchecked" )
      Class<? extends Status> statusType = (Class<? extends Status>) child;
      Collections.addAll( result, statusType.getEnumConstants() );
    }
  }
  return result;
}
origin: redisson/redisson

/**
 * {@inheritDoc}
 */
public TypeList getDeclaredTypes() {
  return new TypeList.ForLoadedTypes(type.getDeclaredClasses());
}
origin: google/error-prone

/** Reflectively instantiate the package-private {@code MethodResolutionPhase} enum. */
private static Object newMethodResolutionPhase(boolean autoboxing) {
 for (Class<?> c : Resolve.class.getDeclaredClasses()) {
  if (!c.getName().equals("com.sun.tools.javac.comp.Resolve$MethodResolutionPhase")) {
   continue;
  }
  for (Object e : c.getEnumConstants()) {
   if (e.toString().equals(autoboxing ? "BOX" : "BASIC")) {
    return e;
   }
  }
 }
 return null;
}
origin: org.springframework/spring-core

@Override
public String[] getMemberClassNames() {
  LinkedHashSet<String> memberClassNames = new LinkedHashSet<>(4);
  for (Class<?> nestedClass : this.introspectedClass.getDeclaredClasses()) {
    memberClassNames.add(nestedClass.getName());
  }
  return StringUtils.toStringArray(memberClassNames);
}
origin: spring-projects/spring-framework

for (Class<?> candidate : declaringClass.getDeclaredClasses()) {
  if (isDefaultConfigurationClassCandidate(candidate)) {
    configClasses.add(candidate);
origin: go-lang-plugin-org/go-lang-idea-plugin

 @NotNull
 private static Type getResultType(@NotNull String method) {
  for (Class<?> c : DlvRequest.class.getDeclaredClasses()) {
   if (method.equals(c.getSimpleName())) {
    Type s = c.getGenericSuperclass();
    assert s instanceof ParameterizedType : c.getCanonicalName() + " should have a generic parameter for correct callback processing";
    Type[] arguments = ((ParameterizedType)s).getActualTypeArguments();
    assert arguments.length == 1 : c.getCanonicalName() + " should have only one generic argument for correct callback processing";
    return arguments[0];
   }
  }
  CommandProcessorKt.getLOG().error("Unknown response " + method + ", please register an appropriate request into com.goide.dlv.protocol.DlvRequest");
  return Object.class;
 }
}
origin: google/guava

 public void testFinalizeClassHasNoNestedClasses() throws Exception {
  // Ensure that the Finalizer class has no nested classes.
  // See https://code.google.com/p/guava-libraries/issues/detail?id=1505
  assertEquals(Collections.emptyList(), Arrays.asList(Finalizer.class.getDeclaredClasses()));
 }
}
origin: spring-projects/spring-framework

Class<?> sourceClass = (Class<?>) sourceToProcess;
try {
  Class<?>[] declaredClasses = sourceClass.getDeclaredClasses();
  List<SourceClass> members = new ArrayList<>(declaredClasses.length);
  for (Class<?> declaredClass : declaredClasses) {
origin: apache/ignite

/**
 * Get inner class by its name from the enclosing class.
 *
 * @param parentCls Parent class to resolve inner class for.
 * @param innerClsName Name of the inner class.
 * @return Inner class.
 */
@Nullable public static <T> Class<T> getInnerClass(Class<?> parentCls, String innerClsName) {
  for (Class<?> cls : parentCls.getDeclaredClasses())
    if (innerClsName.equals(cls.getSimpleName()))
      return (Class<T>)cls;
  return null;
}
origin: neo4j/neo4j

@BeforeClass
public static void collectAllDifferentInconsistencyTypes()
{
  Class<?> reportClass = ConsistencyReport.class;
  for ( Class<?> cls : reportClass.getDeclaredClasses() )
  {
    for ( Method method : cls.getDeclaredMethods() )
    {
      if ( method.getAnnotation( Documented.class ) != null )
      {
        Set<String> types = allReports.computeIfAbsent( cls, k -> new HashSet<>() );
        types.add( method.getName() );
      }
    }
  }
}
origin: apache/hive

private final static void setEnv(Map<String, String> newenv) throws Exception {
 Class[] classes = Collections.class.getDeclaredClasses();
 Map<String, String> env = System.getenv();
 for (Class cl : classes) {
  if ("java.util.Collections$UnmodifiableMap".equals(cl.getName())) {
   Field field = cl.getDeclaredField("m");
   field.setAccessible(true);
   Object obj = field.get(env);
   Map<String, String> map = (Map<String, String>) obj;
   map.clear();
   map.putAll(newenv);
  }
 }
}
origin: apache/hive

private final static void setEnv(Map<String, String> newenv) throws Exception {
 Class[] classes = Collections.class.getDeclaredClasses();
 Map<String, String> env = System.getenv();
 for (Class cl : classes) {
  if ("java.util.Collections$UnmodifiableMap".equals(cl.getName())) {
   Field field = cl.getDeclaredField("m");
   field.setAccessible(true);
   Object obj = field.get(env);
   Map<String, String> map = (Map<String, String>) obj;
   map.clear();
   map.putAll(newenv);
  }
 }
}
origin: spring-projects/spring-framework

@SuppressWarnings("unchecked")
public static Map<String, String> getModifiableSystemEnvironment() {
  Class<?>[] classes = Collections.class.getDeclaredClasses();
  Map<String, String> env = System.getenv();
  for (Class<?> cl : classes) {
origin: google/guava

public static <E extends Enum<?> & Feature<?>> void assertGoodFeatureEnum(
  Class<E> featureEnumClass) {
 final Class<?>[] classes = featureEnumClass.getDeclaredClasses();
 for (Class<?> containedClass : classes) {
  if (containedClass.getSimpleName().equals("Require")) {
   if (containedClass.isAnnotation()) {
    assertGoodTesterAnnotation(asAnnotation(containedClass));
   } else {
    fail(
      rootLocaleFormat(
        "Feature enum %s contains a class named "
          + "'Require' but it is not an annotation.",
        featureEnumClass));
   }
   return;
  }
 }
 fail(
   rootLocaleFormat(
     "Feature enum %s should contain an " + "annotation named 'Require'.",
     featureEnumClass));
}
origin: udacity/ud851-Exercises

@Test
public void inner_class_exists() throws Exception {
  Class[] innerClasses = WaitlistContract.class.getDeclaredClasses();
  assertEquals("There should be 1 Inner class inside the contract class", 1, innerClasses.length);
}
origin: udacity/ud851-Exercises

@Test
public void inner_class_type_correct() throws Exception {
  Class[] innerClasses = WaitlistContract.class.getDeclaredClasses();
  assertEquals("Cannot find inner class to complete unit test", 1, innerClasses.length);
  Class entryClass = innerClasses[0];
  assertTrue("Inner class should implement the BaseColumns interface", BaseColumns.class.isAssignableFrom(entryClass));
  assertTrue("Inner class should be final", Modifier.isFinal(entryClass.getModifiers()));
  assertTrue("Inner class should be static", Modifier.isStatic(entryClass.getModifiers()));
}
origin: udacity/ud851-Exercises

@Test
public void inner_class_type_correct() throws Exception {
  Class[] innerClasses = WaitlistContract.class.getDeclaredClasses();
  assertEquals("Cannot find inner class to complete unit test", 1, innerClasses.length);
  Class entryClass = innerClasses[0];
  assertTrue("Inner class should implement the BaseColumns interface", BaseColumns.class.isAssignableFrom(entryClass));
  assertTrue("Inner class should be final", Modifier.isFinal(entryClass.getModifiers()));
  assertTrue("Inner class should be static", Modifier.isStatic(entryClass.getModifiers()));
}
origin: udacity/ud851-Exercises

@Test
public void inner_class_type_correct() throws Exception {
  Class[] innerClasses = WaitlistContract.class.getDeclaredClasses();
  assertEquals("Cannot find inner class to complete unit test", 1, innerClasses.length);
  Class entryClass = innerClasses[0];
  assertTrue("Inner class should implement the BaseColumns interface", BaseColumns.class.isAssignableFrom(entryClass));
  assertTrue("Inner class should be final", Modifier.isFinal(entryClass.getModifiers()));
  assertTrue("Inner class should be static", Modifier.isStatic(entryClass.getModifiers()));
}
java.langClassgetDeclaredClasses

Javadoc

Returns an array containing Class objects for all classes and interfaces that are declared as members of the class which this 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.

Popular methods of Class

  • getName
    Returns the name of the class represented by this Class. For a description of the format which is us
  • getSimpleName
  • getClassLoader
  • isAssignableFrom
    Determines if the class or interface represented by this Class object is either the same as, or is a
  • forName
    Returns the Class object associated with the class or interface with the given string name, using th
  • newInstance
    Returns a new instance of the class represented by this Class, created by invoking the default (that
  • getMethod
    Returns a Method object that reflects the specified public member method of the class or interface r
  • getResourceAsStream
  • getSuperclass
    Returns the Class representing the superclass of the entity (class, interface, primitive type or voi
  • getConstructor
  • cast
    Casts an object to the class or interface represented by this Class object.
  • isInstance
  • cast,
  • isInstance,
  • getCanonicalName,
  • getDeclaredField,
  • isArray,
  • getAnnotation,
  • getDeclaredFields,
  • getResource,
  • getDeclaredMethod,
  • getMethods

Popular in Java

  • Parsing JSON documents to java classes using gson
  • setRequestProperty (URLConnection)
  • setScale (BigDecimal)
  • getResourceAsStream (ClassLoader)
  • BufferedWriter (java.io)
    Wraps an existing Writer and buffers the output. Expensive interaction with the underlying reader is
  • Connection (java.sql)
    A connection represents a link from a Java application to a database. All SQL statements and results
  • Collection (java.util)
    Collection is the root of the collection hierarchy. It defines operations on data collections and t
  • BlockingQueue (java.util.concurrent)
    A java.util.Queue that additionally supports operations that wait for the queue to become non-empty
  • TimeUnit (java.util.concurrent)
    A TimeUnit represents time durations at a given unit of granularity and provides utility methods to
  • Collectors (java.util.stream)
  • Top Vim plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now