Package org.pkl.core.stdlib
Class AbstractRenderer
java.lang.Object
org.pkl.core.stdlib.AbstractRenderer
- All Implemented Interfaces:
VmValueVisitor
- Direct Known Subclasses:
PcfRenderer,RendererNodes.Renderer
Base class for renderers that are part of the standard library.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final StringBuilderprotected final PklConverterprotected final StringBuilderThe current indent.protected @Nullable com.oracle.truffle.api.source.SourceSectionThe (closest)SourceSectionof the value being visited, for better error messages.The value directly enclosing the currently visited value, if any.protected final StringThe indent to be used.protected static final charprotected final StringThe name of this renderer. -
Constructor Summary
ConstructorsConstructorDescriptionAbstractRenderer(String name, StringBuilder builder, String indent, PklConverter converter, boolean skipNullProperties, boolean skipNullEntries) -
Method Summary
Modifier and TypeMethodDescriptionprotected voidprotected voidprotected booleancanRenderPropertyOrEntryOf(VmDynamic object) protected voidprotected abstract voidendDynamic(VmDynamic value, boolean isEmpty) protected abstract voidprotected abstract voidendListing(VmListing value, boolean isEmpty) protected abstract voidprotected abstract voidendMapping(VmMapping value, boolean isEmpty) protected abstract voidprotected abstract voidprotected voidfinal voidrenderDocument(Object value) final voidrenderValue(Object value) protected abstract voidstartDynamic(VmDynamic value) protected abstract voidprotected abstract voidstartListing(VmListing value) protected abstract voidprotected abstract voidstartMapping(VmMapping value) protected abstract voidprotected abstract voidstartTyped(VmTyped value) voidfinal voidvisitClass(VmClass value) protected abstract voidvisitDocument(Object value) final voidvisitDynamic(VmDynamic value) protected abstract voidvisitElement(long index, Object value, boolean isFirst) protected abstract voidvisitEntryKey(Object key, boolean isFirst) protected abstract voidvisitEntryValue(Object value) final voidvisitFunction(VmFunction value) final voidfinal voidvisitListing(VmListing value) final voidfinal voidvisitMapping(VmMapping value) protected abstract voidvisitProperty(Identifier name, Object value, boolean isFirst) protected abstract voidvisitRenderDirective(VmTyped value) Perform logic for rendering a render directive.final voidprotected abstract voidvisitTopLevelValue(Object value) final voidvisitTypeAlias(VmTypeAlias value) voidvisitTyped(VmTyped value) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.pkl.core.runtime.VmValueVisitor
visitBoolean, visitDataSize, visitDuration, visitFloat, visitInt, visitIntSeq, visitNull, visitPair, visitRegex, visitString
-
Field Details
-
LINE_BREAK
protected static final char LINE_BREAK- See Also:
-
name
The name of this renderer. -
builder
-
indent
The indent to be used. -
converter
-
currPath
-
enclosingValue
The value directly enclosing the currently visited value, if any. -
currIndent
The current indent. Modified byincreaseIndent()anddecreaseIndent(). -
currSourceSection
The (closest)SourceSectionof the value being visited, for better error messages.
-
-
Constructor Details
-
AbstractRenderer
public AbstractRenderer(String name, StringBuilder builder, String indent, PklConverter converter, boolean skipNullProperties, boolean skipNullEntries)
-
-
Method Details
-
renderDocument
-
renderValue
-
visit
- Specified by:
visitin interfaceVmValueVisitor
-
visitDocument
-
visitTopLevelValue
-
visitRenderDirective
Perform logic for rendering a render directive. Render directives should be rendered verbatim. -
startDynamic
-
startTyped
-
startListing
-
startMapping
-
startList
-
startSet
-
startMap
-
visitElement
-
visitEntryKey
-
visitEntryValue
-
visitProperty
-
endDynamic
-
endTyped
-
endListing
-
endMapping
-
endList
-
endSet
-
endMap
-
visitTyped
- Specified by:
visitTypedin interfaceVmValueVisitor
-
visitDynamic
- Specified by:
visitDynamicin interfaceVmValueVisitor
-
canRenderPropertyOrEntryOf
-
visitListing
- Specified by:
visitListingin interfaceVmValueVisitor
-
visitMapping
- Specified by:
visitMappingin interfaceVmValueVisitor
-
visitList
- Specified by:
visitListin interfaceVmValueVisitor
-
visitSet
- Specified by:
visitSetin interfaceVmValueVisitor
-
visitMap
- Specified by:
visitMapin interfaceVmValueVisitor
-
visitTypeAlias
- Specified by:
visitTypeAliasin interfaceVmValueVisitor
-
visitClass
- Specified by:
visitClassin interfaceVmValueVisitor
-
visitFunction
- Specified by:
visitFunctionin interfaceVmValueVisitor
-
cannotRenderTypeAddConverter
-
cannotRenderNonStringKey
-
increaseIndent
protected void increaseIndent() -
decreaseIndent
protected void decreaseIndent()
-