forked from AdoptOpenJDK/openjdk-api-v3
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Default the project type to jdk when none is provided (AdoptOpenJDK#113)
- Loading branch information
1 parent
2794a08
commit c6b4247
Showing
6 changed files
with
46 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
42 changes: 32 additions & 10 deletions
42
...api-v3-models/src/main/kotlin/net/adoptopenjdk/api/v3/dataSources/filters/BinaryFilter.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,24 +1,46 @@ | ||
package net.adoptopenjdk.api.v3.dataSources.filters | ||
|
||
import net.adoptopenjdk.api.v3.models.* | ||
import net.adoptopenjdk.api.v3.models.Architecture | ||
import net.adoptopenjdk.api.v3.models.Binary | ||
import net.adoptopenjdk.api.v3.models.HeapSize | ||
import net.adoptopenjdk.api.v3.models.ImageType | ||
import net.adoptopenjdk.api.v3.models.JvmImpl | ||
import net.adoptopenjdk.api.v3.models.OperatingSystem | ||
import net.adoptopenjdk.api.v3.models.Project | ||
import java.util.function.Predicate | ||
|
||
class BinaryFilter( | ||
private val os: OperatingSystem?, | ||
private val arch: Architecture?, | ||
private val imageType: ImageType?, | ||
private val jvmImpl: JvmImpl?, | ||
private val heapSize: HeapSize?, | ||
private val project: Project? | ||
) : Predicate<Binary> { | ||
class BinaryFilter : Predicate<Binary> { | ||
|
||
private val os: OperatingSystem? | ||
private val arch: Architecture? | ||
private val imageType: ImageType? | ||
private val jvmImpl: JvmImpl? | ||
private val heapSize: HeapSize? | ||
private val project: Project | ||
|
||
constructor( | ||
os: OperatingSystem?, | ||
arch: Architecture?, | ||
imageType: ImageType?, | ||
jvmImpl: JvmImpl?, | ||
heapSize: HeapSize?, | ||
project: Project? | ||
) { | ||
this.os = os | ||
this.arch = arch | ||
this.imageType = imageType | ||
this.jvmImpl = jvmImpl | ||
this.heapSize = heapSize | ||
this.project = project ?: Project.jdk | ||
} | ||
|
||
override fun test(binary: Binary): Boolean { | ||
return (os == null || binary.os == os) && | ||
(arch == null || binary.architecture == arch) && | ||
(imageType == null || binary.image_type == imageType) && | ||
(jvmImpl == null || binary.jvm_impl == jvmImpl) && | ||
(heapSize == null || binary.heap_size == heapSize) && | ||
(project == null || binary.project == project) | ||
(binary.project == project) | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters