public class ConfigurationDataBuilder extends Object
Property fields
from SettingsHolder implementations via reflection.
Properties must be declared as public static fields or they are ignored.
| Modifier and Type | Field and Description |
|---|---|
protected @NotNull CommentsConfiguration |
commentsConfiguration |
protected @NotNull PropertyListBuilder |
propertyListBuilder |
| Modifier | Constructor and Description |
|---|---|
protected |
ConfigurationDataBuilder() |
| Modifier and Type | Method and Description |
|---|---|
protected @NotNull ConfigurationData |
collectData(@NotNull Iterable<Class<? extends SettingsHolder>> classes)
Collects property data and comment info from the given class and creates a configuration data
instance with it.
|
protected void |
collectProperties(@NotNull Class<?> clazz)
Registers all property fields of the given class to this instance's property list builder.
|
protected void |
collectSectionComments(@NotNull Class<? extends SettingsHolder> clazz) |
static @NotNull ConfigurationData |
createConfiguration(Class<? extends SettingsHolder>... classes)
Collects all properties and comment data from the provided classes.
|
static @NotNull ConfigurationData |
createConfiguration(@NotNull Iterable<Class<? extends SettingsHolder>> classes)
Collects all properties and comment data from the provided classes.
|
static @NotNull ConfigurationData |
createConfiguration(@NotNull List<? extends Property<?>> properties) |
static @NotNull ConfigurationData |
createConfiguration(@NotNull List<? extends Property<?>> properties,
@NotNull CommentsConfiguration commentsConfiguration) |
protected <T extends SettingsHolder> |
createSettingsHolderInstance(@NotNull Class<T> clazz)
Creates an instance of the given settings holder class.
|
protected @NotNull Stream<Field> |
findFieldsToProcess(@NotNull Class<?> clazz)
Returns all fields of the class which should be considered as potential
Property definitions. |
protected @Nullable Property<?> |
getPropertyField(@NotNull Field field)
Returns the given field's value if it is a static
Property. |
protected void |
setCommentForPropertyField(@NotNull Field field,
@NotNull String path) |
protected void |
setFieldAccessibleIfNeeded(@NotNull Field field)
Sets the Field object to be accessible if needed; this makes the code support constants in Kotlin without the
@JvmField annotation. |
@NotNull protected @NotNull PropertyListBuilder propertyListBuilder
@NotNull protected @NotNull CommentsConfiguration commentsConfiguration
@SafeVarargs @NotNull public static @NotNull ConfigurationData createConfiguration(@NotNull Class<? extends SettingsHolder>... classes)
classes - the classes to scan for their property data@NotNull public static @NotNull ConfigurationData createConfiguration(@NotNull @NotNull Iterable<Class<? extends SettingsHolder>> classes)
classes - the classes to scan for their property data@NotNull public static @NotNull ConfigurationData createConfiguration(@NotNull @NotNull List<? extends Property<?>> properties)
@NotNull public static @NotNull ConfigurationData createConfiguration(@NotNull @NotNull List<? extends Property<?>> properties, @NotNull @NotNull CommentsConfiguration commentsConfiguration)
@NotNull protected @NotNull ConfigurationData collectData(@NotNull @NotNull Iterable<Class<? extends SettingsHolder>> classes)
classes - the classes to processprotected void collectProperties(@NotNull
@NotNull Class<?> clazz)
clazz - the class to processprotected void setCommentForPropertyField(@NotNull
@NotNull Field field,
@NotNull
@NotNull String path)
@Nullable protected @Nullable Property<?> getPropertyField(@NotNull @NotNull Field field)
Property.field - the field's value to returnprotected void setFieldAccessibleIfNeeded(@NotNull
@NotNull Field field)
@JvmField annotation. This method only calls AccessibleObject.setAccessible(java.lang.reflect.AccessibleObject[], boolean) if it is needed to avoid
potential issues with a security manager. Within Java itself, only public static final property fields
are expected.field - the field to processprotected void collectSectionComments(@NotNull
@NotNull Class<? extends SettingsHolder> clazz)
@NotNull protected <T extends SettingsHolder> T createSettingsHolderInstance(@NotNull @NotNull Class<T> clazz)
T - the class typeclazz - the class to instantiate@NotNull protected @NotNull Stream<Field> findFieldsToProcess(@NotNull @NotNull Class<?> clazz)
Property definitions.
Considers the class's parents.clazz - the class whose fields should be returnedCopyright © 2016–2023 The AuthMe Team. All rights reserved.