Is there a way to customize the JavaDoc template for a specific project?

已回答

I'm writing an addon to something that automatically generates documentation from the javadoc of methods, using some custom params to do it. So in this project I'd like to be able to include one of the custom param(@docParam) for each field, like @param already does, but not change the template for other projects I'm working on

0

Any way to change the default javadoc for methods with a certain annotation(like @Override does) would also work

0
Hi,

Please elaborate on your question.

> I'm writing an addon

Is it a plugin for IDEA or a stand-alone program? Can you show some examples for the @docParam?
0

It's a minecraft mod(crafttweaker), and @docParam looks like @docParam paramName value, where the value is used for an example of the code on the documentation

0

for a more detailed example, here's something from my code:

    /**
     *
     * @param name The name of the recipe
     * @param output The output item
     * @param topItem The item in the top slot
     * @param middleItem The item in the middle slot
     * @param bottomItem The item in the bottom slot
     * @param consumeSideInputs Whether the top and bottom inputs are consumed
     * @docParam name "gravel_compacting"
     * @docParam output <item:minecraft:cobblestone>
     * @docParam topItem <item:minecraft:gravel>
     * @docParam middleItem <item:minecraft:gravel>
     * @docParam bottomItem <item:minecraft:gravel>
     * @docParam consumeSideInputs
     */
    @ZenCodeType.Method
    public void addRecipe(String name, IItemStack output, IIngredient topItem, IIngredient middleItem, @ZenCodeType.Optional("<item:minecraft:air>") IIngredient bottomItem, @ZenCodeType.OptionalBoolean(true) boolean consumeSideInputs) {
        ResourceLocation location = ResourceLocation.parse("crafttweaker:" + name);
        InscriberProcessType processType = consumeSideInputs ? InscriberProcessType.PRESS : InscriberProcessType.INSCRIBE;
        InscriberRecipe recipe = new InscriberRecipe(middleItem.asVanillaIngredient(), output.getImmutableInternal(), topItem.asVanillaIngredient(), bottomItem.asVanillaIngredient(), processType);
        RecipeHolder<InscriberRecipe> holder = new RecipeHolder<>(location, recipe);
        CraftTweakerAPI.apply(new ActionAddRecipe<>(this, holder));
    }
0

The specific annotation I'd need to check for is that @ZenCodeType.Method

0

Hello, am I correct that you want IDEA to generate the Javadoc for the methods? Please try this menu File | Settings | Editor | File and Code Templates , then choose the Scheme to Project and switch to tab Code then you can modify the default Javadoc template, however at present there no macros for the annotations. Maybe I can create an feature request for you?

0

Yes, that would be nice, thank you. I've already edited the template, I was just asking if there was a way to do it per project so I didn't get the extra parameters while working on something else

0

Hello, since we choose the Scheme to Project, then this settings will only affect the current project, other projects will not be affected.

0

请先登录再写评论。