Compare commits
5
Commits
edf02e9816
..
main
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ce95b2626b | ||
|
|
e8ae777939 | ||
|
|
e47e30d602 | ||
|
|
8fbd37c215 | ||
|
|
0c5b92bd76 |
@@ -24,6 +24,17 @@ import java.time.format.DateTimeParseException;
|
||||
*/
|
||||
public class InstantTypeAdapter implements JsonSerializer<Instant>, JsonDeserializer<Instant> {
|
||||
|
||||
/**
|
||||
* Constructs a new {@code InstantTypeAdapter} instance.
|
||||
* <p>
|
||||
* This is a default, no-argument constructor for the {@link InstantTypeAdapter} class,
|
||||
* which provides custom (de)serialization support for {@link Instant} objects in
|
||||
* accordance with the ISO-8601 standard.
|
||||
*/
|
||||
public InstantTypeAdapter() {
|
||||
// Default constructor
|
||||
}
|
||||
|
||||
/**
|
||||
* Serializes an {@link Instant} object into its ISO-8601 string representation as a {@link JsonElement}.
|
||||
*
|
||||
|
||||
@@ -21,7 +21,6 @@ import java.util.Map;
|
||||
*/
|
||||
@Builder(builderClassName = "ConfigurationBuilder")
|
||||
public class JsonConfiguration {
|
||||
|
||||
/**
|
||||
* The name of the application.
|
||||
* This variable is used to identify the application and is incorporated into various configurations,
|
||||
@@ -67,6 +66,21 @@ public class JsonConfiguration {
|
||||
*/
|
||||
private final Gson gson;
|
||||
|
||||
/**
|
||||
* Constructs a new {@code JsonConfiguration} instance with the specified parameters.
|
||||
*
|
||||
* @param appName the name of the application
|
||||
* @param homeDir the home directory path for the application
|
||||
* @param settings a map containing configuration settings as key-value pairs
|
||||
* @param gson the Gson instance used for JSON serialization and deserialization
|
||||
*/
|
||||
public JsonConfiguration(String appName, String homeDir, Map<String, String> settings, Gson gson) {
|
||||
this.appName = appName;
|
||||
this.homeDir = homeDir;
|
||||
this.settings = settings;
|
||||
this.gson = gson;
|
||||
}
|
||||
|
||||
/**
|
||||
* Stores a key-value pair into the configuration settings.
|
||||
* The value is serialized into a JSON string before being stored.
|
||||
@@ -206,6 +220,18 @@ public class JsonConfiguration {
|
||||
*/
|
||||
private String homeDir = System.getProperty("user.home");
|
||||
|
||||
/**
|
||||
* Default constructor for the {@code JsonConfigurationBuilder} class.
|
||||
* Initializes a new instance of the {@code JsonConfigurationBuilder}.
|
||||
* This constructor allows creation of a builder used for configuring
|
||||
* {@code JsonConfiguration} instances, enabling the specification of
|
||||
* application-specific settings such as the application name, home directory,
|
||||
* and custom Gson adapters.
|
||||
*/
|
||||
public JsonConfigurationBuilder() {
|
||||
// Default constructor
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the application name to be used in the configuration.
|
||||
*
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package de.neitzel.injection;
|
||||
|
||||
import de.neitzel.injection.annotation.Component;
|
||||
import de.neitzel.injection.annotation.Inject;
|
||||
import jakarta.inject.Inject;
|
||||
import jakarta.inject.Singleton;
|
||||
import org.reflections.Reflections;
|
||||
|
||||
import java.lang.reflect.Constructor;
|
||||
@@ -110,14 +110,14 @@ public class ComponentScanner {
|
||||
}
|
||||
|
||||
/**
|
||||
* Scans the specified base package for classes annotated with {@link Component}.
|
||||
* Scans the specified base package for classes annotated with {@link Singleton}.
|
||||
* Identified component classes are added to a collection for further processing.
|
||||
*
|
||||
* @param basePackage the package to scan for component annotations
|
||||
*/
|
||||
private void scanForComponents(String basePackage) {
|
||||
Reflections reflections = new Reflections(basePackage);
|
||||
components.addAll(reflections.getTypesAnnotatedWith(Component.class));
|
||||
components.addAll(reflections.getTypesAnnotatedWith(Singleton.class));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -196,8 +196,8 @@ public class ComponentScanner {
|
||||
.collect(Collectors.toSet());
|
||||
|
||||
for (Class<?> clazz : resolvableNow) {
|
||||
Component annotation = clazz.getAnnotation(Component.class);
|
||||
ComponentData componentInfo = new ComponentData(clazz, annotation.scope());
|
||||
Singleton annotation = clazz.getAnnotation(Singleton.class);
|
||||
ComponentData componentInfo = new ComponentData(clazz, Scope.SINGLETON);
|
||||
|
||||
resolved.add(clazz);
|
||||
registerComponentWithSuperTypes(componentInfo, knownTypes);
|
||||
|
||||
@@ -1,37 +0,0 @@
|
||||
package de.neitzel.injection.annotation;
|
||||
|
||||
import de.neitzel.injection.Scope;
|
||||
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
/**
|
||||
* Indicates that an annotated class is a "component" within a dependency injection framework.
|
||||
* Classes annotated with {@code @Component} are recognized during the component scanning process
|
||||
* as candidates for instantiation and management by the dependency injection framework.
|
||||
* <p>
|
||||
* This annotation is typically used on classes that represent application-specific components,
|
||||
* such as service implementations, controllers, or other objects intended to be instantiated
|
||||
* and injected into other components during runtime.
|
||||
* <p>
|
||||
* The annotation must be placed at the type level, and it is retained at runtime
|
||||
* to allow for reflection-based scanning of classes within specified packages.
|
||||
* <p>
|
||||
* Usage of this annotation assumes that there exists a component scanning mechanism
|
||||
* that processes annotated classes and identifies their roles, dependencies, and hierarchy
|
||||
* within the application's structure.
|
||||
*/
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Target(ElementType.TYPE)
|
||||
public @interface Component {
|
||||
/**
|
||||
* Defines the scope of a component within the dependency injection framework.
|
||||
* The scope determines whether the component is instantiated as a singleton or
|
||||
* as a prototype.
|
||||
*
|
||||
* @return the scope of the component, defaulting to {@code Scope.SINGLETON}.
|
||||
*/
|
||||
Scope scope() default Scope.SINGLETON;
|
||||
}
|
||||
@@ -1,24 +0,0 @@
|
||||
package de.neitzel.injection.annotation;
|
||||
|
||||
import java.lang.annotation.ElementType;
|
||||
import java.lang.annotation.Retention;
|
||||
import java.lang.annotation.RetentionPolicy;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
/**
|
||||
* Indicates that a field is a candidate for dependency injection within
|
||||
* a dependency injection framework. Fields annotated with {@code @Inject}
|
||||
* are automatically populated with the required component instance during runtime,
|
||||
* typically by the dependency injection container.
|
||||
* <p>
|
||||
* This annotation must be applied at the field level and is retained at runtime
|
||||
* to enable reflection-based identification and assignment of dependencies.
|
||||
* <p>
|
||||
* The framework's dependency resolution mechanism identifies the appropriate
|
||||
* instance to inject based on the field's type or custom configuration,
|
||||
* ensuring loose coupling and easier testability.
|
||||
*/
|
||||
@Target(ElementType.FIELD)
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
public @interface Inject {
|
||||
}
|
||||
+2
-2
@@ -1,8 +1,8 @@
|
||||
package de.neitzel.injection.testcomponents.test1ok;
|
||||
|
||||
import de.neitzel.injection.annotation.Component;
|
||||
import jakarta.inject.Singleton;
|
||||
|
||||
@Component
|
||||
@Singleton
|
||||
public class TestComponent1_1 extends SuperClass implements TestInterface1_2 {
|
||||
public TestComponent1_1() {
|
||||
}
|
||||
|
||||
+2
-2
@@ -1,11 +1,11 @@
|
||||
package de.neitzel.injection.testcomponents.test1ok.sub;
|
||||
|
||||
import de.neitzel.injection.annotation.Component;
|
||||
import de.neitzel.injection.testcomponents.test1ok.SuperClass;
|
||||
import de.neitzel.injection.testcomponents.test1ok.TestInterface1_1;
|
||||
import de.neitzel.injection.testcomponents.test1ok.TestInterface1_2;
|
||||
import jakarta.inject.Singleton;
|
||||
|
||||
@Component
|
||||
@Singleton
|
||||
public class TestComponent1_2 extends SuperClass implements TestInterface1_1, TestInterface1_2 {
|
||||
public TestComponent1_2() {
|
||||
}
|
||||
|
||||
+2
-2
@@ -1,11 +1,11 @@
|
||||
package de.neitzel.injection.testcomponents.test2fail;
|
||||
|
||||
import de.neitzel.injection.annotation.Component;
|
||||
import jakarta.inject.Singleton;
|
||||
|
||||
/**
|
||||
* TestComponent1 that should fail.
|
||||
*/
|
||||
@Component
|
||||
@Singleton
|
||||
public class TestComponent2_1 {
|
||||
public TestComponent2_1(String test) {
|
||||
}
|
||||
|
||||
@@ -45,6 +45,8 @@ public class ImapAccount {
|
||||
|
||||
/**
|
||||
* Retrieves the server address associated with this IMAP
|
||||
*
|
||||
* @return the server address as a String.
|
||||
*/
|
||||
public String getServer() {
|
||||
return server;
|
||||
|
||||
@@ -23,12 +23,12 @@
|
||||
</modules>
|
||||
|
||||
<properties>
|
||||
<java.version>25</java.version>
|
||||
<java.version>21</java.version>
|
||||
<required.maven.version>3.8.6</required.maven.version>
|
||||
|
||||
<!-- Dependency versions -->
|
||||
<jakarta-inject-api>2.0.1</jakarta-inject-api>
|
||||
<javafx.version>25.0.1</javafx.version>
|
||||
<javafx.version>21.0.7</javafx.version>
|
||||
<jetbrains.annotations.version>26.0.2</jetbrains.annotations.version>
|
||||
<junit.version>6.0.1</junit.version>
|
||||
<lombok.version>1.18.42</lombok.version>
|
||||
|
||||
@@ -11,6 +11,17 @@ import lombok.extern.slf4j.Slf4j;
|
||||
@Slf4j
|
||||
public class GlobalRouteLogging {
|
||||
|
||||
/**
|
||||
* Constructs a new {@code GlobalRouteLogging} instance.
|
||||
* <p>
|
||||
* This is a default, no-argument constructor for the {@link GlobalRouteLogging} class,
|
||||
* which provides global logging functionality for all incoming routes in a Quarkus
|
||||
* application using Vert.x Web.
|
||||
*/
|
||||
public GlobalRouteLogging() {
|
||||
// Default constructor
|
||||
}
|
||||
|
||||
/**
|
||||
* Logs all details of the incoming route request, including the method and URI, as well as all headers present in the request.
|
||||
* This method is designed to be used within a Vert.x Web application to log details for every incoming route globally.
|
||||
|
||||
@@ -22,6 +22,16 @@ import lombok.extern.slf4j.Slf4j;
|
||||
@Priority(Priorities.USER)
|
||||
public class IncomingRequestFilter implements ContainerRequestFilter {
|
||||
|
||||
/**
|
||||
* Constructs a new {@code IncomingRequestFilter} instance.
|
||||
* <p>
|
||||
* This is a default, no-argument constructor for the {@link IncomingRequestFilter} class,
|
||||
* which provides logging functionality for incoming HTTP requests in a JAX-RS application.
|
||||
*/
|
||||
public IncomingRequestFilter() {
|
||||
// Default constructor
|
||||
}
|
||||
|
||||
/**
|
||||
* Logs the details of incoming HTTP requests before they are processed by the application.
|
||||
* This includes logging the request method and URI, as well as all headers present in the request.
|
||||
|
||||
@@ -11,6 +11,17 @@ import lombok.extern.slf4j.Slf4j;
|
||||
@Slf4j
|
||||
@Provider
|
||||
public class LoggingRequestFilter implements ClientRequestFilter {
|
||||
|
||||
/**
|
||||
* Constructs a new {@code LoggingRequestFilter} instance.
|
||||
* <p>
|
||||
* This is a default, no-argument constructor for the {@link LoggingRequestFilter} class,
|
||||
* which provides logging functionality for outgoing HTTP requests in a JAX-RS client application.
|
||||
*/
|
||||
public LoggingRequestFilter() {
|
||||
// Default constructor
|
||||
}
|
||||
|
||||
/**
|
||||
* Logs the details of HTTP requests before they are sent.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user