How to "define your own way of ordering fields and methods"?

+1 vote
asked Jul 1, 2015 in Bug by anonymous
I want to use a separator like __ to explicitly order my fields and my methods.

The reason is that some of my field types use parenthesis like const(C).

But I still want to be able to hide empty fields, empty methods, or empty members.

Now, with

    hide empty fields
    hide empty methods

    class C {
    foo
    __
    }
    class D {
    __
    bar()
    }
 

foo of C is hidden (why?) while the empty fields of D are not hidden.

How can this be done?

1 Answer

+2 votes
answered Jul 2, 2015 by plantuml (294,660 points)

Hello,

Thanks for the feedback. There is indeed a bug : in your example, foo of C should not have been hidden.

We have fixed this in the last beta: https://dl.dropboxusercontent.com/u/13064071/plantuml.jar

More over, we have introduced some new notations {field} and {method} to override the guess made by PlantUML using () to determine what is a method and what is a field.

For example:

@startuml
hide empty fields
hide empty methods

class A {
    a1
    __
    a2
    __
    a3
    __
    a4
}
class C {
  {method} foo
  foo2
}
class D {
  {field} bar()
  bar2()
}
@enduml

 

Is this better for you?

commented Jul 3, 2015 by linkrope (100 points)
Great!

The only pitfall is that {field} must be specified first, while the other modifiers like {static} may even follow the visibility character:

{field} -{static} bar()
commented Jul 3, 2015 by plantuml (294,660 points)
Ok, we fix this in the last beta:
https://dl.dropboxusercontent.com/u/13064071/plantuml.jar

Thanks for the feedback.
...