Skip to content
Snippets Groups Projects
Commit e755be82 authored by Alberto Debiasi's avatar Alberto Debiasi
Browse files

Merge remote-tracking branch 'origin/master' into neon

parents 2ca2327f 7b84cb30
No related branches found
No related tags found
No related merge requests found
......@@ -4033,6 +4033,14 @@ public class EntityUtil {
return null;
}
/**
* Returns the first operation found with the given name.
* <br>
* This is a very trivial method, no additional checks are done.
* @param operationName the name of the Operation
* @param block the owner class
* @return the Operation
*/
public Operation getOperation(String operationName, Class block) {
return block.getOwnedOperation(operationName, null, null);
// logger.debug("getOperationType: " + block + " , " + operationName);
......@@ -4046,6 +4054,18 @@ public class EntityUtil {
// return null;
}
/**
* Returns the first property found with the given name.
* <br>
* This is a very trivial method, no additional checks are done.
* @param propertyName the name of the Property
* @param block the owner class
* @return the Property
*/
public Property getProperty(String propertyName, Class block) {
return block.getOwnedAttribute(propertyName, null);
}
public boolean isAttribute(String attributeName, Class blockAsClass) {
if (blockAsClass != null) {
Property umlProperty = blockAsClass.getOwnedAttribute(attributeName, null);
......@@ -4316,5 +4336,43 @@ public class EntityUtil {
return result;
}
/**
* Returns true if the visibility of the given element is private.
* @param e the NamedElement
* @return
* @throws Exception in case no visibility is set
*/
public boolean isVisibilityPrivate(NamedElement e) throws Exception {
if (e.isSetVisibility()) {
return (e.getVisibility() == VisibilityKind.PRIVATE_LITERAL);
}
throw new Exception("Element does not have any visibility");
}
/**
* Returns true if the visibility of the given element is priprotected.
* @param e the NamedElement
* @return
* @throws Exception in case no visibility is set
*/
public boolean isVisibilityProtected(NamedElement e) throws Exception {
if (e.isSetVisibility()) {
return (e.getVisibility() == VisibilityKind.PROTECTED_LITERAL);
}
throw new Exception("Element does not have any visibility");
}
/**
* Returns true if the visibility of the given element is public.
* @param e the NamedElement
* @return
* @throws Exception in case no visibility is set
*/
public boolean isVisibilityPublic(NamedElement e) throws Exception {
if (e.isSetVisibility()) {
return (e.getVisibility() == VisibilityKind.PUBLIC_LITERAL);
}
throw new Exception("Element does not have any visibility");
}
}
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment