diff --git a/src/main/java/ch/jalu/configme/SettingsManagerBuilder.java b/src/main/java/ch/jalu/configme/SettingsManagerBuilder.java index f6db6549..8c484967 100644 --- a/src/main/java/ch/jalu/configme/SettingsManagerBuilder.java +++ b/src/main/java/ch/jalu/configme/SettingsManagerBuilder.java @@ -55,7 +55,8 @@ private SettingsManagerBuilder(@NotNull PropertyResource resource) { * @param resourceOptions the resource options * @return settings manager builder */ - public static @NotNull SettingsManagerBuilder withYamlFile(@NotNull Path path, @NotNull YamlFileResourceOptions resourceOptions) { + public static @NotNull SettingsManagerBuilder withYamlFile(@NotNull Path path, + @NotNull YamlFileResourceOptions resourceOptions) { Utils.createFileIfNotExists(path); return new SettingsManagerBuilder(new YamlFileResource(path, resourceOptions)); } @@ -67,7 +68,8 @@ private SettingsManagerBuilder(@NotNull PropertyResource resource) { * @param resourceOptions the resource options * @return settings manager builder */ - public static @NotNull SettingsManagerBuilder withYamlFile(@NotNull File file, @NotNull YamlFileResourceOptions resourceOptions) { + public static @NotNull SettingsManagerBuilder withYamlFile(@NotNull File file, + @NotNull YamlFileResourceOptions resourceOptions) { return withYamlFile(file.toPath(), resourceOptions); } @@ -88,7 +90,8 @@ private SettingsManagerBuilder(@NotNull PropertyResource resource) { * @return this builder */ @SafeVarargs - public final @NotNull SettingsManagerBuilder configurationData(@NotNull Class... classes) { + public final @NotNull SettingsManagerBuilder configurationData( + @NotNull Class... classes) { this.configurationData = ConfigurationDataBuilder.createConfiguration(classes); return this; } diff --git a/src/main/java/ch/jalu/configme/beanmapper/ConfigMeMapperException.java b/src/main/java/ch/jalu/configme/beanmapper/ConfigMeMapperException.java index 250522f4..b86db2b0 100644 --- a/src/main/java/ch/jalu/configme/beanmapper/ConfigMeMapperException.java +++ b/src/main/java/ch/jalu/configme/beanmapper/ConfigMeMapperException.java @@ -47,7 +47,8 @@ public ConfigMeMapperException(@NotNull MappingContext mappingContext, @NotNull * @param message basic message to extend * @param cause the cause */ - public ConfigMeMapperException(@NotNull MappingContext mappingContext, @NotNull String message, @Nullable Throwable cause) { + public ConfigMeMapperException(@NotNull MappingContext mappingContext, @NotNull String message, + @Nullable Throwable cause) { super(constructMessage(mappingContext, message), cause); } diff --git a/src/main/java/ch/jalu/configme/beanmapper/Mapper.java b/src/main/java/ch/jalu/configme/beanmapper/Mapper.java index 6825cfab..3fe76b07 100644 --- a/src/main/java/ch/jalu/configme/beanmapper/Mapper.java +++ b/src/main/java/ch/jalu/configme/beanmapper/Mapper.java @@ -21,7 +21,8 @@ public interface Mapper { * @param errorRecorder error recorder to register errors even if a valid value is returned * @return object of the given type, or null if not possible */ - @Nullable Object convertToBean(@Nullable Object value, @NotNull TypeInformation typeInformation, @NotNull ConvertErrorRecorder errorRecorder); + @Nullable Object convertToBean(@Nullable Object value, @NotNull TypeInformation typeInformation, + @NotNull ConvertErrorRecorder errorRecorder); /** * Converts the given value to an object of the given class, if possible. Returns null otherwise. @@ -36,7 +37,8 @@ public interface Mapper { */ @Nullable @SuppressWarnings("unchecked") - default T convertToBean(@Nullable Object value, @NotNull Class clazz, @NotNull ConvertErrorRecorder errorRecorder) { + default T convertToBean(@Nullable Object value, @NotNull Class clazz, + @NotNull ConvertErrorRecorder errorRecorder) { return (T) convertToBean(value, new TypeInformation(clazz), errorRecorder); } diff --git a/src/main/java/ch/jalu/configme/beanmapper/MapperImpl.java b/src/main/java/ch/jalu/configme/beanmapper/MapperImpl.java index d52f899f..e111f6e6 100644 --- a/src/main/java/ch/jalu/configme/beanmapper/MapperImpl.java +++ b/src/main/java/ch/jalu/configme/beanmapper/MapperImpl.java @@ -64,7 +64,8 @@ public MapperImpl() { this(new BeanDescriptionFactoryImpl(), StandardLeafValueHandlers.getDefaultLeafValueHandler()); } - public MapperImpl(@NotNull BeanDescriptionFactory beanDescriptionFactory, @NotNull LeafValueHandler leafValueHandler) { + public MapperImpl(@NotNull BeanDescriptionFactory beanDescriptionFactory, + @NotNull LeafValueHandler leafValueHandler) { this.beanDescriptionFactory = beanDescriptionFactory; this.leafValueHandler = leafValueHandler; } @@ -77,7 +78,8 @@ public MapperImpl(@NotNull BeanDescriptionFactory beanDescriptionFactory, @NotNu return leafValueHandler; } - protected @NotNull MappingContext createRootMappingContext(@NotNull TypeInformation beanType, @NotNull ConvertErrorRecorder errorRecorder) { + protected @NotNull MappingContext createRootMappingContext(@NotNull TypeInformation beanType, + @NotNull ConvertErrorRecorder errorRecorder) { return MappingContextImpl.createRoot(beanType, errorRecorder); } @@ -151,7 +153,8 @@ public MapperImpl(@NotNull BeanDescriptionFactory beanDescriptionFactory, @NotNu // --------- @Override - public @Nullable Object convertToBean(@Nullable Object value, @NotNull TypeInformation beanType, @NotNull ConvertErrorRecorder errorRecorder) { + public @Nullable Object convertToBean(@Nullable Object value, @NotNull TypeInformation beanType, + @NotNull ConvertErrorRecorder errorRecorder) { if (value == null) { return null; } diff --git a/src/main/java/ch/jalu/configme/beanmapper/MappingContextImpl.java b/src/main/java/ch/jalu/configme/beanmapper/MappingContextImpl.java index 5655ad62..6f62135e 100644 --- a/src/main/java/ch/jalu/configme/beanmapper/MappingContextImpl.java +++ b/src/main/java/ch/jalu/configme/beanmapper/MappingContextImpl.java @@ -13,7 +13,8 @@ public class MappingContextImpl implements MappingContext { private final TypeInformation typeInformation; private final ConvertErrorRecorder errorRecorder; - protected MappingContextImpl(@NotNull String path, @NotNull TypeInformation typeInformation, @NotNull ConvertErrorRecorder errorRecorder) { + protected MappingContextImpl(@NotNull String path, @NotNull TypeInformation typeInformation, + @NotNull ConvertErrorRecorder errorRecorder) { this.path = path; this.typeInformation = typeInformation; this.errorRecorder = errorRecorder; @@ -26,7 +27,8 @@ protected MappingContextImpl(@NotNull String path, @NotNull TypeInformation type * @param errorRecorder error recorder to register errors even if a valid value is returned * @return root mapping context */ - public static @NotNull MappingContextImpl createRoot(@NotNull TypeInformation typeInformation, @NotNull ConvertErrorRecorder errorRecorder) { + public static @NotNull MappingContextImpl createRoot(@NotNull TypeInformation typeInformation, + @NotNull ConvertErrorRecorder errorRecorder) { return new MappingContextImpl("", typeInformation, errorRecorder); } diff --git a/src/main/java/ch/jalu/configme/beanmapper/propertydescription/BeanDescriptionFactoryImpl.java b/src/main/java/ch/jalu/configme/beanmapper/propertydescription/BeanDescriptionFactoryImpl.java index b4ab65fd..4fa6d28a 100644 --- a/src/main/java/ch/jalu/configme/beanmapper/propertydescription/BeanDescriptionFactoryImpl.java +++ b/src/main/java/ch/jalu/configme/beanmapper/propertydescription/BeanDescriptionFactoryImpl.java @@ -88,7 +88,8 @@ public class BeanDescriptionFactoryImpl implements BeanDescriptionFactory { * @param clazz the class to which the properties belong * @param properties the properties that will be used on the class */ - protected void validateProperties(@NotNull Class clazz, @NotNull Collection properties) { + protected void validateProperties(@NotNull Class clazz, + @NotNull Collection properties) { Set names = new HashSet<>(properties.size()); properties.forEach(property -> { if (property.getName().isEmpty()) { @@ -151,7 +152,8 @@ protected void validateProperties(@NotNull Class clazz, @NotNull Collection sortPropertiesList(@NotNull Class clazz, @NotNull List properties) { + protected @NotNull List sortPropertiesList(@NotNull Class clazz, + @NotNull List properties) { Map fieldNameByIndex = createFieldNameOrderMap(clazz); int maxIndex = fieldNameByIndex.size(); diff --git a/src/main/java/ch/jalu/configme/beanmapper/propertydescription/BeanPropertyDescriptionImpl.java b/src/main/java/ch/jalu/configme/beanmapper/propertydescription/BeanPropertyDescriptionImpl.java index a785026e..751793f8 100644 --- a/src/main/java/ch/jalu/configme/beanmapper/propertydescription/BeanPropertyDescriptionImpl.java +++ b/src/main/java/ch/jalu/configme/beanmapper/propertydescription/BeanPropertyDescriptionImpl.java @@ -26,7 +26,8 @@ public class BeanPropertyDescriptionImpl implements BeanPropertyDescription { * @param getter getter for the property * @param setter setter for the property */ - public BeanPropertyDescriptionImpl(@NotNull String name, @NotNull TypeInformation typeInformation, @NotNull Method getter, @NotNull Method setter) { + public BeanPropertyDescriptionImpl(@NotNull String name, @NotNull TypeInformation typeInformation, + @NotNull Method getter, @NotNull Method setter) { this.name = name; this.typeInformation = typeInformation; this.getter = getter; diff --git a/src/main/java/ch/jalu/configme/configurationdata/ConfigurationDataBuilder.java b/src/main/java/ch/jalu/configme/configurationdata/ConfigurationDataBuilder.java index 49083dfa..005c4bd7 100644 --- a/src/main/java/ch/jalu/configme/configurationdata/ConfigurationDataBuilder.java +++ b/src/main/java/ch/jalu/configme/configurationdata/ConfigurationDataBuilder.java @@ -52,7 +52,8 @@ protected ConfigurationDataBuilder() { * @param classes the classes to scan for their property data * @return collected configuration data */ - public static @NotNull ConfigurationData createConfiguration(@NotNull Iterable> classes) { + public static @NotNull ConfigurationData createConfiguration( + @NotNull Iterable> classes) { ConfigurationDataBuilder builder = new ConfigurationDataBuilder(); return builder.collectData(classes); } diff --git a/src/main/java/ch/jalu/configme/configurationdata/ConfigurationDataImpl.java b/src/main/java/ch/jalu/configme/configurationdata/ConfigurationDataImpl.java index 33bca6b3..a00429dd 100644 --- a/src/main/java/ch/jalu/configme/configurationdata/ConfigurationDataImpl.java +++ b/src/main/java/ch/jalu/configme/configurationdata/ConfigurationDataImpl.java @@ -30,7 +30,8 @@ public class ConfigurationDataImpl implements ConfigurationData { * @param allProperties all known properties * @param allComments map of comments by path */ - protected ConfigurationDataImpl(@NotNull List> allProperties, @NotNull Map> allComments) { + protected ConfigurationDataImpl(@NotNull List> allProperties, + @NotNull Map> allComments) { this.properties = Collections.unmodifiableList(allProperties); this.allComments = Collections.unmodifiableMap(allComments); this.values = new HashMap<>(); diff --git a/src/main/java/ch/jalu/configme/migration/PlainMigrationService.java b/src/main/java/ch/jalu/configme/migration/PlainMigrationService.java index 3a7e157d..854aa9fa 100644 --- a/src/main/java/ch/jalu/configme/migration/PlainMigrationService.java +++ b/src/main/java/ch/jalu/configme/migration/PlainMigrationService.java @@ -48,8 +48,10 @@ protected boolean performMigrations(@NotNull PropertyReader reader, @NotNull Con * @param the type of the property * @return true if the old path exists in the configuration file, false otherwise */ - protected static boolean moveProperty(@NotNull Property oldProperty, @NotNull Property newProperty, - @NotNull PropertyReader reader, @NotNull ConfigurationData configurationData) { + protected static boolean moveProperty(@NotNull Property oldProperty, + @NotNull Property newProperty, + @NotNull PropertyReader reader, + @NotNull ConfigurationData configurationData) { if (reader.contains(oldProperty.getPath())) { if (!reader.contains(newProperty.getPath())) { PropertyValue value = oldProperty.determineValue(reader); diff --git a/src/main/java/ch/jalu/configme/properties/ArrayProperty.java b/src/main/java/ch/jalu/configme/properties/ArrayProperty.java index d7f61d27..7f4b1659 100644 --- a/src/main/java/ch/jalu/configme/properties/ArrayProperty.java +++ b/src/main/java/ch/jalu/configme/properties/ArrayProperty.java @@ -23,7 +23,8 @@ public class ArrayProperty extends BaseProperty { * @param type the property type * @param arrayProducer array constructor (desired array size as argument) */ - public ArrayProperty(@NotNull String path, T @NotNull [] defaultValue, @NotNull PropertyType type, @NotNull IntFunction arrayProducer) { + public ArrayProperty(@NotNull String path, T @NotNull [] defaultValue, @NotNull PropertyType type, + @NotNull IntFunction arrayProducer) { super(path, defaultValue); Objects.requireNonNull(type, "type"); Objects.requireNonNull(arrayProducer, "arrayProducer"); @@ -32,7 +33,8 @@ public ArrayProperty(@NotNull String path, T @NotNull [] defaultValue, @NotNull } @Override - protected T @Nullable [] getFromReader(@NotNull PropertyReader reader, @NotNull ConvertErrorRecorder errorRecorder) { + protected T @Nullable [] getFromReader(@NotNull PropertyReader reader, + @NotNull ConvertErrorRecorder errorRecorder) { Object object = reader.getObject(this.getPath()); if (object instanceof Collection) { Collection collection = (Collection) object; diff --git a/src/main/java/ch/jalu/configme/properties/BaseProperty.java b/src/main/java/ch/jalu/configme/properties/BaseProperty.java index d5518f6c..33017e0b 100644 --- a/src/main/java/ch/jalu/configme/properties/BaseProperty.java +++ b/src/main/java/ch/jalu/configme/properties/BaseProperty.java @@ -67,7 +67,8 @@ public boolean isValidValue(@Nullable T value) { * @param errorRecorder error recorder to register errors even if a valid value is returned * @return value based on the reader, or null if not applicable */ - protected abstract @Nullable T getFromReader(@NotNull PropertyReader reader, @NotNull ConvertErrorRecorder errorRecorder); + protected abstract @Nullable T getFromReader(@NotNull PropertyReader reader, + @NotNull ConvertErrorRecorder errorRecorder); @Override public @NotNull String toString() { diff --git a/src/main/java/ch/jalu/configme/properties/BeanProperty.java b/src/main/java/ch/jalu/configme/properties/BeanProperty.java index cec8e6e4..a2c3c2bd 100644 --- a/src/main/java/ch/jalu/configme/properties/BeanProperty.java +++ b/src/main/java/ch/jalu/configme/properties/BeanProperty.java @@ -13,7 +13,8 @@ public BeanProperty(@NotNull Class beanType, @NotNull String path, @NotNull T this(beanType, path, defaultValue, DefaultMapper.getInstance()); } - public BeanProperty(@NotNull Class beanType, @NotNull String path, @NotNull T defaultValue, @NotNull Mapper mapper) { + public BeanProperty(@NotNull Class beanType, @NotNull String path, @NotNull T defaultValue, + @NotNull Mapper mapper) { super(path, defaultValue, BeanPropertyType.of(beanType, mapper)); } @@ -26,7 +27,8 @@ public BeanProperty(@NotNull Class beanType, @NotNull String path, @NotNull T * @param defaultValue the default value * @param mapper the mapper to map with */ - protected BeanProperty(@NotNull TypeInformation beanType, @NotNull String path, @NotNull T defaultValue, @NotNull Mapper mapper) { + protected BeanProperty(@NotNull TypeInformation beanType, @NotNull String path, @NotNull T defaultValue, + @NotNull Mapper mapper) { super(path, defaultValue, new BeanPropertyType<>(beanType, mapper)); if (!beanType.getSafeToWriteClass().isInstance(defaultValue)) { throw new ConfigMeException( diff --git a/src/main/java/ch/jalu/configme/properties/InlineArrayProperty.java b/src/main/java/ch/jalu/configme/properties/InlineArrayProperty.java index 40659e98..779b60f6 100644 --- a/src/main/java/ch/jalu/configme/properties/InlineArrayProperty.java +++ b/src/main/java/ch/jalu/configme/properties/InlineArrayProperty.java @@ -25,14 +25,16 @@ public class InlineArrayProperty extends BaseProperty { * @param defaultValue the default value of the property * @param inlineConverter the inline converter to use */ - public InlineArrayProperty(@NotNull String path, T @NotNull [] defaultValue, @NotNull InlineArrayConverter inlineConverter) { + public InlineArrayProperty(@NotNull String path, T @NotNull [] defaultValue, + @NotNull InlineArrayConverter inlineConverter) { super(path, defaultValue); Objects.requireNonNull(inlineConverter, "inlineConverter"); this.inlineConverter = inlineConverter; } @Override - protected T @Nullable [] getFromReader(@NotNull PropertyReader reader, @NotNull ConvertErrorRecorder errorRecorder) { + protected T @Nullable [] getFromReader(@NotNull PropertyReader reader, + @NotNull ConvertErrorRecorder errorRecorder) { String value = reader.getString(getPath()); return value == null ? null : inlineConverter.fromString(value); } diff --git a/src/main/java/ch/jalu/configme/properties/ListProperty.java b/src/main/java/ch/jalu/configme/properties/ListProperty.java index c8c2a3ab..8c461691 100644 --- a/src/main/java/ch/jalu/configme/properties/ListProperty.java +++ b/src/main/java/ch/jalu/configme/properties/ListProperty.java @@ -47,7 +47,8 @@ public ListProperty(@NotNull String path, @NotNull PropertyType type, @NotNul } @Override - protected @Nullable List getFromReader(@NotNull PropertyReader reader, @NotNull ConvertErrorRecorder errorRecorder) { + protected @Nullable List getFromReader(@NotNull PropertyReader reader, + @NotNull ConvertErrorRecorder errorRecorder) { List list = reader.getList(getPath()); if (list != null) { diff --git a/src/main/java/ch/jalu/configme/properties/MapProperty.java b/src/main/java/ch/jalu/configme/properties/MapProperty.java index f15eb75b..e63bd443 100644 --- a/src/main/java/ch/jalu/configme/properties/MapProperty.java +++ b/src/main/java/ch/jalu/configme/properties/MapProperty.java @@ -35,7 +35,8 @@ public MapProperty(@NotNull String path, @NotNull Map defaultValue, @ } @Override - protected @Nullable Map getFromReader(@NotNull PropertyReader reader, @NotNull ConvertErrorRecorder errorRecorder) { + protected @Nullable Map getFromReader(@NotNull PropertyReader reader, + @NotNull ConvertErrorRecorder errorRecorder) { Object rawObject = reader.getObject(getPath()); if (!(rawObject instanceof Map)) { diff --git a/src/main/java/ch/jalu/configme/properties/PropertyInitializer.java b/src/main/java/ch/jalu/configme/properties/PropertyInitializer.java index 7af8da6d..92a4f5d3 100644 --- a/src/main/java/ch/jalu/configme/properties/PropertyInitializer.java +++ b/src/main/java/ch/jalu/configme/properties/PropertyInitializer.java @@ -111,7 +111,8 @@ protected PropertyInitializer() { * @param the enum type * @return the created enum property */ - public static > @NotNull Property newProperty(@NotNull Class clazz, @NotNull String path, @NotNull E defaultValue) { + public static > @NotNull Property newProperty(@NotNull Class clazz, @NotNull String path, + @NotNull E defaultValue) { return new EnumProperty<>(clazz, path, defaultValue); } @@ -144,7 +145,8 @@ protected PropertyInitializer() { * @param defaultValues the items in the default list * @return the created list property */ - public static @NotNull Property> newListProperty(@NotNull String path, @NotNull String @NotNull ... defaultValues) { + public static @NotNull Property> newListProperty(@NotNull String path, + @NotNull String @NotNull ... defaultValues) { // does not have the same name as not to clash with #newProperty(String, String) return new StringListProperty(path, defaultValues); } @@ -156,7 +158,8 @@ protected PropertyInitializer() { * @param defaultValues the default value of the property * @return the created list property */ - public static @NotNull Property> newListProperty(@NotNull String path, @NotNull List defaultValues) { + public static @NotNull Property> newListProperty(@NotNull String path, + @NotNull List defaultValues) { // does not have the same name as not to clash with #newProperty(String, String) return new StringListProperty(path, defaultValues); } @@ -168,7 +171,8 @@ protected PropertyInitializer() { * @param defaultValues the items in the default set * @return the created set property */ - public static @NotNull Property> newSetProperty(@NotNull String path, @NotNull String @NotNull ... defaultValues) { + public static @NotNull Property> newSetProperty(@NotNull String path, + @NotNull String @NotNull ... defaultValues) { return new StringSetProperty(path, defaultValues); } @@ -179,7 +183,8 @@ protected PropertyInitializer() { * @param defaultValues the default value of the property * @return the created set property */ - public static @NotNull Property> newSetProperty(@NotNull String path, @NotNull Set defaultValues) { + public static @NotNull Property> newSetProperty(@NotNull String path, + @NotNull Set defaultValues) { return new StringSetProperty(path, defaultValues); } @@ -190,7 +195,8 @@ protected PropertyInitializer() { * @param defaultValues the items in the default set * @return the created set property */ - public static @NotNull Property> newLowercaseStringSetProperty(@NotNull String path, @NotNull String @NotNull ... defaultValues) { + public static @NotNull Property> newLowercaseStringSetProperty(@NotNull String path, + @NotNull String @NotNull ... defaultValues) { return new LowercaseStringSetProperty(path, defaultValues); } @@ -201,7 +207,8 @@ protected PropertyInitializer() { * @param defaultValues the default value of the property * @return the created set property */ - public static @NotNull Property> newLowercaseStringSetProperty(@NotNull String path, @NotNull Collection defaultValues) { + public static @NotNull Property> newLowercaseStringSetProperty(@NotNull String path, + @NotNull Collection defaultValues) { return new LowercaseStringSetProperty(path, defaultValues); } @@ -214,14 +221,16 @@ protected PropertyInitializer() { * @param the bean type * @return the created bean property */ - public static @NotNull Property newBeanProperty(@NotNull Class beanClass, @NotNull String path, @NotNull B defaultValue) { + public static @NotNull Property newBeanProperty(@NotNull Class beanClass, @NotNull String path, + @NotNull B defaultValue) { return new BeanProperty<>(beanClass, path, defaultValue); } // -------------- // Property builders // -------------- - public static PropertyBuilder.@NotNull TypeBasedPropertyBuilder typeBasedProperty(@NotNull PropertyType type) { + public static PropertyBuilder.@NotNull TypeBasedPropertyBuilder typeBasedProperty( + @NotNull PropertyType type) { return new PropertyBuilder.TypeBasedPropertyBuilder<>(type); } @@ -238,7 +247,7 @@ protected PropertyInitializer() { } public static PropertyBuilder.@NotNull ArrayPropertyBuilder arrayProperty(@NotNull PropertyType type, - @NotNull IntFunction arrayProducer) { + @NotNull IntFunction arrayProducer) { return new PropertyBuilder.ArrayPropertyBuilder<>(type, arrayProducer); } @@ -262,7 +271,8 @@ protected PropertyInitializer() { return new OptionalProperty<>(new StringProperty(path, "")); } - public static > @NotNull Property> optionalEnumProperty(@NotNull Class clazz, @NotNull String path) { + public static > @NotNull Property> optionalEnumProperty(@NotNull Class clazz, + @NotNull String path) { // default value may never be null, so get the first entry in the enum class return new OptionalProperty<>(new EnumProperty<>(clazz, path, clazz.getEnumConstants()[0])); } diff --git a/src/main/java/ch/jalu/configme/properties/RegexProperty.java b/src/main/java/ch/jalu/configme/properties/RegexProperty.java index 1ec94ed8..d9a70049 100644 --- a/src/main/java/ch/jalu/configme/properties/RegexProperty.java +++ b/src/main/java/ch/jalu/configme/properties/RegexProperty.java @@ -36,7 +36,8 @@ public RegexProperty(@NotNull String path, @NotNull String defaultRegexValue) { } @Override - protected @Nullable Pattern getFromReader(@NotNull PropertyReader reader, @NotNull ConvertErrorRecorder errorRecorder) { + protected @Nullable Pattern getFromReader(@NotNull PropertyReader reader, + @NotNull ConvertErrorRecorder errorRecorder) { String pattern = reader.getString(getPath()); if (pattern != null) { try { diff --git a/src/main/java/ch/jalu/configme/properties/SetProperty.java b/src/main/java/ch/jalu/configme/properties/SetProperty.java index d404454d..6c879e2b 100644 --- a/src/main/java/ch/jalu/configme/properties/SetProperty.java +++ b/src/main/java/ch/jalu/configme/properties/SetProperty.java @@ -4,7 +4,6 @@ import ch.jalu.configme.properties.types.PropertyType; import ch.jalu.configme.resource.PropertyReader; import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; import java.util.Arrays; import java.util.Collections; diff --git a/src/main/java/ch/jalu/configme/properties/types/PrimitivePropertyType.java b/src/main/java/ch/jalu/configme/properties/types/PrimitivePropertyType.java index 0b51092a..7c5138d8 100644 --- a/src/main/java/ch/jalu/configme/properties/types/PrimitivePropertyType.java +++ b/src/main/java/ch/jalu/configme/properties/types/PrimitivePropertyType.java @@ -52,7 +52,8 @@ public PrimitivePropertyType(@NotNull Function convertFunction) { * @param convertFunction function to convert to the given type * @param exportValueFunction function to convert a value to its export value */ - public PrimitivePropertyType(@NotNull Function convertFunction, @NotNull Function exportValueFunction) { + public PrimitivePropertyType(@NotNull Function convertFunction, + @NotNull Function exportValueFunction) { this.convertFunction = convertFunction; this.exportValueFunction = exportValueFunction; } diff --git a/src/main/java/ch/jalu/configme/resource/MapNormalizer.java b/src/main/java/ch/jalu/configme/resource/MapNormalizer.java index 2ee9343e..e901c242 100644 --- a/src/main/java/ch/jalu/configme/resource/MapNormalizer.java +++ b/src/main/java/ch/jalu/configme/resource/MapNormalizer.java @@ -117,7 +117,8 @@ protected void addValueIntoMap(@NotNull Map map, @NotNull String * @param path the key with which the value should be looked up from the map * @return the nested map, as stored under the path in the given map */ - protected @NotNull Map getOrInsertMap(@NotNull Map parentMap, @NotNull String path) { + protected @NotNull Map getOrInsertMap(@NotNull Map parentMap, + @NotNull String path) { Object value = parentMap.get(path); if (value instanceof Map) { return (Map) value; diff --git a/src/main/java/ch/jalu/configme/resource/PropertyPathTraverser.java b/src/main/java/ch/jalu/configme/resource/PropertyPathTraverser.java index ec241737..b5429c9f 100644 --- a/src/main/java/ch/jalu/configme/resource/PropertyPathTraverser.java +++ b/src/main/java/ch/jalu/configme/resource/PropertyPathTraverser.java @@ -44,7 +44,8 @@ public PropertyPathTraverser(@NotNull ConfigurationData configurationData) { return convertToPathElements(indentationLevel, prefix, newPathParts); } - private @NotNull List convertToPathElements(int indentation, @NotNull String prefix, @NotNull List elements) { + private @NotNull List convertToPathElements(int indentation, @NotNull String prefix, + @NotNull List elements) { List pathElements = new ArrayList<>(elements.size()); for (String element : elements) { List comments = isFirstProperty @@ -86,7 +87,8 @@ public static class PathElement { private final boolean isFirstElement; private boolean isFirstOfGroup; - public PathElement(int indentationLevel, @NotNull String name, @NotNull List comments, boolean isFirstElement) { + public PathElement(int indentationLevel, @NotNull String name, @NotNull List comments, + boolean isFirstElement) { this.indentationLevel = indentationLevel; this.name = name; this.comments = comments; diff --git a/src/main/java/ch/jalu/configme/resource/YamlFileReader.java b/src/main/java/ch/jalu/configme/resource/YamlFileReader.java index 4b662932..a69d99c3 100644 --- a/src/main/java/ch/jalu/configme/resource/YamlFileReader.java +++ b/src/main/java/ch/jalu/configme/resource/YamlFileReader.java @@ -157,7 +157,8 @@ public boolean contains(@NotNull String path) { * @param result set to save keys to * @param onlyLeafNodes whether only leaf nodes should be added to the result set */ - private void collectKeysIntoSet(@NotNull String path, @NotNull Map map, @NotNull Set result, boolean onlyLeafNodes) { + private void collectKeysIntoSet(@NotNull String path, @NotNull Map map, @NotNull Set result, + boolean onlyLeafNodes) { for (Map.Entry entry : map.entrySet()) { String childPath = path.isEmpty() ? entry.getKey() : path + "." + entry.getKey(); if (!onlyLeafNodes || isLeafValue(entry.getValue())) { diff --git a/src/main/java/ch/jalu/configme/resource/YamlFileResource.java b/src/main/java/ch/jalu/configme/resource/YamlFileResource.java index c34fd0fc..ef7ef01f 100644 --- a/src/main/java/ch/jalu/configme/resource/YamlFileResource.java +++ b/src/main/java/ch/jalu/configme/resource/YamlFileResource.java @@ -137,7 +137,8 @@ protected void exportValue(@NotNull Writer writer, @NotNull PropertyPathTraverse * @param pathElement the path element for which the comments are being generated * @throws IOException . */ - protected void writeComments(@NotNull Writer writer, int indentation, @NotNull PathElement pathElement) throws IOException { + protected void writeComments(@NotNull Writer writer, int indentation, + @NotNull PathElement pathElement) throws IOException { if (pathElement.getComments().isEmpty()) { return; } @@ -177,7 +178,8 @@ protected List combinePathElementsAndMapEntryKey(List parentPath .collect(Collectors.toList()); } - private void writeIndentingBetweenLines(@NotNull Writer writer, @NotNull PathElement pathElement) throws IOException { + private void writeIndentingBetweenLines(@NotNull Writer writer, + @NotNull PathElement pathElement) throws IOException { int numberOfEmptyLines = options.getNumberOfEmptyLinesBefore(pathElement); for (int i = 0; i < numberOfEmptyLines; ++i) { writer.append("\n"); @@ -283,7 +285,8 @@ protected void onWriteComplete() { return options; } - private @Nullable Object getExportValue(@NotNull Property property, @NotNull ConfigurationData configurationData) { + private @Nullable Object getExportValue(@NotNull Property property, + @NotNull ConfigurationData configurationData) { return property.toExportValue(configurationData.getValue(property)); } diff --git a/src/main/java/ch/jalu/configme/resource/YamlFileResourceOptions.java b/src/main/java/ch/jalu/configme/resource/YamlFileResourceOptions.java index 9f80e874..76e55986 100644 --- a/src/main/java/ch/jalu/configme/resource/YamlFileResourceOptions.java +++ b/src/main/java/ch/jalu/configme/resource/YamlFileResourceOptions.java @@ -83,7 +83,8 @@ public static class Builder { return this; } - public @NotNull Builder numberOfLinesBeforeFunction(@NotNull ToIntFunction numberOfLinesBeforeFunction) { + public @NotNull Builder numberOfLinesBeforeFunction( + @NotNull ToIntFunction numberOfLinesBeforeFunction) { this.numberOfLinesBeforeFunction = numberOfLinesBeforeFunction; return this; } diff --git a/src/main/java/ch/jalu/configme/utils/SettingsHolderClassValidator.java b/src/main/java/ch/jalu/configme/utils/SettingsHolderClassValidator.java index 7c8a0c61..29ce5bbd 100644 --- a/src/main/java/ch/jalu/configme/utils/SettingsHolderClassValidator.java +++ b/src/main/java/ch/jalu/configme/utils/SettingsHolderClassValidator.java @@ -142,7 +142,8 @@ public void validateSettingsHolderClassesFinal(@NotNull Iterable> settingHolders) { + public void validateClassesHaveHiddenNoArgConstructor( + @NotNull Iterable> settingHolders) { List invalidClasses = new ArrayList<>(); for (Class clazz : settingHolders) { @@ -259,7 +260,8 @@ protected boolean isValidConstantField(@NotNull Field field) { && Modifier.isFinal(modifiers); } - protected @NotNull ConfigurationData createConfigurationData(@NotNull Iterable> classes) { + protected @NotNull ConfigurationData createConfigurationData( + @NotNull Iterable> classes) { return ConfigurationDataBuilder.createConfiguration(classes); } @@ -277,7 +279,8 @@ protected boolean hasNonEmptyComment(@Nullable List comments) { * @param maxLength the max length (nullable) * @return predicate based on the supplied length parameters */ - protected @NotNull Predicate createValidLengthPredicate(@Nullable Integer minLength, @Nullable Integer maxLength) { + protected @NotNull Predicate createValidLengthPredicate(@Nullable Integer minLength, + @Nullable Integer maxLength) { if (minLength == null && maxLength == null) { throw new IllegalArgumentException("min length or max length must be not null"); }