chore: updates tooling to jdk18, adds missing javadoc
Signed-off-by: Todd Baert <toddbaert@gmail.com>
This commit is contained in:
parent
7f06b9af83
commit
5814c30fc7
|
|
@ -21,10 +21,10 @@ jobs:
|
|||
|
||||
steps:
|
||||
- uses: actions/checkout@8230315d06ad95c617244d2f265d237a1682d445
|
||||
- name: Set up JDK 8
|
||||
- name: Set up JDK 18
|
||||
uses: actions/setup-java@3617c43588448d532250f5c331dffcca90e398f1
|
||||
with:
|
||||
java-version: '8'
|
||||
java-version: '18'
|
||||
distribution: 'temurin'
|
||||
cache: maven
|
||||
server-id: ossrh
|
||||
|
|
|
|||
|
|
@ -18,10 +18,10 @@ jobs:
|
|||
- name: Check out the code
|
||||
uses: actions/checkout@8230315d06ad95c617244d2f265d237a1682d445
|
||||
|
||||
- name: Set up JDK 8
|
||||
- name: Set up JDK 18
|
||||
uses: actions/setup-java@3617c43588448d532250f5c331dffcca90e398f1
|
||||
with:
|
||||
java-version: '8'
|
||||
java-version: '18'
|
||||
distribution: 'temurin'
|
||||
cache: maven
|
||||
|
||||
|
|
|
|||
|
|
@ -30,11 +30,11 @@ jobs:
|
|||
- name: checkout
|
||||
if: ${{ steps.release.outputs.releases_created }}
|
||||
uses: actions/checkout@8230315d06ad95c617244d2f265d237a1682d445
|
||||
- name: Set up JDK 8
|
||||
- name: Set up JDK 18
|
||||
if: ${{ steps.release.outputs.releases_created }}
|
||||
uses: actions/setup-java@3617c43588448d532250f5c331dffcca90e398f1
|
||||
with:
|
||||
java-version: '8'
|
||||
java-version: '18'
|
||||
distribution: 'temurin'
|
||||
cache: maven
|
||||
server-id: ossrh
|
||||
|
|
|
|||
|
|
@ -56,7 +56,7 @@ class MyClass {
|
|||
For complete documentation, visit: https://docs.openfeature.dev/docs/category/concepts
|
||||
|
||||
## Requirements
|
||||
- Java 8+
|
||||
- Java 18+ (compiler target is 1.8)
|
||||
|
||||
## Installation
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,7 @@
|
|||
<?xml version="1.0"?>
|
||||
|
||||
<!DOCTYPE suppressions PUBLIC "-//Checkstyle//DTD SuppressionFilter Configuration 1.2//EN" "https://checkstyle.org/dtds/suppressions_1_2.dtd">
|
||||
|
||||
<suppressions>
|
||||
<!-- checkstyle suppressions can go here -->
|
||||
</suppressions>
|
||||
|
|
@ -292,6 +292,12 @@
|
|||
<property name="allowedAnnotations" value="Override, Test"/>
|
||||
<property name="tokens" value="METHOD_DEF, CTOR_DEF, ANNOTATION_FIELD_DEF"/>
|
||||
</module>
|
||||
<module name="MissingJavadocType">
|
||||
<property name="scope" value="protected"/>
|
||||
<property name="tokens" value="CLASS_DEF, INTERFACE_DEF, ENUM_DEF,
|
||||
RECORD_DEF, ANNOTATION_DEF"/>
|
||||
<property name="excludeScope" value="nothing"/>
|
||||
</module>
|
||||
<module name="MethodName">
|
||||
<property name="format" value="^[a-z][a-z0-9][a-zA-Z0-9_]*$"/>
|
||||
<message key="name.invalidPattern"
|
||||
|
|
@ -314,4 +320,3 @@
|
|||
</module>
|
||||
</module>
|
||||
</module>
|
||||
|
||||
|
|
|
|||
3
pom.xml
3
pom.xml
|
|
@ -369,6 +369,7 @@
|
|||
<version>3.4.1</version>
|
||||
<configuration>
|
||||
<failOnWarnings>true</failOnWarnings>
|
||||
<doclint>all,-missing</doclint> <!-- ignore missing javadoc, these are enforced with more customizability in the checkstyle plugin -->
|
||||
</configuration>
|
||||
<executions>
|
||||
<execution>
|
||||
|
|
@ -461,7 +462,7 @@
|
|||
<dependency>
|
||||
<groupId>com.puppycrawl.tools</groupId>
|
||||
<artifactId>checkstyle</artifactId>
|
||||
<version>8.45.1</version>
|
||||
<version>10.3.2</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<executions>
|
||||
|
|
|
|||
|
|
@ -27,9 +27,6 @@
|
|||
<Bug pattern="EI_EXPOSE_REP2"/>
|
||||
</And>
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- Test class that should be excluded -->
|
||||
<Match>
|
||||
<Class name="dev.openfeature.sdk.DoSomethingProvider"/>
|
||||
|
|
|
|||
|
|
@ -1,5 +1,8 @@
|
|||
package dev.openfeature.sdk;
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public interface BooleanHook extends Hook<Boolean> {
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -1,5 +1,8 @@
|
|||
package dev.openfeature.sdk;
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public interface DoubleHook extends Hook<Double> {
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -1,5 +1,8 @@
|
|||
package dev.openfeature.sdk;
|
||||
|
||||
/**
|
||||
* Flag resolution error codes.
|
||||
*/
|
||||
public enum ErrorCode {
|
||||
PROVIDER_NOT_READY, FLAG_NOT_FOUND, PARSE_ERROR, TYPE_MISMATCH, TARGETING_KEY_MISSING, INVALID_CONTEXT, GENERAL
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@ public class FlagEvaluationDetails<T> implements BaseEvaluation<T> {
|
|||
|
||||
/**
|
||||
* Generate detail payload from the provider response.
|
||||
*
|
||||
* @param providerEval provider response
|
||||
* @param flagKey key for the flag being evaluated
|
||||
* @param <T> type of flag being returned
|
||||
|
|
|
|||
|
|
@ -7,6 +7,9 @@ import java.util.Map;
|
|||
import lombok.Builder;
|
||||
import lombok.Singular;
|
||||
|
||||
/**
|
||||
* Options to be passed in flag evaluation.
|
||||
*/
|
||||
@lombok.Value
|
||||
@Builder
|
||||
public class FlagEvaluationOptions {
|
||||
|
|
|
|||
|
|
@ -1,5 +1,8 @@
|
|||
package dev.openfeature.sdk;
|
||||
|
||||
/**
|
||||
* Flag value data types.
|
||||
*/
|
||||
public enum FlagValueType {
|
||||
STRING, INTEGER, DOUBLE, OBJECT, BOOLEAN;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,9 @@
|
|||
package dev.openfeature.sdk;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
import java.util.Optional;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.IntStream;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,8 @@
|
|||
package dev.openfeature.sdk;
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public interface IntegerHook extends Hook<Integer> {
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -1,7 +1,10 @@
|
|||
package dev.openfeature.sdk;
|
||||
|
||||
import java.time.Instant;
|
||||
import java.util.*;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import dev.openfeature.sdk.exceptions.ValueNotConvertableError;
|
||||
|
|
@ -34,55 +37,103 @@ public class MutableStructure implements Structure {
|
|||
return this.attributes.keySet();
|
||||
}
|
||||
|
||||
// getters
|
||||
|
||||
@Override
|
||||
public Value getValue(String key) {
|
||||
return this.attributes.get(key);
|
||||
}
|
||||
|
||||
// adders
|
||||
/**
|
||||
* Adds the specified value at key.
|
||||
*
|
||||
* @param key String index
|
||||
* @param value Value value
|
||||
* @return this structure
|
||||
*/
|
||||
public MutableStructure add(String key, Value value) {
|
||||
attributes.put(key, value);
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the specified value at key.
|
||||
*
|
||||
* @param key String index
|
||||
* @param value Boolean value
|
||||
* @return this structure
|
||||
*/
|
||||
public MutableStructure add(String key, Boolean value) {
|
||||
attributes.put(key, new Value(value));
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the specified value at key.
|
||||
*
|
||||
* @param key String index
|
||||
* @param value String value
|
||||
* @return this structure
|
||||
*/
|
||||
public MutableStructure add(String key, String value) {
|
||||
attributes.put(key, new Value(value));
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the specified value at key.
|
||||
*
|
||||
* @param key String index
|
||||
* @param value Integer value
|
||||
* @return this structure
|
||||
*/
|
||||
public MutableStructure add(String key, Integer value) {
|
||||
attributes.put(key, new Value(value));
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the specified value at key.
|
||||
*
|
||||
* @param key String index
|
||||
* @param value Double value
|
||||
* @return this structure
|
||||
*/
|
||||
public MutableStructure add(String key, Double value) {
|
||||
attributes.put(key, new Value(value));
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add date-time relevant key.
|
||||
* Adds the specified value at key.
|
||||
*
|
||||
* @param key feature key
|
||||
* @param value date-time value
|
||||
* @return Structure
|
||||
* @param key String index
|
||||
* @param value Instant value
|
||||
* @return this structure
|
||||
*/
|
||||
public MutableStructure add(String key, Instant value) {
|
||||
attributes.put(key, new Value(value));
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the specified value at key.
|
||||
*
|
||||
* @param key String index
|
||||
* @param value Structure value
|
||||
* @return this structure
|
||||
*/
|
||||
public MutableStructure add(String key, Structure value) {
|
||||
attributes.put(key, new Value(value));
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds the specified value at key.
|
||||
*
|
||||
* @param key String index
|
||||
* @param value List value
|
||||
* @return this structure
|
||||
*/
|
||||
public <T> MutableStructure add(String key, List<Value> value) {
|
||||
attributes.put(key, new Value(value));
|
||||
return this;
|
||||
|
|
@ -116,6 +167,7 @@ public class MutableStructure implements Structure {
|
|||
|
||||
/**
|
||||
* convertValue is converting the object type Value in a primitive type.
|
||||
*
|
||||
* @param value - Value object to convert
|
||||
* @return an Object containing the primitive type.
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -14,6 +14,9 @@ import dev.openfeature.sdk.internal.ObjectUtils;
|
|||
import lombok.Getter;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@Slf4j
|
||||
@SuppressWarnings({ "PMD.DataflowAnomalyAnalysis", "PMD.BeanMembersShouldSerialize", "unchecked", "rawtypes" })
|
||||
public class OpenFeatureClient implements Client {
|
||||
|
|
|
|||
|
|
@ -5,6 +5,9 @@ import lombok.Data;
|
|||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
/**
|
||||
* Representing the result of the provider's flag resolution process.
|
||||
*/
|
||||
@Data @Builder
|
||||
public class ProviderEvaluation<T> implements BaseEvaluation<T> {
|
||||
T value;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,8 @@
|
|||
package dev.openfeature.sdk;
|
||||
|
||||
/**
|
||||
* Predefined resolution reasons.
|
||||
*/
|
||||
public enum Reason {
|
||||
DISABLED, SPLIT, TARGETING_MATCH, DEFAULT, UNKNOWN, ERROR
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,8 @@
|
|||
package dev.openfeature.sdk;
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
public interface StringHook extends Hook<String> {
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -18,6 +18,9 @@ public class Value {
|
|||
|
||||
private final Object innerObject;
|
||||
|
||||
/**
|
||||
* Construct a new null Value.
|
||||
*/
|
||||
public Value() {
|
||||
this.innerObject = null;
|
||||
}
|
||||
|
|
@ -42,34 +45,74 @@ public class Value {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Construct a new Value from an existing Value.
|
||||
*
|
||||
* @param value existing value
|
||||
*/
|
||||
public Value(Value value) {
|
||||
this.innerObject = value.innerObject;
|
||||
}
|
||||
|
||||
/**
|
||||
* Construct a new Value from a Boolean.
|
||||
*
|
||||
* @param value Boolean value
|
||||
*/
|
||||
public Value(Boolean value) {
|
||||
this.innerObject = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Construct a new Value from a String.
|
||||
*
|
||||
* @param value String value
|
||||
*/
|
||||
public Value(String value) {
|
||||
this.innerObject = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Construct a new Value from a Integer.
|
||||
*
|
||||
* @param value Integer value
|
||||
*/
|
||||
public Value(Integer value) {
|
||||
this.innerObject = value.doubleValue();
|
||||
}
|
||||
|
||||
/**
|
||||
* Construct a new Value from a Double.
|
||||
*
|
||||
* @param value Double value
|
||||
*/
|
||||
public Value(Double value) {
|
||||
this.innerObject = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Construct a new Value from a Structure.
|
||||
*
|
||||
* @param value Structure value
|
||||
*/
|
||||
public Value(Structure value) {
|
||||
this.innerObject = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Construct a new Value from a List.
|
||||
*
|
||||
* @param value List value
|
||||
*/
|
||||
public Value(List<Value> value) {
|
||||
this.innerObject = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Construct a new Value from an Instant.
|
||||
*
|
||||
* @param value Instant value
|
||||
*/
|
||||
public Value(Instant value) {
|
||||
this.innerObject = value;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,6 +4,9 @@ import dev.openfeature.sdk.ErrorCode;
|
|||
import lombok.Getter;
|
||||
import lombok.experimental.StandardException;
|
||||
|
||||
/**
|
||||
* The flag could not be found.
|
||||
*/
|
||||
@StandardException
|
||||
public class FlagNotFoundError extends OpenFeatureError {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
|
|
|||
|
|
@ -4,6 +4,9 @@ import dev.openfeature.sdk.ErrorCode;
|
|||
import lombok.Getter;
|
||||
import lombok.experimental.StandardException;
|
||||
|
||||
/**
|
||||
* General error.
|
||||
*/
|
||||
@StandardException
|
||||
public class GeneralError extends OpenFeatureError {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
|
|
|||
|
|
@ -4,6 +4,9 @@ import dev.openfeature.sdk.ErrorCode;
|
|||
import lombok.Getter;
|
||||
import lombok.experimental.StandardException;
|
||||
|
||||
/**
|
||||
* The evaluation context does not meet provider requirements.
|
||||
*/
|
||||
@StandardException
|
||||
public class InvalidContextError extends OpenFeatureError {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
|
|
|||
|
|
@ -3,6 +3,9 @@ package dev.openfeature.sdk.exceptions;
|
|||
import dev.openfeature.sdk.ErrorCode;
|
||||
import lombok.experimental.StandardException;
|
||||
|
||||
/**
|
||||
* Base error type.
|
||||
*/
|
||||
@StandardException
|
||||
public abstract class OpenFeatureError extends RuntimeException {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
|
|
|||
|
|
@ -4,6 +4,9 @@ import dev.openfeature.sdk.ErrorCode;
|
|||
import lombok.Getter;
|
||||
import lombok.experimental.StandardException;
|
||||
|
||||
/**
|
||||
* An error was encountered parsing data, such as a flag configuration.
|
||||
*/
|
||||
@StandardException
|
||||
public class ParseError extends OpenFeatureError {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
|
|
|||
|
|
@ -4,6 +4,9 @@ import dev.openfeature.sdk.ErrorCode;
|
|||
import lombok.Getter;
|
||||
import lombok.experimental.StandardException;
|
||||
|
||||
/**
|
||||
* The provider requires a targeting key and one was not provided in the evaluation context.
|
||||
*/
|
||||
@StandardException
|
||||
public class TargetingKeyMissingError extends OpenFeatureError {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
|
|
|||
|
|
@ -4,6 +4,9 @@ import dev.openfeature.sdk.ErrorCode;
|
|||
import lombok.Getter;
|
||||
import lombok.experimental.StandardException;
|
||||
|
||||
/**
|
||||
* The type of the flag value does not match the expected type.
|
||||
*/
|
||||
@StandardException
|
||||
public class TypeMismatchError extends OpenFeatureError {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
|
|
|||
|
|
@ -4,6 +4,9 @@ import dev.openfeature.sdk.ErrorCode;
|
|||
import lombok.Getter;
|
||||
import lombok.experimental.StandardException;
|
||||
|
||||
/**
|
||||
* The value can not be converted to a {@link dev.openfeature.sdk.Value}.
|
||||
*/
|
||||
@StandardException
|
||||
public class ValueNotConvertableError extends OpenFeatureError {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
|
|
|||
|
|
@ -1,5 +1,8 @@
|
|||
package dev.openfeature.sdk.internal;
|
||||
|
||||
/**
|
||||
* Interface for AutoCloseable that doesn't throw.
|
||||
*/
|
||||
public interface AutoCloseableLock extends AutoCloseable {
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -1,11 +1,17 @@
|
|||
package dev.openfeature.sdk.internal;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.function.Supplier;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import lombok.experimental.UtilityClass;
|
||||
|
||||
/**
|
||||
* Various utils for internal usage.
|
||||
*/
|
||||
@UtilityClass
|
||||
public class ObjectUtils {
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue