frankframework / frank-doc

Frank!Doc
https://frankdoc.frankframework.org
Apache License 2.0
4 stars 5 forks source link

Make FrankDocGroup less errorprone #161

Closed nielsm5 closed 4 months ago

nielsm5 commented 1 year ago

Right now the FrankDocGroup annotation can be 're-introduced' with the same name but a different 'order' value. In order to reduce this risk, a fixed set of group entries should be created (using an Enum) with their order.

mhdirkse commented 1 year ago

Shall we use the @EnumLabel annotation to set the captions of the Frank!Doc groups? If we do it this way, we do not have to introduce final fields within the enum type. Doing so would be more work because the wrapper API has to be extended.

mhdirkse commented 1 year ago

In my proposal, the wrapper API has to be extended to give the order of the enum constants within their type. This is probably a small change.

mhdirkse commented 1 year ago

I see that in the wrapper API, a FrankEnumConstant object knows its position within the enum. That is enough if we only make Frank!Doc groups for enum constants that are actually used. Do we want an empty group if there is an enum constant that is never applied?

mhdirkse commented 1 year ago

The enum that holds the groups should also have an enum constant for the "Other" group, the default group for FrankElement-s. How do we document in the groups enum which enum constant is for "Other"? I see three options:

I propose to add a new parameter to the doclet anyway - it is the class name of the enum that holds the groups.

nielsm5 commented 1 year ago

Let's not overcomplicate things for now.

Right now the annotation is always used in combination with a name. That should change to an Enum. The order will be the enum's ordinal value.

Something like:

@Documented
@Retention(RetentionPolicy.RUNTIME)
public @interface FrankDocGroup {
    FrankGroup value();

    public enum FrankGroup {
        LISTENER,
        SENDER; //etc.
    }
}