1
0
mirror of https://github.com/octoleo/plantuml.git synced 2024-05-30 07:00:48 +00:00

add support for MetaClass, Stereotype in class

This commit is contained in:
The-Lum 2022-10-18 20:00:25 +00:00
parent f0048de5b7
commit b2e2a2bbcd
8 changed files with 37 additions and 5 deletions

View File

@ -213,6 +213,12 @@ spot {
spotException { spotException {
BackgroundColor #D94321 BackgroundColor #D94321
} }
spotMetaClass {
BackgroundColor #CCCCCC
}
spotStereotype {
BackgroundColor #FF77FF
}
} }
@ -573,6 +579,12 @@ spot {
spotException { spotException {
BackgroundColor #7D0000 BackgroundColor #7D0000
} }
spotMetaClass {
BackgroundColor #7C7C7C
}
spotStereotype {
BackgroundColor #890089
}
} }

View File

@ -80,7 +80,7 @@ public class CommandCreateClass extends SingleLineCommand2<ClassDiagram> {
private static IRegex getRegexConcat() { private static IRegex getRegexConcat() {
return RegexConcat.build(CommandCreateClass.class.getName(), RegexLeaf.start(), // return RegexConcat.build(CommandCreateClass.class.getName(), RegexLeaf.start(), //
new RegexLeaf("TYPE", // new RegexLeaf("TYPE", //
"(interface|enum|annotation|abstract[%s]+class|static[%s]+class|abstract|class|entity|circle|diamond|protocol|struct|exception)"), // "(interface|enum|annotation|abstract[%s]+class|static[%s]+class|abstract|class|entity|circle|diamond|protocol|struct|exception|metaclass|stereotype)"), //
RegexLeaf.spaceOneOrMore(), // RegexLeaf.spaceOneOrMore(), //
new RegexOr(// new RegexOr(//
new RegexConcat(// new RegexConcat(//

View File

@ -95,7 +95,7 @@ public class CommandCreateClassMultilines extends CommandMultilines2<ClassDiagra
return RegexConcat.build(CommandCreateClassMultilines.class.getName(), RegexLeaf.start(), // return RegexConcat.build(CommandCreateClassMultilines.class.getName(), RegexLeaf.start(), //
new RegexLeaf("VISIBILITY", "(" + VisibilityModifier.regexForVisibilityCharacterInClassName() + ")?"), // new RegexLeaf("VISIBILITY", "(" + VisibilityModifier.regexForVisibilityCharacterInClassName() + ")?"), //
new RegexLeaf("TYPE", new RegexLeaf("TYPE",
"(interface|enum|annotation|abstract[%s]+class|static[%s]+class|abstract|class|entity|protocol|struct|exception)"), // "(interface|enum|annotation|abstract[%s]+class|static[%s]+class|abstract|class|entity|protocol|struct|exception|metaclass|stereotype)"), //
RegexLeaf.spaceOneOrMore(), // RegexLeaf.spaceOneOrMore(), //
new RegexOr(// new RegexOr(//
new RegexConcat(// new RegexConcat(//

View File

@ -137,6 +137,10 @@ public class CommandHideShowByGender extends SingleLineCommand2<UmlDiagram> {
gender = EntityGenderUtils.byEntityType(LeafType.STRUCT); gender = EntityGenderUtils.byEntityType(LeafType.STRUCT);
} else if (arg1.equalsIgnoreCase("exception")) { } else if (arg1.equalsIgnoreCase("exception")) {
gender = EntityGenderUtils.byEntityType(LeafType.EXCEPTION); gender = EntityGenderUtils.byEntityType(LeafType.EXCEPTION);
} else if (arg1.equalsIgnoreCase("metaclass")) {
gender = EntityGenderUtils.byEntityType(LeafType.METACLASS);
} else if (arg1.equalsIgnoreCase("stereotype")) {
gender = EntityGenderUtils.byEntityType(LeafType.STEREOTYPE);
} else if (arg1.startsWith("<<")) { } else if (arg1.startsWith("<<")) {
gender = EntityGenderUtils.byStereotype(arg1); gender = EntityGenderUtils.byStereotype(arg1);
} else { } else {
@ -175,6 +179,10 @@ public class CommandHideShowByGender extends SingleLineCommand2<UmlDiagram> {
gender = EntityGenderUtils.byEntityType(LeafType.STRUCT); gender = EntityGenderUtils.byEntityType(LeafType.STRUCT);
} else if (arg1.equalsIgnoreCase("exception")) { } else if (arg1.equalsIgnoreCase("exception")) {
gender = EntityGenderUtils.byEntityType(LeafType.EXCEPTION); gender = EntityGenderUtils.byEntityType(LeafType.EXCEPTION);
} else if (arg1.equalsIgnoreCase("metaclass")) {
gender = EntityGenderUtils.byEntityType(LeafType.METACLASS);
} else if (arg1.equalsIgnoreCase("stereotype")) {
gender = EntityGenderUtils.byEntityType(LeafType.STEREOTYPE);
} else if (arg1.startsWith("<<")) { } else if (arg1.startsWith("<<")) {
gender = EntityGenderUtils.byStereotype(arg1); gender = EntityGenderUtils.byStereotype(arg1);
} else { } else {

View File

@ -97,7 +97,7 @@ final public class CommandLinkLollipop extends SingleLineCommand2<AbstractClassO
private static String optionalKeywords(UmlDiagramType type) { private static String optionalKeywords(UmlDiagramType type) {
if (type == UmlDiagramType.CLASS) if (type == UmlDiagramType.CLASS)
return "(interface|enum|annotation|abstract[%s]+class|abstract|class|entity|protocol|struct|exception)"; return "(interface|enum|annotation|abstract[%s]+class|abstract|class|entity|protocol|struct|exception|metaclass|stereotype)";
if (type == UmlDiagramType.OBJECT) if (type == UmlDiagramType.OBJECT)
return "(object)"; return "(object)";

View File

@ -32,6 +32,7 @@
* Original Author: Arnaud Roques * Original Author: Arnaud Roques
* Contribution : Hisashi Miyashita * Contribution : Hisashi Miyashita
* Contribution : Serge Wenger * Contribution : Serge Wenger
* Contribution : The-Lum
* *
*/ */
package net.sourceforge.plantuml.cucadiagram; package net.sourceforge.plantuml.cucadiagram;
@ -42,7 +43,7 @@ public enum LeafType {
EMPTY_PACKAGE, EMPTY_PACKAGE,
ABSTRACT_CLASS, CLASS, INTERFACE, ANNOTATION, PROTOCOL, STRUCT, EXCEPTION, LOLLIPOP_FULL, LOLLIPOP_HALF, NOTE, TIPS, ABSTRACT_CLASS, CLASS, INTERFACE, ANNOTATION, PROTOCOL, STRUCT, EXCEPTION, METACLASS, STEREOTYPE, LOLLIPOP_FULL, LOLLIPOP_HALF, NOTE, TIPS,
OBJECT, MAP, JSON, ASSOCIATION, ENUM, CIRCLE, OBJECT, MAP, JSON, ASSOCIATION, ENUM, CIRCLE,
USECASE, USECASE_BUSINESS, USECASE, USECASE_BUSINESS,
@ -80,7 +81,8 @@ public enum LeafType {
public boolean isLikeClass() { public boolean isLikeClass() {
return this == LeafType.ANNOTATION || this == LeafType.ABSTRACT_CLASS || this == LeafType.CLASS 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 || this == LeafType.EXCEPTION; || this == LeafType.PROTOCOL || this == LeafType.STRUCT || this == LeafType.EXCEPTION
|| this == LeafType.METACLASS || this == LeafType.STEREOTYPE;
} }
public String toHtml() { public String toHtml() {

View File

@ -151,6 +151,8 @@ public enum SName {
spotException, // spotException, //
spotClass, // spotClass, //
spotAbstractClass, // spotAbstractClass, //
spotMetaClass, //
spotStereotype, //
wbsDiagram, // wbsDiagram, //
yamlDiagram; // yamlDiagram; //

View File

@ -199,6 +199,10 @@ public class EntityImageClassHeader extends AbstractEntityImage {
return StyleSignatureBasic.of(SName.root, SName.element, SName.spot, SName.spotStruct); return StyleSignatureBasic.of(SName.root, SName.element, SName.spot, SName.spotStruct);
case EXCEPTION: case EXCEPTION:
return StyleSignatureBasic.of(SName.root, SName.element, SName.spot, SName.spotException); return StyleSignatureBasic.of(SName.root, SName.element, SName.spot, SName.spotException);
case METACLASS:
return StyleSignatureBasic.of(SName.root, SName.element, SName.spot, SName.spotMetaClass);
case STEREOTYPE:
return StyleSignatureBasic.of(SName.root, SName.element, SName.spot, SName.spotStereotype);
} }
throw new IllegalStateException(); throw new IllegalStateException();
} }
@ -223,6 +227,10 @@ public class EntityImageClassHeader extends AbstractEntityImage {
return 'S'; return 'S';
case EXCEPTION: case EXCEPTION:
return 'X'; return 'X';
case METACLASS:
return 'M';
case STEREOTYPE:
return 'S';
} }
assert false; assert false;
return '?'; return '?';