Improved: Add missing ‘static’ modifier for private methods

(OFBIZ-11098)

In order to make it clear when a method is not depending on the
internal state of an object, it is a good practice to declare it as
static.


git-svn-id: https://svn.apache.org/repos/asf/ofbiz/ofbiz-framework/trunk@1860937 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Mathieu Lirzin
2019-06-10 12:27:40 +00:00
parent 08f0b84462
commit ffe2e7ffdf
42 changed files with 162 additions and 154 deletions
@@ -91,7 +91,7 @@ public class ComponentContainer implements Container {
*
* @param componentsClassPath a list of classpaths for all components
*/
private void loadClassPathForAllComponents(List<Classpath> componentsClassPath) {
private static void loadClassPathForAllComponents(List<Classpath> componentsClassPath) {
List<URL> allComponentUrls = new ArrayList<>();
for(Classpath classPath : componentsClassPath) {
try {
@@ -256,7 +256,7 @@ public class ComponentContainer implements Container {
* @param location directory location of the component
* @return The component configuration
*/
private ComponentConfig retrieveComponentConfig(String name, String location) {
private static ComponentConfig retrieveComponentConfig(String name, String location) {
ComponentConfig config = null;
try {
config = ComponentConfig.getComponentConfig(name, location);
@@ -331,7 +331,7 @@ public class ComponentContainer implements Container {
* @return the constructed classpath
* @throws IOException
*/
private Classpath buildClasspathFromComponentConfig(ComponentConfig config) throws IOException {
private static Classpath buildClasspathFromComponentConfig(ComponentConfig config) throws IOException {
Classpath classPath = new Classpath();
String configRoot = config.getRootLocation().replace('\\', '/');
configRoot = configRoot.endsWith("/") ? configRoot : configRoot + "/";
@@ -81,7 +81,8 @@ public class ContainerLoader {
startLoadedContainers();
}
private Collection<ContainerConfig.Configuration> retrieveOfbizContainers(String configFile) throws StartupException {
private static Collection<ContainerConfig.Configuration> retrieveOfbizContainers(String configFile)
throws StartupException {
try {
return ContainerConfig.getConfigurations(configFile);
} catch (ContainerException e) {
@@ -89,7 +90,7 @@ public class ContainerLoader {
}
}
private List<ContainerConfig.Configuration> filterContainersHavingMatchingLoaders(List<String> loaders,
private static List<ContainerConfig.Configuration> filterContainersHavingMatchingLoaders(List<String> loaders,
Collection<ContainerConfig.Configuration> containerConfigs) {
return containerConfigs.stream()
.filter(containerCfg ->
@@ -99,7 +100,7 @@ public class ContainerLoader {
.collect(Collectors.toList());
}
private List<Container> loadContainersFromConfigurations(List<ContainerConfig.Configuration> containerConfigs,
private static List<Container> loadContainersFromConfigurations(List<ContainerConfig.Configuration> containerConfigs,
Config config, List<StartupCommand> ofbizCommands) throws StartupException {
List<Container> loadContainers = new ArrayList<>();
@@ -112,8 +113,7 @@ public class ContainerLoader {
return loadContainers;
}
private Container loadContainer(String configFile,
ContainerConfig.Configuration containerCfg,
private static Container loadContainer(String configFile, ContainerConfig.Configuration containerCfg,
List<StartupCommand> ofbizCommands) throws StartupException {
// load the container class
ClassLoader loader = Thread.currentThread().getContextClassLoader();
@@ -196,7 +196,7 @@ public class UtilCache<K, V> implements Serializable, EvictionListener<Object, C
}
}
private Object fromKey(Object key) {
private static Object fromKey(Object key) {
return key == null ? ObjectType.NULL : key;
}
@@ -137,7 +137,7 @@ public class NodeELResolver extends ELResolver {
}
}
private final boolean isResolvable(Object base) {
private final static boolean isResolvable(Object base) {
return base != null && (base instanceof Node || base instanceof NodeImpl);
}
@@ -267,7 +267,7 @@ public class FlexibleStringExpanderTests extends TestCase {
everythingTest();
}
private void everythingTest() {
private static void everythingTest() {
Map<String, Object> testMap = new HashMap<>();
testMap.put("date", new java.util.Date(1234567890));
testMap.put("usd", "USD");