Skip to content

Commit e7c0d93

Browse files
committed
Improve android support
1 parent b7b46f0 commit e7c0d93

File tree

4 files changed

+14
-0
lines changed

4 files changed

+14
-0
lines changed

sass-embedded-host/src/main/java/de/larsgrefer/sass/embedded/functions/BiFunctionHostFunction.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package de.larsgrefer.sass.embedded.functions;
22

3+
import androidx.annotation.RequiresApi;
34
import com.sass_lang.embedded_protocol.Value;
45

56
import javax.annotation.Nonnull;
@@ -11,6 +12,7 @@
1112
/**
1213
* @author Lars Grefer
1314
*/
15+
@RequiresApi(24)
1416
class BiFunctionHostFunction<T, U> extends HostFunction {
1517

1618
private static final List<Argument> args = Collections.unmodifiableList(Arrays.asList(

sass-embedded-host/src/main/java/de/larsgrefer/sass/embedded/functions/FunctionHostFunction.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package de.larsgrefer.sass.embedded.functions;
22

3+
import androidx.annotation.RequiresApi;
34
import com.sass_lang.embedded_protocol.Value;
45

56
import javax.annotation.Nonnull;
@@ -10,6 +11,7 @@
1011
/**
1112
* @author Lars Grefer
1213
*/
14+
@RequiresApi(24)
1315
class FunctionHostFunction<T> extends HostFunction {
1416

1517
private static final List<Argument> args = Collections.singletonList(

sass-embedded-host/src/main/java/de/larsgrefer/sass/embedded/functions/HostFunctionFactory.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package de.larsgrefer.sass.embedded.functions;
22

3+
import androidx.annotation.RequiresApi;
34
import lombok.experimental.UtilityClass;
45

56
import javax.annotation.Nonnull;
@@ -17,14 +18,17 @@
1718
@UtilityClass
1819
public class HostFunctionFactory {
1920

21+
@RequiresApi(26)
2022
public <T> List<HostFunction> allSassFunctions(@Nonnull T object) {
2123
return allSassFunctions((Class<T>) object.getClass(), object);
2224
}
2325

26+
@RequiresApi(26)
2427
public List<HostFunction> allSassFunctions(@Nonnull Class<?> clazz) {
2528
return allSassFunctions(clazz, null);
2629
}
2730

31+
@RequiresApi(26)
2832
public <T> List<HostFunction> allSassFunctions(@Nonnull Class<T> clazz, @Nullable T object) {
2933
List<HostFunction> result = new ArrayList<>();
3034

@@ -39,10 +43,12 @@ public <T> List<HostFunction> allSassFunctions(@Nonnull Class<T> clazz, @Nullabl
3943
return result;
4044
}
4145

46+
@RequiresApi(26)
4247
public HostFunction ofMethod(Method method) {
4348
return ofMethod(method, null);
4449
}
4550

51+
@RequiresApi(26)
4652
public HostFunction ofMethod(@Nonnull Method method, @Nullable Object targetObject) {
4753
return new ReflectiveHostFunction(method, targetObject);
4854
}
@@ -51,10 +57,12 @@ public HostFunction ofLambda(String name, Callable<?> lambda) {
5157
return new CallableHostFunction(name, lambda);
5258
}
5359

60+
@RequiresApi(24)
5461
public <T> HostFunction ofLambda(String name, Class<T> argType, Function<T, ?> lambda) {
5562
return new FunctionHostFunction<>(name, argType, lambda);
5663
}
5764

65+
@RequiresApi(24)
5866
public <T, U> HostFunction ofLambda(String name, Class<T> arg0Type, Class<U> arg1Type, BiFunction<T, U, ?> lambda) {
5967
return new BiFunctionHostFunction<>(name, arg0Type, arg1Type, lambda);
6068
}

sass-embedded-host/src/main/java/de/larsgrefer/sass/embedded/functions/ReflectiveHostFunction.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package de.larsgrefer.sass.embedded.functions;
22

3+
import androidx.annotation.RequiresApi;
34
import com.sass_lang.embedded_protocol.Value;
45

56
import javax.annotation.Nonnull;
@@ -15,6 +16,7 @@
1516
/**
1617
* @author Lars Grefer
1718
*/
19+
@RequiresApi(26)
1820
class ReflectiveHostFunction extends HostFunction {
1921

2022
private final Method method;

0 commit comments

Comments
 (0)