Java Code Examples for org.osgl.util.E#NPE

The following examples show how to use org.osgl.util.E#NPE . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: NetworkBase.java    From actframework with Apache License 2.0 5 votes vote down vote up
public synchronized void register(int port, boolean secure, NetworkHandler client) {
    E.NPE(client);
    E.illegalArgumentIf(registry.containsKey(port), "Port %s has been registered already", port);
    registry.put(port, client);
    if (secure) {
        securePorts.add(port);
    }
    if (started) {
        if (!trySetUpClient(client, port, secure)) {
            failed.put(port, client);
        } else {
            logger.info("network client hooked on port: %s", port);
        }
    }
}
 
Example 2
Source File: UnexpectedNewInstanceException.java    From java-tool with Apache License 2.0 5 votes vote down vote up
private static Throwable triage(Exception cause) {
    E.NPE(cause);
    if (cause instanceof InvocationTargetException) {
        return ((InvocationTargetException) cause).getTargetException();
    } else {
        return cause;
    }
}
 
Example 3
Source File: LocalVariableMetaInfo.java    From actframework with Apache License 2.0 5 votes vote down vote up
public LocalVariableMetaInfo(int index, String name, String type, Label start, Label end) {
    E.NPE(name, start, end);
    this.index = index;
    this.name = name;
    this.type = type;
    this.start = start;
    this.end = end;
}
 
Example 4
Source File: AnnotatedTypeFinder.java    From actframework with Apache License 2.0 5 votes vote down vote up
protected AnnotatedTypeFinder(boolean publicOnly, boolean noAbstract, Class<? extends Annotation> annoType, $.Func2<App, String, Map<Class<? extends AppByteCodeScanner>, Set<String>>> foundHandler) {
    E.NPE(annoType);
    this.annoType = annoType;
    this.foundHandler = foundHandler;
    this.noAbstract = noAbstract;
    this.publicOnly = publicOnly;
}
 
Example 5
Source File: AppServiceRegistry.java    From actframework with Apache License 2.0 5 votes vote down vote up
synchronized void register(final AppService service) {
    E.NPE(service);
    final Class<? extends AppService> c = service.getClass();
    if (!registry.containsKey(c)) {
        registry.put(c, service);
        tryRegisterSingletonService(c, service);
    } else {
        E.illegalStateIf(isSingletonService(c), "Singleton AppService[%s] cannot be re-registered", c);
        // we know event bus will get registered twice for the `EventBus.onceBus`
        if (!(service instanceof EventBus)) {
            logger.warn("Service type[%s] already registered", service.getClass());
        }
        appendix.add(service);
    }
}
 
Example 6
Source File: F5Test.java    From java-tool with Apache License 2.0 4 votes vote down vote up
@Override
public Integer apply(String s1, String s2, String s3, String s4, String s5) throws NotAppliedException, $.Break {
    E.NPE(s1, s2, s3, s4, s5);
    return (s1 + s2 + s3 + s4 + s5).hashCode();
}
 
Example 7
Source File: GeneralAnnoInfo.java    From actframework with Apache License 2.0 4 votes vote down vote up
public GeneralAnnoInfo(Type type) {
    E.NPE(type);
    this.type = type;
}
 
Example 8
Source File: UnexpectedMethodInvocationException.java    From java-tool with Apache License 2.0 4 votes vote down vote up
public static RuntimeException triage(Exception exception) {
    E.NPE(exception);
    Throwable cause = (exception instanceof InvocationTargetException) ?
            ((InvocationTargetException) exception).getTargetException() : exception;
    return cause instanceof RuntimeException ? (RuntimeException) cause : new UnexpectedMethodInvocationException(cause);
}
 
Example 9
Source File: ClassNode.java    From actframework with Apache License 2.0 4 votes vote down vote up
ClassNode(String name, String canonicalName, ClassInfoRepository infoBase) {
    E.NPE(name, infoBase);
    this.name = name;
    this.canonicalName = canonicalName;
    this.infoBase = infoBase;
}
 
Example 10
Source File: ClassDetector.java    From actframework with Apache License 2.0 4 votes vote down vote up
FilteredClassDetector(ClassFilter filter) {
    E.NPE(filter);
    this.filter = filter;
}
 
Example 11
Source File: DbService.java    From actframework with Apache License 2.0 4 votes vote down vote up
/**
 * Construct a `DbService` with service ID and the current application
 * @param id the service ID
 * @param app the current application
 */
public DbService(String id, App app) {
    super(app);
    E.NPE(id);
    this.id = id;
}
 
Example 12
Source File: RequestImplBase.java    From actframework with Apache License 2.0 4 votes vote down vote up
protected RequestImplBase(AppConfig config) {
    E.NPE(config);
    cfg = config;
}
 
Example 13
Source File: GeneralAnnoInfo.java    From actframework with Apache License 2.0 4 votes vote down vote up
public Visitor(AnnotationVisitor av, GeneralAnnoInfo anno) {
    super(ASM5, av);
    E.NPE(anno);
    this.anno = anno;
}
 
Example 14
Source File: NamedPort.java    From actframework with Apache License 2.0 4 votes vote down vote up
public NamedPort(String name, int port) {
    E.NPE(name);
    E.illegalArgumentIf(port < 0);
    this.name = name;
    this.port = port;
}
 
Example 15
Source File: AppClassInfoRepository.java    From actframework with Apache License 2.0 4 votes vote down vote up
public AppClassInfoRepository(App app, ClassInfoRepository actRepository) {
    E.NPE(app);
    this.app = app;
    classes.putAll(actRepository.classes());
}
 
Example 16
Source File: SourceInfoImpl.java    From actframework with Apache License 2.0 4 votes vote down vote up
public SourceInfoImpl(Source source, int line, int column) {
    E.NPE(source);
    this.source = source;
    this.line = line;
    this.column = column;
}
 
Example 17
Source File: AsmType.java    From actframework with Apache License 2.0 4 votes vote down vote up
public AsmType(Class<T> cls) {
    E.NPE(cls);
    this.cls = cls;
    this.type = Type.getType(cls);
}
 
Example 18
Source File: MailService.java    From actframework with Apache License 2.0 4 votes vote down vote up
public MailService(String id, App app) {
    super(app);
    E.NPE(id);
    this.id = id;
}
 
Example 19
Source File: ComparatorTest.java    From java-tool with Apache License 2.0 4 votes vote down vote up
public Foo(int _1, String _2) {
    super(_1, _2);
    E.NPE(_2);
}
 
Example 20
Source File: F4Test.java    From java-tool with Apache License 2.0 4 votes vote down vote up
@Override
public Integer apply(String s1, String s2, String s3, String s4) throws NotAppliedException, $.Break {
    E.NPE(s1, s2, s3, s4);
    return (s1 + s2 + s3 + s4).hashCode();
}