reduce map operations
All checks were successful
Publish to snapshot maven / build (push) Successful in 20s
All checks were successful
Publish to snapshot maven / build (push) Successful in 20s
This commit is contained in:
parent
b8fc7bb9db
commit
579e99e26f
|
@ -8,20 +8,18 @@ import org.jetbrains.java.decompiler.struct.StructMethod
|
||||||
|
|
||||||
class ParchmentJavadocProvider(private val parchment: Parchment) : IFabricJavadocProvider {
|
class ParchmentJavadocProvider(private val parchment: Parchment) : IFabricJavadocProvider {
|
||||||
override fun getClassDoc(structClass: StructClass): String? {
|
override fun getClassDoc(structClass: StructClass): String? {
|
||||||
return parchment.getClass(structClass.qualifiedName).map { it.javadoc }.map { it.joinToString { "\n" } }
|
return parchment.getClass(structClass.qualifiedName).orElse(null)?.javadoc?.joinToString { "\n" }
|
||||||
.orElse(null)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun getFieldDoc(structClass: StructClass, structField: StructField): String? {
|
override fun getFieldDoc(structClass: StructClass, structField: StructField): String? {
|
||||||
return parchment.getClass(structClass.qualifiedName)
|
return parchment.getClass(structClass.qualifiedName)
|
||||||
.flatMap { it.getField(structField.name, structField.descriptor) }.map { it.javadoc }
|
.flatMap { it.getField(structField.name, structField.descriptor) }
|
||||||
.map { it.joinToString { "\n" } }
|
.orElse(null)?.javadoc?.joinToString { "\n" }
|
||||||
.orElse(null)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun getMethodDoc(structClass: StructClass, structMethod: StructMethod): String? {
|
override fun getMethodDoc(structClass: StructClass, structMethod: StructMethod): String? {
|
||||||
return parchment.getClass(structClass.qualifiedName)
|
return parchment.getClass(structClass.qualifiedName)
|
||||||
.flatMap { it.getMethod(structMethod.name, structMethod.descriptor) }
|
.flatMap { it.getMethod(structMethod.name, structMethod.descriptor) }
|
||||||
.map { it.javadoc }.map { it.joinToString { "\n" } }.orElse(null)
|
.orElse(null)?.javadoc?.joinToString { "\n" }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue