Added required annotation validator
This commit is contained in:
parent
02cb20f16f
commit
c8905bfabf
|
@ -120,7 +120,7 @@ public final class BãßBȍőnLoad殭屍 {
|
|||
}
|
||||
}
|
||||
|
||||
private static Set<Class<?>> walkInterfaces(Class<?> clazz, Set<Class<?>> result) {
|
||||
public static Set<Class<?>> walkInterfaces(Class<?> clazz, Set<Class<?>> result) {
|
||||
while (clazz != null) {
|
||||
for (Class<?> next : clazz.getInterfaces()) {
|
||||
if (result.add(next)) {
|
||||
|
|
|
@ -1,12 +1,14 @@
|
|||
package love.distributedrebirth.bassboonyd;
|
||||
|
||||
import love.distributedrebirth.bassboonyd.info.BãßBȍőnAnnotationʸᴰ;
|
||||
import love.distributedrebirth.bassboonyd.info.BãßBȍőnAuthorʸᴰ;
|
||||
import love.distributedrebirth.bassboonyd.info.BãßBȍőnNameʸᴰ;
|
||||
import love.distributedrebirth.bassboonyd.info.BãßBȍőnPackageʸᴰ;
|
||||
|
||||
public interface DefaultBãßBȍőn<T, K extends BãßBȍőnCoffinStoreKeyʸᴰ> extends
|
||||
BãßBȍőn<T,K>,
|
||||
BãßBȍőnAuthorʸᴰ<T,K>,
|
||||
BãßBȍőnNameʸᴰ<T,K>,
|
||||
BãßBȍőnPackageʸᴰ<T,K> {
|
||||
BãßBȍőnAuthorʸᴰ<T,K>,
|
||||
BãßBȍőnPackageʸᴰ<T,K>,
|
||||
BãßBȍőnAnnotationʸᴰ<T,K> {
|
||||
}
|
||||
|
|
|
@ -0,0 +1,34 @@
|
|||
package love.distributedrebirth.bassboonyd.info;
|
||||
|
||||
import java.lang.annotation.Annotation;
|
||||
import java.util.LinkedHashSet;
|
||||
|
||||
import love.distributedrebirth.bassboonyd.BãßBȍőn;
|
||||
import love.distributedrebirth.bassboonyd.BãßBȍőnCoffinStoreKeyʸᴰ;
|
||||
import love.distributedrebirth.bassboonyd.BãßBȍőnLoad殭屍;
|
||||
import love.distributedrebirth.bassboonyd.BãßBȍőnꝐŕḯṿª₮ḕ;
|
||||
import love.distributedrebirth.bassboonyd.BãßBȍőnꝐŕḯṿª₮ḕInitPhaseʸᴰ;
|
||||
import love.distributedrebirth.bassboonyd.BãßBȍőnꝐŕḯṿª₮ḕInit注;
|
||||
|
||||
@BãßBȍőnAuthor注(name = "للَّٰهِilLצسُو", copyright = "©Δ∞ 仙上主天")
|
||||
@BãßBȍőnAnnotation注(optional = {BãßBȍőnPackage注.class})
|
||||
public interface BãßBȍőnAnnotationʸᴰ<T, K extends BãßBȍőnCoffinStoreKeyʸᴰ> extends BãßBȍőn<T, K> {
|
||||
|
||||
public static class Ꝑŕḯṿª₮ḕ implements BãßBȍőnꝐŕḯṿª₮ḕ {
|
||||
|
||||
@BãßBȍőnꝐŕḯṿª₮ḕInit注(phase = BãßBȍőnꝐŕḯṿª₮ḕInitPhaseʸᴰ.BOON_PRE_BOOT)
|
||||
private static void init(BãßBȍőn<?,?> boon) {
|
||||
for (Class<?> interfaceClass:BãßBȍőnLoad殭屍.walkInterfaces(boon.getClass(), new LinkedHashSet<>())) {
|
||||
BãßBȍőnAnnotation注 anno = interfaceClass.getAnnotation(BãßBȍőnAnnotation注.class);
|
||||
if (anno == null) {
|
||||
continue;
|
||||
}
|
||||
for (Class<? extends Annotation> required:anno.required()) {
|
||||
if (!boon.getClass().isAnnotationPresent(required)) {
|
||||
throw new IllegalStateException("Missing required annotation: "+required.getSimpleName()+" on: "+boon.getClass().getSimpleName());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -217,6 +217,7 @@ public class GDXAppTos4Activator implements BundleActivator {
|
|||
systemWarpShip.loadBundles(context, registratedSeas);
|
||||
} catch (BundleException e) {
|
||||
e.printStackTrace();
|
||||
systemGdxTerminal.selectScreen(GDXAppTos4BootScreen.class);
|
||||
bootScreen.bootLineError("ERROR: "+e.getMessage());
|
||||
startError = true;
|
||||
return;
|
||||
|
|
Loading…
Reference in a new issue