/** * @param propertyClass * * @return * * @throws JPServiceException */ private static synchronized AbstractJavaProperty initProperty(Class<? extends AbstractJavaProperty> propertyClass) throws JPServiceException { try { // Avoid double initialization if (initializedProperties.containsKey(propertyClass)) { throw new JPServiceException("Already initialized!"); } if (!registeredPropertyClasses.contains(propertyClass)) { registeredPropertyClasses.add(propertyClass); } AbstractJavaProperty newInstance = propertyClass.newInstance(); initializedProperties.put(propertyClass, newInstance); // init load dependencies. for (Class<? extends AbstractJavaProperty> dependentPropertyClass : (List<Class<? extends AbstractJavaProperty>>) newInstance.getDependencyList()) { if (!initializedProperties.containsKey(dependentPropertyClass)) { initProperty(dependentPropertyClass); } } return newInstance; } catch (JPServiceException | InstantiationException | IllegalAccessException ex) { throw new JPInitializationException("Could not init " + propertyClass.getSimpleName(), ex); } }