mirror of
https://github.com/octoleo/plantuml.git
synced 2024-11-29 16:23:55 +00:00
Merge pull request #1056 from The-Lum/AddExceptionInClassDiag
Add support for `Exception` in class diagram
This commit is contained in:
commit
c5e44fbbb9
@ -205,6 +205,9 @@ spot {
|
|||||||
spotEntity {
|
spotEntity {
|
||||||
BackgroundColor #ADD1B2
|
BackgroundColor #ADD1B2
|
||||||
}
|
}
|
||||||
|
spotException {
|
||||||
|
BackgroundColor #D94321
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -551,6 +554,9 @@ spot {
|
|||||||
spotEntity {
|
spotEntity {
|
||||||
BackgroundColor #2E5233
|
BackgroundColor #2E5233
|
||||||
}
|
}
|
||||||
|
spotException {
|
||||||
|
BackgroundColor #7D0000
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -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|abstract|class|entity|circle|diamond|protocol|struct)"), //
|
"(interface|enum|annotation|abstract[%s]+class|abstract|class|entity|circle|diamond|protocol|struct|exception)"), //
|
||||||
RegexLeaf.spaceOneOrMore(), //
|
RegexLeaf.spaceOneOrMore(), //
|
||||||
new RegexOr(//
|
new RegexOr(//
|
||||||
new RegexConcat(//
|
new RegexConcat(//
|
||||||
|
@ -93,7 +93,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|abstract|class|entity|protocol|struct)"), //
|
"(interface|enum|annotation|abstract[%s]+class|abstract|class|entity|protocol|struct|exception)"), //
|
||||||
RegexLeaf.spaceOneOrMore(), //
|
RegexLeaf.spaceOneOrMore(), //
|
||||||
new RegexOr(//
|
new RegexOr(//
|
||||||
new RegexConcat(//
|
new RegexConcat(//
|
||||||
|
@ -131,6 +131,8 @@ public class CommandHideShowByGender extends SingleLineCommand2<UmlDiagram> {
|
|||||||
gender = EntityGenderUtils.byEntityType(LeafType.ABSTRACT_CLASS);
|
gender = EntityGenderUtils.byEntityType(LeafType.ABSTRACT_CLASS);
|
||||||
} else if (arg1.equalsIgnoreCase("annotation")) {
|
} else if (arg1.equalsIgnoreCase("annotation")) {
|
||||||
gender = EntityGenderUtils.byEntityType(LeafType.ANNOTATION);
|
gender = EntityGenderUtils.byEntityType(LeafType.ANNOTATION);
|
||||||
|
} else if (arg1.equalsIgnoreCase("exception")) {
|
||||||
|
gender = EntityGenderUtils.byEntityType(LeafType.EXCEPTION);
|
||||||
} else if (arg1.startsWith("<<")) {
|
} else if (arg1.startsWith("<<")) {
|
||||||
gender = EntityGenderUtils.byStereotype(arg1);
|
gender = EntityGenderUtils.byStereotype(arg1);
|
||||||
} else {
|
} else {
|
||||||
@ -167,6 +169,8 @@ public class CommandHideShowByGender extends SingleLineCommand2<UmlDiagram> {
|
|||||||
gender = EntityGenderUtils.byEntityType(LeafType.PROTOCOL);
|
gender = EntityGenderUtils.byEntityType(LeafType.PROTOCOL);
|
||||||
} else if (arg1.equalsIgnoreCase("struct")) {
|
} else if (arg1.equalsIgnoreCase("struct")) {
|
||||||
gender = EntityGenderUtils.byEntityType(LeafType.STRUCT);
|
gender = EntityGenderUtils.byEntityType(LeafType.STRUCT);
|
||||||
|
} else if (arg1.equalsIgnoreCase("exception")) {
|
||||||
|
gender = EntityGenderUtils.byEntityType(LeafType.EXCEPTION);
|
||||||
} else if (arg1.startsWith("<<")) {
|
} else if (arg1.startsWith("<<")) {
|
||||||
gender = EntityGenderUtils.byStereotype(arg1);
|
gender = EntityGenderUtils.byStereotype(arg1);
|
||||||
} else {
|
} else {
|
||||||
|
@ -95,7 +95,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)";
|
return "(interface|enum|annotation|abstract[%s]+class|abstract|class|entity|protocol|struct|exception)";
|
||||||
}
|
}
|
||||||
if (type == UmlDiagramType.OBJECT) {
|
if (type == UmlDiagramType.OBJECT) {
|
||||||
return "(object)";
|
return "(object)";
|
||||||
|
@ -44,6 +44,7 @@ public enum LeafType {
|
|||||||
|
|
||||||
ABSTRACT_CLASS, CLASS, INTERFACE, ANNOTATION,
|
ABSTRACT_CLASS, CLASS, INTERFACE, ANNOTATION,
|
||||||
PROTOCOL, STRUCT,
|
PROTOCOL, STRUCT,
|
||||||
|
EXCEPTION,
|
||||||
LOLLIPOP_FULL, LOLLIPOP_HALF, NOTE, TIPS, OBJECT, MAP, JSON, ASSOCIATION,
|
LOLLIPOP_FULL, LOLLIPOP_HALF, NOTE, TIPS, OBJECT, MAP, JSON, ASSOCIATION,
|
||||||
ENUM, CIRCLE,
|
ENUM, CIRCLE,
|
||||||
|
|
||||||
@ -79,7 +80,7 @@ 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.PROTOCOL || this == LeafType.STRUCT || this == LeafType.EXCEPTION;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String toHtml() {
|
public String toHtml() {
|
||||||
|
@ -143,6 +143,7 @@ public enum SName {
|
|||||||
spotProtocol, //
|
spotProtocol, //
|
||||||
spotStruct, //
|
spotStruct, //
|
||||||
spotEntity, //
|
spotEntity, //
|
||||||
|
spotException, //
|
||||||
spotClass, //
|
spotClass, //
|
||||||
spotAbstractClass, //
|
spotAbstractClass, //
|
||||||
|
|
||||||
|
@ -198,6 +198,8 @@ public class EntityImageClassHeader extends AbstractEntityImage {
|
|||||||
return StyleSignatureBasic.of(SName.root, SName.element, SName.spot, SName.spotProtocol);
|
return StyleSignatureBasic.of(SName.root, SName.element, SName.spot, SName.spotProtocol);
|
||||||
case STRUCT:
|
case STRUCT:
|
||||||
return StyleSignatureBasic.of(SName.root, SName.element, SName.spot, SName.spotStruct);
|
return StyleSignatureBasic.of(SName.root, SName.element, SName.spot, SName.spotStruct);
|
||||||
|
case EXCEPTION:
|
||||||
|
return StyleSignatureBasic.of(SName.root, SName.element, SName.spot, SName.spotException);
|
||||||
}
|
}
|
||||||
throw new IllegalStateException();
|
throw new IllegalStateException();
|
||||||
}
|
}
|
||||||
@ -220,6 +222,8 @@ public class EntityImageClassHeader extends AbstractEntityImage {
|
|||||||
return 'P';
|
return 'P';
|
||||||
case STRUCT:
|
case STRUCT:
|
||||||
return 'S';
|
return 'S';
|
||||||
|
case EXCEPTION:
|
||||||
|
return 'X';
|
||||||
}
|
}
|
||||||
assert false;
|
assert false;
|
||||||
return '?';
|
return '?';
|
||||||
|
Loading…
Reference in New Issue
Block a user