mirror of
https://github.com/pgpainless/pgpainless.git
synced 2024-11-26 22:32:07 +01:00
ProviderFactory: Avoid accessing subclass in parent class initialization
This commit is contained in:
parent
adc69caa51
commit
672acd38d0
1 changed files with 10 additions and 3 deletions
|
@ -19,7 +19,7 @@ import java.security.Provider;
|
||||||
|
|
||||||
public abstract class ProviderFactory {
|
public abstract class ProviderFactory {
|
||||||
|
|
||||||
private static ProviderFactory FACTORY = new BouncyCastleProviderFactory();
|
private static ProviderFactory FACTORY;
|
||||||
|
|
||||||
protected abstract Provider _getProvider();
|
protected abstract Provider _getProvider();
|
||||||
protected abstract String _getProviderName();
|
protected abstract String _getProviderName();
|
||||||
|
@ -28,12 +28,19 @@ public abstract class ProviderFactory {
|
||||||
ProviderFactory.FACTORY = factory;
|
ProviderFactory.FACTORY = factory;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static ProviderFactory getFactory() {
|
||||||
|
if (FACTORY == null) {
|
||||||
|
FACTORY = new BouncyCastleProviderFactory();
|
||||||
|
}
|
||||||
|
return FACTORY;
|
||||||
|
}
|
||||||
|
|
||||||
public static Provider getProvider() {
|
public static Provider getProvider() {
|
||||||
return ProviderFactory.FACTORY._getProvider();
|
return ProviderFactory.getFactory()._getProvider();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String getProviderName() {
|
public static String getProviderName() {
|
||||||
return ProviderFactory.FACTORY._getProviderName();
|
return ProviderFactory.getFactory()._getProviderName();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue