Java: Replace '.prefix'/'.suffix' with '.matches'.

This commit is contained in:
Mathias Vorreiter Pedersen
2021-10-13 13:19:06 +01:00
parent 5b13232a9d
commit d85d009a54
3 changed files with 5 additions and 5 deletions

View File

@@ -37,7 +37,7 @@ predicate isGigaSpacesEventMethod(Method eventMethod) {
class GigaSpacesSpaceIdGetterMethod extends Method {
GigaSpacesSpaceIdGetterMethod() {
getAnAnnotation().getType().hasQualifiedName("com.gigaspaces.annotation.pojo", "SpaceId") and
getName().prefix(3) = "get"
getName().matches("get%")
}
}
@@ -48,7 +48,7 @@ class GigaSpacesSpaceIdSetterMethod extends Method {
GigaSpacesSpaceIdSetterMethod() {
exists(GigaSpacesSpaceIdGetterMethod getterMethod |
getterMethod.getDeclaringType() = getDeclaringType() and
getName().prefix(3) = "set"
getName().matches("set%")
|
getterMethod.getName().suffix(3) = getName().suffix(3)
)
@@ -62,6 +62,6 @@ class GigaSpacesSpaceIdSetterMethod extends Method {
class GigaSpacesSpaceRoutingMethod extends Method {
GigaSpacesSpaceRoutingMethod() {
getAnAnnotation().getType().hasQualifiedName("com.gigaspaces.annotation.pojo", "SpaceRouting") and
getName().prefix(3) = "get"
getName().matches("get%")
}
}

View File

@@ -37,7 +37,7 @@ class SpringProfileExpr extends string {
* A Spring profile expression that begins with "!", indicating a negated expression.
*/
class NotSpringProfileExpr extends SpringProfileExpr {
NotSpringProfileExpr() { this.prefix(1) = "!" }
NotSpringProfileExpr() { this.matches("!%") }
/**
* Gets the profile described in this profile expression.

View File

@@ -129,7 +129,7 @@ class Pom extends ProtoPom {
* occurs by considering the properties defined by this project or an ancestor project.
*/
string resolvePlaceholder(string name) {
if name.prefix(8) = "project."
if name.matches("project.%")
then
exists(PomElement p |
p = getProjectProperty() and