Skip to content

Commit

Permalink
Fix javadoc generation
Browse files Browse the repository at this point in the history
Signed-off-by: Artur Souza <asouza.pro@gmail.com>
  • Loading branch information
artursouza committed Oct 23, 2024
1 parent e2766b8 commit f330413
Show file tree
Hide file tree
Showing 5 changed files with 59 additions and 15 deletions.
4 changes: 2 additions & 2 deletions .github/scripts/update_docs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,5 @@ rm -f daprdocs/content/en/java-sdk-docs/_index.mdbak || echo
rm -f daprdocs/content/en/java-sdk-docs/spring-boot/_index.md/_index.mdbak || echo

rm -rf docs
mvn -Dmaven.test.skip=false -Djacoco.skip=true clean install
mvn site-deploy
./mvnw -Dmaven.test.skip=false -Djacoco.skip=true clean install
./mvnw site-deploy
34 changes: 34 additions & 0 deletions .github/workflows/validate-docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Validate Javadocs Generation

on:
workflow_dispatch:
push:
branches:
- master
- release-*
tags:
- v*

pull_request:
branches:
- master
- release-*

jobs:
build:
name: "Validate Javadocs generation"
runs-on: github-arm64-2c-8gb
timeout-minutes: 20
env:
JDK_VER: 17
steps:
- uses: actions/checkout@v4
- name: Set up OpenJDK ${{ env.JDK_VER }}
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: ${{ env.JDK_VER }}
- name: Install jars
run: ./mvnw install -q -B -DskipTests
- name: Validate Java docs generation
run: ./mvnw site-deploy
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,8 @@ private String createSql(String sqlPattern, String keyspace) {
private String createSql(String sqlPattern, String keyspace, Object criteria) {
String keyspaceFilter = getKeyspaceFilter(keyspace);

if (criteria instanceof DaprPredicate daprPredicate) {
if (criteria instanceof DaprPredicate) {
var daprPredicate = (DaprPredicate) criteria;
String path = daprPredicate.getPath().toString();
String pathWithOutType = String.format("'%s'", path.substring(path.indexOf(".") + 1));
String value = String.format("'%s'", daprPredicate.getValue().toString());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,9 @@ public Predicate<Object> isFalse() {
public Predicate<Object> isEqualTo(Object value) {
return new DaprPredicate(part.getProperty(), value, o -> {
if (!ObjectUtils.nullSafeEquals(Part.IgnoreCaseType.NEVER, part.shouldIgnoreCase())) {
if (o instanceof String s1 && value instanceof String s2) {
if ((o instanceof String) && (value instanceof String)) {
var s1 = (String)o;
var s2 = (String)value;
return s1.equalsIgnoreCase(s2);
}
}
Expand Down Expand Up @@ -85,7 +87,8 @@ public Predicate<Object> matches(Object value) {
return ObjectUtils.nullSafeEquals(o, value);
}

if (value instanceof Pattern pattern) {
if (value instanceof Pattern) {
var pattern = (Pattern)value;
return pattern.matcher(o.toString()).find();
}

Expand All @@ -95,8 +98,10 @@ public Predicate<Object> matches(Object value) {

public Predicate<Object> in(Object value) {
return new DaprPredicate(part.getProperty(), value, o -> {
if (value instanceof Collection<?> collection) {
if (o instanceof Collection<?> subSet) {
if (value instanceof Collection<?>) {
var collection = (Collection<?>)value;
if (o instanceof Collection<?>) {
var subSet = (Collection<?>)o;
return collection.containsAll(subSet);
}

Expand All @@ -117,15 +122,17 @@ public Predicate<Object> contains(Object value) {
return false;
}

if (o instanceof Collection<?> collection) {
if (o instanceof Collection<?>) {
var collection = (Collection<?>)o;
return collection.contains(value);
}

if (ObjectUtils.isArray(o)) {
return ObjectUtils.containsElement(ObjectUtils.toObjectArray(o), value);
}

if (o instanceof Map<?, ?> map) {
if (o instanceof Map<?, ?>) {
var map = (Map<?, ?>)o;
return map.containsValue(value);
}

Expand All @@ -145,9 +152,10 @@ public Predicate<Object> contains(Object value) {

public Predicate<Object> startsWith(Object value) {
return new DaprPredicate(part.getProperty(), value, o -> {
if (!(o instanceof String s)) {
if (!(o instanceof String)) {
return false;
}
var s = (String)o;

if (ObjectUtils.nullSafeEquals(Part.IgnoreCaseType.NEVER, part.shouldIgnoreCase())) {
return s.startsWith(value.toString());
Expand All @@ -159,10 +167,11 @@ public Predicate<Object> startsWith(Object value) {

public Predicate<Object> endsWith(Object value) {
return new DaprPredicate(part.getProperty(), value, o -> {
if (!(o instanceof String s)) {
if (!(o instanceof String)) {
return false;
}

var s = (String)o;
if (ObjectUtils.nullSafeEquals(Part.IgnoreCaseType.NEVER, part.shouldIgnoreCase())) {
return s.endsWith(value.toString());
}
Expand Down
8 changes: 4 additions & 4 deletions dapr-spring/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@

<properties>
<springboot.version>3.2.6</springboot.version>
<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>
<maven.compiler.release>17</maven.compiler.release>
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>
<maven.compiler.release>11</maven.compiler.release>
</properties>

<dependencyManagement>
Expand Down Expand Up @@ -108,7 +108,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>3.7.0</version>
<version>3.2.0</version>
<executions>
<execution>
<id>attach-javadocs</id>
Expand Down

0 comments on commit f330413

Please sign in to comment.