Skip to content

Commit

Permalink
Merge pull request #38 from neboskreb/25-support-java-11
Browse files Browse the repository at this point in the history
Support Java 11
  • Loading branch information
neboskreb authored Jun 8, 2024
2 parents 9104c77 + bf1eb08 commit d333d86
Show file tree
Hide file tree
Showing 7 changed files with 61 additions and 12 deletions.
4 changes: 2 additions & 2 deletions examples/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ plugins {
}

java {
sourceCompatibility = 17
targetCompatibility = 17
sourceCompatibility = 11
targetCompatibility = 11
}

test {
Expand Down
4 changes: 2 additions & 2 deletions red-and-blue/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,8 @@ signing {
java {
withSourcesJar()
withJavadocJar()
sourceCompatibility = 17
targetCompatibility = 17
sourceCompatibility = 11
targetCompatibility = 11
}

test {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,10 @@ private <T> void addPrefabs (List<RedAndBlue<?>> prefabs, FactoryCache factoryCa
public <T> T create(Class<T> type, COLOR color) {
ClassAccessor<T> classAccessor = ClassAccessor.of(type, prefabValues);
TypeTag typeTag = new TypeTag(type);
return switch (color) {
case RED -> classAccessor.getRedObject(typeTag);
case BLUE -> classAccessor.getBlueObject(typeTag);
};
switch (color) {
case RED: return classAccessor.getRedObject(typeTag);
case BLUE: return classAccessor.getBlueObject(typeTag);
default: throw new UnsupportedOperationException("Not (yet) implemented for: " + color);
}
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,25 @@
package com.github.neboskreb.red.and.blue;

record RedAndBlue<T>(Class<T> clazz, T red, T blue) {
final public class RedAndBlue<T> {
private final Class<T> clazz;
private final T red;
private final T blue;

public RedAndBlue(Class<T> clazz, T red, T blue) {
this.clazz = clazz;
this.red = red;
this.blue = blue;
}

public Class<T> clazz() {
return clazz;
}

public T red() {
return red;
}

public T blue() {
return blue;
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,13 @@
package com.github.neboskreb.red.and.blue.model;

public record CompositeInteger(Integer value) {
public final class CompositeInteger {
private final Integer value;

CompositeInteger(Integer value) {
this.value = value;
}

public Integer value() {
return value;
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,13 @@
package com.github.neboskreb.red.and.blue.model;

public record CompositeLong(Long value) {
public final class CompositeLong {
private final Long value;

CompositeLong(Long value) {
this.value = value;
}

public Long value() {
return value;
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,13 @@
package com.github.neboskreb.red.and.blue.model;

public record CompositeString(String value) {
public final class CompositeString {
private final String value;

CompositeString(String value) {
this.value = value;
}

public String value() {
return value;
}
}

0 comments on commit d333d86

Please # to comment.