Package de.spraener.nxtgen.target
Class CodeSnippet
java.lang.Object
de.spraener.nxtgen.target.CodeSnippet
- Direct Known Subclasses:
CodeBlockSnippet,SingleLineSnippet
Responsibility
A CodeSnippet is a atomar piece of code that can be referenced by an aspect
and an optional ModelElement. It can evaluate itself into a StringBuilder.
It always has an "aspect" this snippet is needed for, and it can have a ModelElement
for which this Snippet is also needed.
-
Constructor Summary
ConstructorsConstructorDescriptionCodeSnippet(Object aspect) Create a snippet to implement the given aspect.CodeSnippet(Object aspect, ModelElement me) Create a Snippet to implement the given aspect for the given ModelElement. -
Method Summary
Modifier and TypeMethodDescriptionabstract voidbooleanmatches(Object aspect, ModelElement me) Does this snippet match the given aspect and ModelElement?
-
Constructor Details
-
CodeSnippet
public CodeSnippet() -
CodeSnippet
Create a snippet to implement the given aspect. The ModelELement is set to null.- Parameters:
aspect- The aspect this snippet is needed for.
-
CodeSnippet
Create a Snippet to implement the given aspect for the given ModelElement. For example the snippet implements the JPA-Aspect for a MAttribute.- Parameters:
aspect- The aspect this snippet is needed for.me- The ModelElement this snippet is needed for.
-
-
Method Details
-
evaluate
-
matches
Does this snippet match the given aspect and ModelElement? If the snippet has no ModelElement it only matches requests with ModelElement parameter is null. A null-ModelElement on a snippet does not match any ModelElement-Parameter.- Parameters:
aspect- The Aspect to retrieve snippets forme- the ModelElement to retrieve snippets for or null.- Returns:
- TRUE if the snippet matches the given parameters
-
getAspect
-
getModelElement
-