2626FEATURE_INSTANCE = ''
2727
2828
29- def to_puml_content (diagram_name : str , uml_items : List [UmlItem ], uml_relations : List [UmlRelation ]) -> Iterable [str ]:
29+ def to_puml_content (
30+ diagram_name : str , uml_items : List [UmlItem ], uml_relations : List [UmlRelation ], ** kwargs
31+ ) -> Iterable [str ]:
3032 yield PUML_FILE_START .format (diagram_name = diagram_name )
3133
3234 # exports the domain classes and enums
3335 for uml_item in uml_items :
36+ if 'is_block_valid' in kwargs and callable (kwargs ['is_block_valid' ]) and not kwargs ['is_block_valid' ](uml_item ):
37+ continue
3438 if isinstance (uml_item , UmlEnum ):
3539 uml_enum : UmlEnum = uml_item
3640 yield PUML_ITEM_START_TPL .format (item_type = 'enum' , item_fqn = uml_enum .fqn )
@@ -48,12 +52,27 @@ def to_puml_content(diagram_name: str, uml_items: List[UmlItem], uml_relations:
4852 attr_type = uml_attr .type ,
4953 staticity = FEATURE_STATIC if uml_attr .static else FEATURE_INSTANCE ,
5054 )
55+ for uml_method in uml_class .methods :
56+ if (
57+ 'is_method_valid' in kwargs
58+ and callable (kwargs ['is_method_valid' ])
59+ and not kwargs ['is_method_valid' ](uml_method )
60+ ):
61+ continue
62+
63+ yield f' { uml_method .represent_as_puml ()} \n '
5164 yield PUML_ITEM_END
5265 else :
5366 raise TypeError (f'cannot process uml_item of type { uml_item .__class__ } ' )
5467
5568 # exports the domain relationships between classes and enums
5669 for uml_relation in uml_relations :
70+ if (
71+ 'is_relation_valid' in kwargs
72+ and callable (kwargs ['is_relation_valid' ])
73+ and not kwargs ['is_relation_valid' ](uml_relation )
74+ ):
75+ continue
5776 yield PUML_RELATION_TPL .format (
5877 source_fqn = uml_relation .source_fqn , rel_type = uml_relation .type .value , target_fqn = uml_relation .target_fqn
5978 )
0 commit comments