
com.github.thorbenkuck.netcom2.auto.NetCom2 Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of NetCom2-Auto Show documentation
Show all versions of NetCom2-Auto Show documentation
Annotation approach to reduce boilerplate code
The newest version!
package com.github.thorbenkuck.netcom2.auto;
import com.github.thorbenkuck.keller.datatypes.interfaces.Value;
public final class NetCom2 {
private static final Value repositoryValue = Value.emptySynchronized();
private NetCom2() {
throw new UnsupportedOperationException("Instantiation");
}
private static GeneratedRepository createRepository() {
GeneratedRepository repository = new GeneratedRepository();
repository.read();
return repository;
}
private static GeneratedRepository getRepository() {
if (repositoryValue.isEmpty()) {
synchronized (NetCom2.class) {
// Sanity check to compensate
// race-conditions
if (!repositoryValue.isEmpty()) {
return repositoryValue.get();
}
GeneratedRepository repository = createRepository();
repositoryValue.set(repository);
}
}
return repositoryValue.get();
}
public static ServerFactory launchServer() {
return new NativeServerFactory(getRepository());
}
public static ClientFactory launchClient() {
return new NativeClientFactory(getRepository());
}
public static LazyServerFactory createServer() {
return new NativeLazyServerFactory(getRepository());
}
public static LazyClientFactory createClient() {
return new NativeLazyClientFactory(getRepository());
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy