Skip to content

Commit

Permalink
Ide Fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
cuioss committed Aug 3, 2023
1 parent 93c351e commit 36033fe
Show file tree
Hide file tree
Showing 128 changed files with 2,983 additions and 2,962 deletions.
28 changes: 26 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>de.cuioss</groupId>
Expand All @@ -10,7 +12,8 @@
<artifactId>cui-java-tools</artifactId>
<name>cui java tools</name>
<version>1.2.0-SNAPSHOT</version>
<description>Utility Library acting as a replacement for googles guava, certain apache-commons libraries and logging
<description>Utility Library acting as a replacement for googles guava,
certain apache-commons libraries and logging
facades/frameworks.
</description>
<packaging>jar</packaging>
Expand Down Expand Up @@ -67,4 +70,25 @@
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.openrewrite.maven</groupId>
<artifactId>rewrite-maven-plugin</artifactId>
<version>5.3.2</version>
<configuration>
<activeRecipes>
<recipe>org.openrewrite.java.migrate.Java8toJava11</recipe>
</activeRecipes>
</configuration>
<dependencies>
<dependency>
<groupId>org.openrewrite.recipe</groupId>
<artifactId>rewrite-migrate-java</artifactId>
<version>2.0.8</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>
</project>
27 changes: 14 additions & 13 deletions src/main/java/de/cuioss/tools/base/BooleanOperations.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@
import lombok.experimental.UtilityClass;

/**
* Utility Class providing some boolean operations. In essence, it simplifies 'or' and 'and'
* operations.
* Some examples from the unit-tests:
* Utility Class providing some boolean operations. In essence, it simplifies
* 'or' and 'and' operations. Some examples from the unit-tests:
*
* <pre>
*
Expand Down Expand Up @@ -93,7 +92,8 @@ private static boolean containsFalse(final boolean... parameter) {
* Shorthand for checking if at least one of the given booleans is {@code true}
*
* @param parameter ellipsis of boolean values
* @return {@code true} if one of parameters is {@code true}, {@code false} otherwise
* @return {@code true} if one of parameters is {@code true}, {@code false}
* otherwise
*/
public static boolean isAnyTrue(final boolean... parameter) {
return containsTrue(parameter);
Expand All @@ -103,8 +103,8 @@ public static boolean isAnyTrue(final boolean... parameter) {
* Shorthand for checking if all the given booleans are {@code true}
*
* @param parameter ellipsis of boolean values
* @return {@code true} if all parameters are {@code true} or no parameter is given ratio: no
* given false, {@code false} otherwise
* @return {@code true} if all parameters are {@code true} or no parameter is
* given ratio: no given false, {@code false} otherwise
*/
public static boolean areAllTrue(final boolean... parameter) {
if (isEmpty(parameter)) {
Expand All @@ -117,8 +117,9 @@ public static boolean areAllTrue(final boolean... parameter) {
* Shorthand for checking if all given booleans are {@code false}
*
* @param parameter ellipsis of boolean values
* @return {@code true} if all parameters are {@code false}, {@code true} otherwise.
* {@code false} if no parameter is passed, ratio: no given false
* @return {@code true} if all parameters are {@code false}, {@code true}
* otherwise. {@code false} if no parameter is passed, ratio: no given
* false
*/
public static boolean areAllFalse(final boolean... parameter) {
if (isEmpty(parameter)) {
Expand All @@ -131,19 +132,19 @@ public static boolean areAllFalse(final boolean... parameter) {
* Shorthand for checking if at least one of the given booleans is {@code false}
*
* @param parameter ellipsis of boolean values
* @return {@code true} if one of parameters is {@code false}, {@code true} otherwise
* @return {@code true} if one of parameters is {@code false}, {@code true}
* otherwise
*/
public static boolean isAnyFalse(final boolean... parameter) {
return containsFalse(parameter);
}

/**
* @param value to be checked
* @return true, if the given value represents a boolean value i.e. "true" or "false" ignoring
* case.
* @return true, if the given value represents a boolean value i.e. "true" or
* "false" ignoring case.
*/
public static boolean isValidBoolean(String value) {
return Boolean.TRUE.toString().equalsIgnoreCase(value)
|| Boolean.FALSE.toString().equalsIgnoreCase(value);
return Boolean.TRUE.toString().equalsIgnoreCase(value) || Boolean.FALSE.toString().equalsIgnoreCase(value);
}
}
68 changes: 40 additions & 28 deletions src/main/java/de/cuioss/tools/base/Preconditions.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
import lombok.experimental.UtilityClass;

/**
* Inspired by com.google.common.base.Preconditions. Defines a subset of the corresponding
* Preconditions
* Inspired by com.google.common.base.Preconditions. Defines a subset of the
* corresponding Preconditions
*
* @author com.google.common.base.Preconditions
* @author Oliver Wolff
Expand All @@ -16,7 +16,8 @@
public class Preconditions {

/**
* Ensures the truth of an expression involving one or more parameters to the calling method.
* Ensures the truth of an expression involving one or more parameters to the
* calling method.
*
* @param expression a boolean expression
* @throws IllegalArgumentException if {@code expression} is false
Expand All @@ -29,10 +30,11 @@ public static void checkArgument(boolean expression) {
}

/**
* Ensures the truth of an expression involving one or more parameters to the calling method.
* Ensures the truth of an expression involving one or more parameters to the
* calling method.
*
* @param expression a boolean expression
* @param message to be put into the create {@link IllegalArgumentException}
* @param message to be put into the create {@link IllegalArgumentException}
* @throws IllegalArgumentException if {@code expression} is false
* @author com.google.common.base.Preconditions
*/
Expand All @@ -43,16 +45,21 @@ public static void checkArgument(boolean expression, String message) {
}

/**
* Ensures the truth of an expression involving one or more parameters to the calling method.
* Ensures the truth of an expression involving one or more parameters to the
* calling method.
*
* @param expression a boolean expression
* @param errorMessageTemplate a template for the exception message should the check fail. The
* message is formed by replacing each {@code %s} placeholder in the template with an
* argument. These are matched by position - the first {@code %s} gets {@code
* errorMessageArgs[0]}, etc. Unmatched arguments will be appended to the formatted message
* in square braces. Unmatched placeholders will be left as-is.
* @param errorMessageArgs the arguments to be substituted into the message template. Arguments
* are converted to strings using {@link String#valueOf(Object)}.
* @param expression a boolean expression
* @param errorMessageTemplate a template for the exception message should the
* check fail. The message is formed by replacing
* each {@code %s} placeholder in the template with
* an argument. These are matched by position - the
* first {@code %s} gets {@code
* errorMessageArgs[0]} , etc. Unmatched arguments will be appended to
* the formatted message in square braces. Unmatched
* placeholders will be left as-is.
* @param errorMessageArgs the arguments to be substituted into the message
* template. Arguments are converted to strings
* using {@link String#valueOf(Object)}.
* @throws IllegalArgumentException if {@code expression} is false
* @author com.google.common.base.Preconditions
*/
Expand All @@ -63,8 +70,8 @@ public static void checkArgument(boolean expression, String errorMessageTemplate
}

/**
* Ensures the truth of an expression involving the state of the calling instance, but not
* involving any parameters to the calling method.
* Ensures the truth of an expression involving the state of the calling
* instance, but not involving any parameters to the calling method.
*
* @param expression a boolean expression
* @throws IllegalStateException if {@code expression} is false
Expand All @@ -77,11 +84,11 @@ public static void checkState(boolean expression) {
}

/**
* Ensures the truth of an expression involving the state of the calling instance, but not
* involving any parameters to the calling method.
* Ensures the truth of an expression involving the state of the calling
* instance, but not involving any parameters to the calling method.
*
* @param expression a boolean expression
* @param message to be put into the create {@link IllegalStateException}
* @param message to be put into the create {@link IllegalStateException}
* @throws IllegalStateException if {@code expression} is false
* @author com.google.common.base.Preconditions
*/
Expand All @@ -92,16 +99,21 @@ public static void checkState(boolean expression, String message) {
}

/**
* Ensures the truth of an expression involving one or more parameters to the calling method.
* Ensures the truth of an expression involving one or more parameters to the
* calling method.
*
* @param expression a boolean expression
* @param errorMessageTemplate a template for the exception message should the check fail. The
* message is formed by replacing each {@code %s} placeholder in the template with an
* argument. These are matched by position - the first {@code %s} gets {@code
* errorMessageArgs[0]}, etc. Unmatched arguments will be appended to the formatted message
* in square braces. Unmatched placeholders will be left as-is.
* @param errorMessageArgs the arguments to be substituted into the message template. Arguments
* are converted to strings using {@link String#valueOf(Object)}.
* @param expression a boolean expression
* @param errorMessageTemplate a template for the exception message should the
* check fail. The message is formed by replacing
* each {@code %s} placeholder in the template with
* an argument. These are matched by position - the
* first {@code %s} gets {@code
* errorMessageArgs[0]} , etc. Unmatched arguments will be appended to
* the formatted message in square braces. Unmatched
* placeholders will be left as-is.
* @param errorMessageArgs the arguments to be substituted into the message
* template. Arguments are converted to strings
* using {@link String#valueOf(Object)}.
* @throws IllegalStateException if {@code expression} is false
* @author com.google.common.base.Preconditions
*/
Expand Down
17 changes: 10 additions & 7 deletions src/main/java/de/cuioss/tools/base/package-info.java
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
/**
* Provides some basic utilities, inspired by googles package 'com.google.common.base'
* Provides some basic utilities, inspired by googles package
* 'com.google.common.base'
* <ul>
* <li>{@link de.cuioss.tools.base.BooleanOperations} provides some minimal tooling for checking some
* or
* / and conditions, e.g. {@link de.cuioss.tools.base.BooleanOperations#areAllTrue(boolean...)}</li>
* <li>{@link de.cuioss.tools.base.Preconditions} provide some basic checks for states and arguments
* like {@link de.cuioss.tools.base.Preconditions#checkArgument(boolean)} or
* {@link de.cuioss.tools.base.Preconditions#checkState(boolean)} in certain variants</li>
* <li>{@link de.cuioss.tools.base.BooleanOperations} provides some minimal
* tooling for checking some or / and conditions, e.g.
* {@link de.cuioss.tools.base.BooleanOperations#areAllTrue(boolean...)}</li>
* <li>{@link de.cuioss.tools.base.Preconditions} provide some basic checks for
* states and arguments like
* {@link de.cuioss.tools.base.Preconditions#checkArgument(boolean)} or
* {@link de.cuioss.tools.base.Preconditions#checkState(boolean)} in certain
* variants</li>
* </ul>
*/
package de.cuioss.tools.base;
55 changes: 26 additions & 29 deletions src/main/java/de/cuioss/tools/codec/DecoderException.java
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package de.cuioss.tools.codec;

/**
* Thrown when there is a failure condition during the decoding process. This exception is thrown
* when a Decoder encounters a decoding specific exception such as invalid data, or characters
* outside the expected range.
* Thrown when there is a failure condition during the decoding process. This
* exception is thrown when a Decoder encounters a decoding specific exception
* such as invalid data, or characters outside the expected range.
*
* @author https://github.com/apache/commons-codec/blob/master/src/main/java/org/apache/commons/codec/DecoderException.java
*/
Expand All @@ -12,27 +12,28 @@ public class DecoderException extends Exception {
/**
* Declares the Serial Version Uid.
*
* @see <a href="http://c2.com/cgi/wiki?AlwaysDeclareSerialVersionUid">Always Declare Serial
* Version Uid</a>
* @see <a href="http://c2.com/cgi/wiki?AlwaysDeclareSerialVersionUid">Always
* Declare Serial Version Uid</a>
*/
private static final long serialVersionUID = 1L;

/**
* Constructs a new exception with {@code null} as its detail message. The cause is not
* initialized, and may subsequently be initialized by a call to {@link #initCause}.
* Constructs a new exception with {@code null} as its detail message. The cause
* is not initialized, and may subsequently be initialized by a call to
* {@link #initCause}.
*
*/
public DecoderException() {
super();
}

/**
* Constructs a new exception with the specified detail message. The cause is not initialized,
* and may subsequently be initialized by a call to {@link #initCause}.
* Constructs a new exception with the specified detail message. The cause is
* not initialized, and may subsequently be initialized by a call to
* {@link #initCause}.
*
* @param message
* The detail message which is saved for later retrieval by the {@link #getMessage()}
* method.
* @param message The detail message which is saved for later retrieval by the
* {@link #getMessage()} method.
*/
public DecoderException(final String message) {
super(message);
Expand All @@ -41,16 +42,14 @@ public DecoderException(final String message) {
/**
* Constructs a new exception with the specified detail message and cause.
* <p>
* Note that the detail message associated with {@code cause} is not automatically incorporated
* into this exception's detail message.
* Note that the detail message associated with {@code cause} is not
* automatically incorporated into this exception's detail message.
*
* @param message
* The detail message which is saved for later retrieval by the {@link #getMessage()}
* method.
* @param cause
* The cause which is saved for later retrieval by the {@link #getCause()} method. A
* {@code null} value is permitted, and indicates that the cause is nonexistent or
* unknown.
* @param message The detail message which is saved for later retrieval by the
* {@link #getMessage()} method.
* @param cause The cause which is saved for later retrieval by the
* {@link #getCause()} method. A {@code null} value is permitted,
* and indicates that the cause is nonexistent or unknown.
*/
public DecoderException(final String message, final Throwable cause) {
super(message, cause);
Expand All @@ -59,15 +58,13 @@ public DecoderException(final String message, final Throwable cause) {
/**
* Constructs a new exception with the specified cause and a detail message of
* <code>(cause==null ?
* null : cause.toString())</code> (which typically contains the class and detail message of
* {@code cause}).
* This constructor is useful for exceptions that are little more than wrappers for other
* throwables.
* null : cause.toString())</code> (which typically contains the class and
* detail message of {@code cause}). This constructor is useful for exceptions
* that are little more than wrappers for other throwables.
*
* @param cause
* The cause which is saved for later retrieval by the {@link #getCause()} method. A
* {@code null} value is permitted, and indicates that the cause is nonexistent or
* unknown.
* @param cause The cause which is saved for later retrieval by the
* {@link #getCause()} method. A {@code null} value is permitted,
* and indicates that the cause is nonexistent or unknown.
*/
public DecoderException(final Throwable cause) {
super(cause);
Expand Down
Loading

0 comments on commit 36033fe

Please sign in to comment.