summaryrefslogtreecommitdiffstats
path: root/mobile/android/annotations/src/main/java/org/mozilla/gecko/annotationProcessors/classloader/ClassWithOptions.java
blob: d1e4e6cfe0e5c1d43807e976ae01f3a8516c7cc0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */

package org.mozilla.gecko.annotationProcessors.classloader;

import org.mozilla.gecko.annotationProcessors.utils.GeneratableElementIterator;

public class ClassWithOptions {
  public final Class<?> wrappedClass;
  public final String generatedName;
  public final String ifdef;

  public ClassWithOptions(Class<?> someClass, String name, String ifdef) {
    wrappedClass = someClass;
    generatedName = name;
    this.ifdef = ifdef;
  }

  public boolean hasGenerated() {
    final GeneratableElementIterator methodIterator = new GeneratableElementIterator(this);

    if (methodIterator.hasNext()) {
      return true;
    }

    final ClassWithOptions[] innerClasses = methodIterator.getInnerClasses();
    for (ClassWithOptions innerClass : innerClasses) {
      if (innerClass.hasGenerated()) {
        return true;
      }
    }

    return false;
  }
}