mirror of
https://github.com/PolyhedralDev/Terra.git
synced 2025-07-03 00:15:35 +00:00
add AutoDocShadow
This commit is contained in:
parent
c87d0446d3
commit
be3e50411e
@ -94,6 +94,9 @@ tasks.create<SourceTask>("tectonicDocs") {
|
|||||||
if (declaration.isAnnotationPresent("AutoDocAlias")) {
|
if (declaration.isAnnotationPresent("AutoDocAlias")) {
|
||||||
refactor[name] = (declaration.getAnnotationByName("AutoDocAlias").get().childNodes[1] as StringLiteralExpr).asString()
|
refactor[name] = (declaration.getAnnotationByName("AutoDocAlias").get().childNodes[1] as StringLiteralExpr).asString()
|
||||||
println("Refactoring $name to ${refactor[name]}.")
|
println("Refactoring $name to ${refactor[name]}.")
|
||||||
|
} else if (declaration.isAnnotationPresent("AutoDocShadow")) {
|
||||||
|
refactor[name] = (declaration.getAnnotationByName("AutoDocShadow").get().childNodes[1] as StringLiteralExpr).asString()
|
||||||
|
println("Shadowing $name to ${refactor[name]}.")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -101,10 +104,12 @@ tasks.create<SourceTask>("tectonicDocs") {
|
|||||||
val children = HashMap<String, MutableList<ClassOrInterfaceDeclaration>>()
|
val children = HashMap<String, MutableList<ClassOrInterfaceDeclaration>>()
|
||||||
sources.forEach { (name, unit) ->
|
sources.forEach { (name, unit) ->
|
||||||
unit.getClassByName(name).ifPresent { declaration ->
|
unit.getClassByName(name).ifPresent { declaration ->
|
||||||
declaration.extendedTypes.forEach { classOrInterfaceType ->
|
if(!declaration.isAnnotationPresent("AutoDocShadow")) {
|
||||||
val inherit = classOrInterfaceType.name.asString()
|
declaration.extendedTypes.forEach { classOrInterfaceType ->
|
||||||
if (!children.containsKey(inherit)) children[inherit] = ArrayList()
|
val inherit = classOrInterfaceType.name.asString()
|
||||||
children[inherit]!!.add(declaration)
|
if (!children.containsKey(inherit)) children[inherit] = ArrayList()
|
||||||
|
children[inherit]!!.add(declaration)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -121,7 +126,7 @@ tasks.create<SourceTask>("tectonicDocs") {
|
|||||||
|
|
||||||
unit.getClassByName(name).ifPresent { declaration ->
|
unit.getClassByName(name).ifPresent { declaration ->
|
||||||
applicable = scanForParent(sources, declaration, "ConfigTemplate", "ValidatedConfigTemplate", "ObjectTemplate")
|
applicable = scanForParent(sources, declaration, "ConfigTemplate", "ValidatedConfigTemplate", "ObjectTemplate")
|
||||||
if(applicable) println("Validated $name")
|
|
||||||
declaration.javadoc.ifPresent {
|
declaration.javadoc.ifPresent {
|
||||||
doc.append("${sanitizeJavadoc(it.toText())} \n")
|
doc.append("${sanitizeJavadoc(it.toText())} \n")
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,17 @@
|
|||||||
|
package com.dfsek.terra.api.docs;
|
||||||
|
|
||||||
|
import java.lang.annotation.ElementType;
|
||||||
|
import java.lang.annotation.Retention;
|
||||||
|
import java.lang.annotation.RetentionPolicy;
|
||||||
|
import java.lang.annotation.Target;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* For use in Terra AutoDoc, to specify
|
||||||
|
* that references to the annotated class
|
||||||
|
* should be shadowed to the target class.
|
||||||
|
*/
|
||||||
|
@Retention(RetentionPolicy.SOURCE)
|
||||||
|
@Target(ElementType.TYPE)
|
||||||
|
public @interface AutoDocShadow {
|
||||||
|
String value();
|
||||||
|
}
|
@ -1,11 +1,11 @@
|
|||||||
package com.dfsek.terra.config.loaders.config.sampler.templates.noise;
|
package com.dfsek.terra.config.loaders.config.sampler.templates.noise;
|
||||||
|
|
||||||
import com.dfsek.terra.api.docs.AutoDocAlias;
|
import com.dfsek.terra.api.docs.AutoDocShadow;
|
||||||
import com.dfsek.terra.api.math.noise.samplers.noise.NoiseFunction;
|
import com.dfsek.terra.api.math.noise.samplers.noise.NoiseFunction;
|
||||||
|
|
||||||
import java.util.function.Function;
|
import java.util.function.Function;
|
||||||
|
|
||||||
@AutoDocAlias("NoiseFunction")
|
@AutoDocShadow("NoiseFunction")
|
||||||
public class SimpleNoiseTemplate extends NoiseTemplate<NoiseFunction> {
|
public class SimpleNoiseTemplate extends NoiseTemplate<NoiseFunction> {
|
||||||
private final Function<Integer, NoiseFunction> samplerSupplier;
|
private final Function<Integer, NoiseFunction> samplerSupplier;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user