Skip to content

Commit

Permalink
1.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
xTrM_ committed Aug 16, 2021
1 parent 4a2c34b commit 730bd80
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 2 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ plugins {
}

group 'fr.nkosmos'
version '1.0.0'
version '1.1.0'

tasks.withType(JavaCompile) {
options.encoding = "UTF-8"
Expand Down
16 changes: 16 additions & 0 deletions src/main/java/fr/nkosmos/starlink/spi/Starlink.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
package fr.nkosmos.starlink.spi;

import java.util.Arrays;
import java.util.Optional;

public interface Starlink {

/**
Expand All @@ -22,6 +25,19 @@ public interface Starlink {
*/
boolean isModifiable(Class<?> cla$$);

default boolean isModifiable(String classNames) {
Optional<Class> clazz = Arrays.stream(requestAllClasses())
.filter(c -> c.getName().equalsIgnoreCase(classNames))
.findFirst();
return clazz.filter(this::isModifiable).isPresent();
}

default void retransformClasses(String... classNames) {
Arrays.stream(requestAllClasses())
.filter(c -> Arrays.stream(classNames).anyMatch(cn -> c.getName().equals(cn)))
.forEach(this::retransformClasses);
}

/**
* Lists every class defined by the JVM.
*
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/fr/nkosmos/starlink/spi/StarlinkPlugin.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import java.util.function.Consumer;

/**
* Serdsaddsdavice interface to which a {@link Starlink} instance is dispatched.
* Service interface to which a {@link Starlink} instance is dispatched.
*/
@FunctionalInterface
public interface StarlinkPlugin extends Consumer<Starlink>, Comparable<StarlinkPlugin> {
Expand Down

0 comments on commit 730bd80

Please sign in to comment.