Class PythonCodeClass
java.lang.Object
net.ssehub.easy.instantiation.python.codeArtifacts.PythonCodeElement
net.ssehub.easy.instantiation.python.codeArtifacts.PythonCodeClass
- All Implemented Interfaces:
net.ssehub.easy.instantiation.core.model.vilTypes.IStringValueProvider,net.ssehub.easy.instantiation.core.model.vilTypes.IVilType,IPythonCodeElement,Storable
- Direct Known Subclasses:
PythonCodeEnum
Represents a Python "class" in VTL.
- Author:
- Kevin Schaperjahn
-
Nested Class Summary
Nested classes/interfaces inherited from interface net.ssehub.easy.instantiation.core.model.vilTypes.IStringValueProvider
net.ssehub.easy.instantiation.core.model.vilTypes.IStringValueProvider.StringComparator -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate List<PythonCodeTypeSpec> private PythonCodeDocCommentprivate List<IPythonCodeElement> private StringFields inherited from interface net.ssehub.easy.instantiation.python.codeArtifacts.IPythonCodeElement
KEY_COMPARATOR -
Constructor Summary
ConstructorsConstructorDescriptionPythonCodeClass(IPythonCodeElement parent, String name) Creates a class.PythonCodeClass(IPythonCodeElement parent, String name, String comment) Creates a class with comment. -
Method Summary
Modifier and TypeMethodDescriptionprotected <T extends IPythonCodeElement>
Tadd(T element) addAttribute(String name, String initExpr) addAttribute(String name, String type, String initExpr) addBase(String type, PythonCodeImportScope scope) addComment(String comment) addConstructor(String comment) addSLComment(String comment) addSLComment(String comment, boolean enclosed) getName()Returns the class name.(package private) static PythonCodeClassgetParentCodeClass(IPythonCodeElement element) booleanisClass()Returns whether this element is a class(-like) element.voidmoveToAttributes(IPythonCodeElement element) Moves the given code element after the last attribute at the beginning of (this) class, or, if there are no attributes, to the front.(package private) static voidsetParent(IPythonCodeElement parent, Consumer<PythonCodeClass> consumer) voidstore(net.ssehub.easy.instantiation.core.model.templateModel.CodeWriter out) voidstoreElements(net.ssehub.easy.instantiation.core.model.templateModel.CodeWriter out) Methods inherited from class net.ssehub.easy.instantiation.python.codeArtifacts.PythonCodeElement
getArtifact, getParent, setParentMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface net.ssehub.easy.instantiation.python.codeArtifacts.IPythonCodeElement
addAll, getSortKey, getStringValue, getTopClass, getTracerStringValue, hasPythondocComment, isAttribute, isBlock, isEmptyLine, moveToImportsMethods inherited from interface net.ssehub.easy.instantiation.python.codeArtifacts.Storable
getElementCount, toCode
-
Field Details
-
name
-
elements
-
bases
-
comment
-
-
Constructor Details
-
PythonCodeClass
PythonCodeClass(IPythonCodeElement parent, String name) Creates a class.- Parameters:
parent- the parent code elementname- the class name
-
PythonCodeClass
PythonCodeClass(IPythonCodeElement parent, String name, String comment) Creates a class with comment.- Parameters:
parent- the parent code elementname- the class namecomment- the comment
-
-
Method Details
-
getName
Returns the class name.- Returns:
- the class name
-
add
-
addEmptyLine
-
addClass
-
addAttribute
-
addAttribute
-
add
-
addBase
-
addBase
-
addMethod
-
addMethod
-
addGetter
-
addGetter
-
addSetter
-
addSetter
-
addConstructor
-
addConstructor
-
addComment
-
addSLComment
-
addSLComment
-
setParent
-
getParentCodeClass
-
store
public void store(net.ssehub.easy.instantiation.core.model.templateModel.CodeWriter out) -
storeElements
public void storeElements(net.ssehub.easy.instantiation.core.model.templateModel.CodeWriter out) -
isClass
public boolean isClass()Description copied from interface:IPythonCodeElementReturns whether this element is a class(-like) element.- Returns:
truefor class,falseelse
-
moveToAttributes
Description copied from interface:IPythonCodeElementMoves the given code element after the last attribute at the beginning of (this) class, or, if there are no attributes, to the front.- Parameters:
element- the element to move
-