Package org.optaplanner.core.config.util
Class ConfigUtils
java.lang.Object
org.optaplanner.core.config.util.ConfigUtils
- 
Method SummaryModifier and TypeMethodDescriptionstatic Stringabbreviate(List<String> list) static Stringabbreviate(List<String> list, int limit) static voidapplyCustomProperties(Object bean, String beanClassPropertyName, Map<String, String> customProperties, String customPropertiesPropertyName) static intceilDivide(int dividend, int divisor) Divides and ceils the result without using floating point arithmetic.static Class<? extends Annotation>extractAnnotationClass(Member member, Class<? extends Annotation>... annotationClasses) extractCollectionGenericTypeParameterLeniently(String parentClassConcept, Class<?> parentClass, Class<?> type, Type genericType, Class<? extends Annotation> annotationClass, String memberName) static Class<?>extractCollectionGenericTypeParameterStrictly(String parentClassConcept, Class<?> parentClass, Class<?> type, Type genericType, Class<? extends Annotation> annotationClass, String memberName) static <C> MemberAccessorfindPlanningIdMemberAccessor(Class<C> clazz, MemberAccessorFactory memberAccessorFactory, DomainAccessType domainAccessType) getAllAnnotatedLineageClasses(Class<?> bottomClass, Class<? extends Annotation> annotation) getAllMembers(Class<?> baseClass, Class<? extends Annotation> annotationClass) getDeclaredMembers(Class<?> baseClass) static <Config_ extends AbstractConfig<Config_>>
 Config_inheritConfig(Config_ original, Config_ inherited) static <Config_ extends AbstractConfig<Config_>>
 List<Config_>inheritMergeableListConfig(List<Config_> originalList, List<Config_> inheritedList) static <T> List<T>inheritMergeableListProperty(List<T> originalList, List<T> inheritedList) static <K,T> Map<K, T> inheritMergeableMapProperty(Map<K, T> originalMap, Map<K, T> inheritedMap) static <T> TinheritOverwritableProperty(T original, T inherited) static booleanisEmptyCollection(Collection<?> collection) static booleanstatic <T> TmeldProperty(T a, T b) A relaxed version ofmergeProperty(Object, Object).static <T> TmergeProperty(T a, T b) static <T> TnewInstance(Object configBean, String propertyName, Class<T> clazz) Create a new instance of clazz from a config's property.static <T> TnewInstance(Supplier<String> ownerDescriptor, String propertyName, Class<T> clazz) Create a new instance of clazz from a general source.static intresolvePoolSize(String propertyName, String value, String... magicValues) 
- 
Method Details- 
newInstanceCreate a new instance of clazz from a config's property.If the instantiation fails, the simple class name of configBeanwill be used as the owner ofpropertyName.Intended usage: selectionFilter = ConfigUtils.newInstance( config, "filterClass", config.getFilterClass());- Type Parameters:
- T- the new instance type
- Parameters:
- configBean- the bean holding the- clazzto be instantiated
- propertyName-- configBean's property holding- clazz
- clazz-- Classrepresentation of the type- T
- Returns:
- new instance of clazz
 
- 
newInstancepublic static <T> T newInstance(Supplier<String> ownerDescriptor, String propertyName, Class<T> clazz) Create a new instance of clazz from a general source.If the instantiation fails, the result of ownerDescriptorwill be used to describe the owner ofpropertyName.- Type Parameters:
- T- the new instance type
- Parameters:
- ownerDescriptor- describes the owner of- propertyName
- propertyName- property holding the- clazz
- clazz-- Classrepresentation of the type- T
- Returns:
- new instance of clazz
 
- 
applyCustomProperties
- 
inheritConfigpublic static <Config_ extends AbstractConfig<Config_>> Config_ inheritConfig(Config_ original, Config_ inherited) 
- 
inheritMergeableListConfigpublic static <Config_ extends AbstractConfig<Config_>> List<Config_> inheritMergeableListConfig(List<Config_> originalList, List<Config_> inheritedList) 
- 
inheritOverwritablePropertypublic static <T> T inheritOverwritableProperty(T original, T inherited) 
- 
inheritMergeableListProperty
- 
inheritMergeableMapProperty
- 
mergePropertypublic static <T> T mergeProperty(T a, T b) 
- 
meldPropertypublic static <T> T meldProperty(T a, T b) A relaxed version ofmergeProperty(Object, Object). Used primarily for merging failed benchmarks, where a property remains the same over benchmark runs (for example: dataset problem size), but the property in the failed benchmark isn't initialized, therefore null. When merging, we can still use the correctly initialized property of the benchmark that didn't fail.Null-handling: - if both properties are null, returns null
- if only one of the properties is not null, returns that property
- if both properties are not null, returns
 mergeProperty(Object, Object)
 - Type Parameters:
- T- the type of property- aand- b
- Parameters:
- a- property- a
- b- property- b
- Returns:
- sometimes null
- See Also:
 
- 
isEmptyCollection
- 
ceilDividepublic static int ceilDivide(int dividend, int divisor) Divides and ceils the result without using floating point arithmetic. For floor division, seeMath.floorDiv(long, long).- Parameters:
- dividend- the dividend
- divisor- the divisor
- Returns:
- dividend / divisor, ceiled
- Throws:
- ArithmeticException- if- divisor == 0
 
- 
resolvePoolSize
- 
getAllAnnotatedLineageClassespublic static List<Class<?>> getAllAnnotatedLineageClasses(Class<?> bottomClass, Class<? extends Annotation> annotation) 
- 
getDeclaredMembers- Parameters:
- baseClass- never null
- Returns:
- never null, sorted by type (fields before methods), then by AlphabeticMemberComparator.
 
- 
getAllMemberspublic static List<Member> getAllMembers(Class<?> baseClass, Class<? extends Annotation> annotationClass) - Parameters:
- baseClass- never null
- annotationClass- never null
- Returns:
- never null, sorted by type (fields before methods), then by AlphabeticMemberComparator.
 
- 
extractAnnotationClass@SafeVarargs public static Class<? extends Annotation> extractAnnotationClass(Member member, Class<? extends Annotation>... annotationClasses) 
- 
extractCollectionGenericTypeParameterStrictly
- 
extractCollectionGenericTypeParameterLeniently
- 
findPlanningIdMemberAccessorpublic static <C> MemberAccessor findPlanningIdMemberAccessor(Class<C> clazz, MemberAccessorFactory memberAccessorFactory, DomainAccessType domainAccessType) 
- 
abbreviate
- 
abbreviate
- 
isNativeImagepublic static boolean isNativeImage()
 
-