Skip to content

Commit bb27bca

Browse files
committed
Add some common 'negative' access matchers
1 parent 99cfc6d commit bb27bca

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

class-match/src/main/java/datadog/instrument/classmatch/AccessMatcher.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,15 @@ public interface AccessMatcher extends IntPredicate {
2828
/** Matches static access. */
2929
AccessMatcher STATIC = Modifier::isStatic;
3030

31+
/** Matches non-static access. */
32+
AccessMatcher NON_STATIC = acc -> (acc & Modifier.STATIC) == 0;
33+
3134
/** Matches final classes/methods/fields. */
3235
AccessMatcher FINAL = Modifier::isFinal;
3336

37+
/** Matches non-final classes/methods/fields. */
38+
AccessMatcher NON_FINAL = acc -> (acc & Modifier.FINAL) == 0;
39+
3440
/** Matches synchronized methods. */
3541
AccessMatcher SYNCHRONIZED = Modifier::isSynchronized;
3642

@@ -46,9 +52,15 @@ public interface AccessMatcher extends IntPredicate {
4652
/** Matches interface classes. */
4753
AccessMatcher INTERFACE = Modifier::isInterface;
4854

55+
/** Matches non-interface classes. */
56+
AccessMatcher CLASS = acc -> (acc & Modifier.INTERFACE) == 0;
57+
4958
/** Matches abstract classes. */
5059
AccessMatcher ABSTRACT = Modifier::isAbstract;
5160

61+
/** Matches concrete (constructable) classes. */
62+
AccessMatcher CONCRETE = acc -> (acc & Modifier.ABSTRACT) == 0;
63+
5264
/**
5365
* Conjunction of this matcher AND another.
5466
*

0 commit comments

Comments
 (0)