mirror of
https://github.com/octoleo/plantuml.git
synced 2024-11-29 16:23:55 +00:00
add support for Protocol and Struct in class diagram
This commit is contained in:
parent
a5952259b7
commit
2b337ac940
@ -80,7 +80,7 @@ public class CommandCreateClass extends SingleLineCommand2<ClassDiagram> {
|
||||
private static IRegex getRegexConcat() {
|
||||
return RegexConcat.build(CommandCreateClass.class.getName(), RegexLeaf.start(), //
|
||||
new RegexLeaf("TYPE", //
|
||||
"(interface|enum|annotation|abstract[%s]+class|abstract|class|entity|circle|diamond)"), //
|
||||
"(interface|enum|annotation|abstract[%s]+class|abstract|class|entity|circle|diamond|protocol|struct)"), //
|
||||
RegexLeaf.spaceOneOrMore(), //
|
||||
new RegexOr(//
|
||||
new RegexConcat(//
|
||||
|
@ -92,7 +92,7 @@ public class CommandCreateClassMultilines extends CommandMultilines2<ClassDiagra
|
||||
private static IRegex getRegexConcat() {
|
||||
return RegexConcat.build(CommandCreateClassMultilines.class.getName(), RegexLeaf.start(), //
|
||||
new RegexLeaf("VISIBILITY", "(" + VisibilityModifier.regexForVisibilityCharacterInClassName() + ")?"), //
|
||||
new RegexLeaf("TYPE", "(interface|enum|annotation|abstract[%s]+class|abstract|class|entity)"), //
|
||||
new RegexLeaf("TYPE", "(interface|enum|annotation|abstract[%s]+class|abstract|class|entity|protocol|struct)"), //
|
||||
RegexLeaf.spaceOneOrMore(), //
|
||||
new RegexOr(//
|
||||
new RegexConcat(//
|
||||
|
@ -163,6 +163,10 @@ public class CommandHideShowByGender extends SingleLineCommand2<UmlDiagram> {
|
||||
gender = EntityGenderUtils.byEntityType(LeafType.ABSTRACT_CLASS);
|
||||
} else if (arg1.equalsIgnoreCase("annotation")) {
|
||||
gender = EntityGenderUtils.byEntityType(LeafType.ANNOTATION);
|
||||
} else if (arg1.equalsIgnoreCase("protocol")) {
|
||||
gender = EntityGenderUtils.byEntityType(LeafType.PROTOCOL);
|
||||
} else if (arg1.equalsIgnoreCase("struct")) {
|
||||
gender = EntityGenderUtils.byEntityType(LeafType.STRUCT);
|
||||
} else if (arg1.startsWith("<<")) {
|
||||
gender = EntityGenderUtils.byStereotype(arg1);
|
||||
} else {
|
||||
|
@ -95,7 +95,7 @@ final public class CommandLinkLollipop extends SingleLineCommand2<AbstractClassO
|
||||
|
||||
private static String optionalKeywords(UmlDiagramType type) {
|
||||
if (type == UmlDiagramType.CLASS) {
|
||||
return "(interface|enum|annotation|abstract[%s]+class|abstract|class|entity)";
|
||||
return "(interface|enum|annotation|abstract[%s]+class|abstract|class|entity|protocol|struct)";
|
||||
}
|
||||
if (type == UmlDiagramType.OBJECT) {
|
||||
return "(object)";
|
||||
|
@ -42,7 +42,9 @@ public enum LeafType {
|
||||
|
||||
EMPTY_PACKAGE,
|
||||
|
||||
ABSTRACT_CLASS, CLASS, INTERFACE, ANNOTATION, LOLLIPOP_FULL, LOLLIPOP_HALF, NOTE, TIPS, OBJECT, MAP, JSON, ASSOCIATION,
|
||||
ABSTRACT_CLASS, CLASS, INTERFACE, ANNOTATION,
|
||||
PROTOCOL, STRUCT,
|
||||
LOLLIPOP_FULL, LOLLIPOP_HALF, NOTE, TIPS, OBJECT, MAP, JSON, ASSOCIATION,
|
||||
ENUM, CIRCLE,
|
||||
|
||||
USECASE, USECASE_BUSINESS,
|
||||
@ -76,7 +78,8 @@ public enum LeafType {
|
||||
|
||||
public boolean isLikeClass() {
|
||||
return this == LeafType.ANNOTATION || this == LeafType.ABSTRACT_CLASS || this == LeafType.CLASS
|
||||
|| this == LeafType.INTERFACE || this == LeafType.ENUM || this == LeafType.ENTITY;
|
||||
|| this == LeafType.INTERFACE || this == LeafType.ENUM || this == LeafType.ENTITY
|
||||
|| this == LeafType.PROTOCOL || this == LeafType.STRUCT;
|
||||
}
|
||||
|
||||
public String toHtml() {
|
||||
|
@ -139,6 +139,8 @@ public enum SName {
|
||||
spotAnnotation, //
|
||||
spotInterface, //
|
||||
spotEnum, //
|
||||
spotProtocol, //
|
||||
spotStruct, //
|
||||
spotEntity, //
|
||||
spotClass, //
|
||||
spotAbstractClass, //
|
||||
|
@ -194,6 +194,10 @@ public class EntityImageClassHeader extends AbstractEntityImage {
|
||||
return StyleSignatureBasic.of(SName.root, SName.element, SName.spot, SName.spotEnum);
|
||||
case ENTITY:
|
||||
return StyleSignatureBasic.of(SName.root, SName.element, SName.spot, SName.spotEntity);
|
||||
case PROTOCOL:
|
||||
return StyleSignatureBasic.of(SName.root, SName.element, SName.spot, SName.spotProtocol);
|
||||
case STRUCT:
|
||||
return StyleSignatureBasic.of(SName.root, SName.element, SName.spot, SName.spotStruct);
|
||||
}
|
||||
throw new IllegalStateException();
|
||||
}
|
||||
@ -212,6 +216,10 @@ public class EntityImageClassHeader extends AbstractEntityImage {
|
||||
return 'E';
|
||||
case ENTITY:
|
||||
return 'E';
|
||||
case PROTOCOL:
|
||||
return 'P';
|
||||
case STRUCT:
|
||||
return 'S';
|
||||
}
|
||||
assert false;
|
||||
return '?';
|
||||
|
Loading…
Reference in New Issue
Block a user