public abstract class AbstractChartWriter extends Object implements Closeable
ChartOuterClass.ChartOrBuilder
.write(ChartOuterClass.ChartOrBuilder)
Modifier and Type | Class and Description |
---|---|
protected static class |
AbstractChartWriter.Context
A class representing the state of a write operation.
|
Modifier | Constructor and Description |
---|---|
protected |
AbstractChartWriter()
Creates a new
AbstractChartWriter . |
Modifier and Type | Method and Description |
---|---|
protected void |
beginWrite(AbstractChartWriter.Context context,
ChartOuterClass.ChartOrBuilder parent,
ChartOuterClass.ChartOrBuilder chartBuilder)
A callback method invoked when the
write(Context,
ChartOuterClass.ChartOrBuilder, ChartOuterClass.ChartOrBuilder)
method has been invoked. |
protected Yaml |
createYaml()
Creates and returns a new
Yaml instance for (optional)
use in writing ConfigOuterClass.ConfigOrBuilder and MetadataOuterClass.MetadataOrBuilder objects. |
protected void |
endWrite(AbstractChartWriter.Context context,
ChartOuterClass.ChartOrBuilder parent,
ChartOuterClass.ChartOrBuilder chartBuilder)
A callback method invoked when the
write(Context,
ChartOuterClass.ChartOrBuilder, ChartOuterClass.ChartOrBuilder) method has been invoked and it
is time to end the write operation. |
protected String |
toYAML(AbstractChartWriter.Context context,
Object data)
Marshals the supplied
Object to YAML in the context of
the supplied AbstractChartWriter.Context and returns the result. |
protected void |
write(AbstractChartWriter.Context context,
ChartOuterClass.ChartOrBuilder parent,
ChartOuterClass.ChartOrBuilder chartBuilder)
Writes or serializes or otherwise represents the supplied
chartBuilder as a subchart of the supplied parent (which
may be, and often is, null ). |
void |
write(ChartOuterClass.ChartOrBuilder chartBuilder)
Writes or serializes or otherwise represents the supplied
ChartOuterClass.ChartOrBuilder . |
protected abstract void |
writeConfig(AbstractChartWriter.Context context,
ConfigOuterClass.ConfigOrBuilder config)
A callback method invoked when the
write(Context,
ChartOuterClass.ChartOrBuilder, ChartOuterClass.ChartOrBuilder) method has been invoked and it
is time to write a relevant ConfigOuterClass.ConfigOrBuilder object. |
protected abstract void |
writeFile(AbstractChartWriter.Context context,
AnyOrBuilder file)
A callback method invoked when the
write(Context,
ChartOuterClass.ChartOrBuilder, ChartOuterClass.ChartOrBuilder) method has been invoked and it
is time to write a relevant AnyOrBuilder object
(representing an otherwise undifferentiated Helm chart file). |
protected abstract void |
writeMetadata(AbstractChartWriter.Context context,
MetadataOuterClass.MetadataOrBuilder metadata)
A callback method invoked when the
write(Context,
ChartOuterClass.ChartOrBuilder, ChartOuterClass.ChartOrBuilder) method has been invoked and it
is time to write a relevant MetadataOuterClass.MetadataOrBuilder object. |
protected void |
writeSubchart(AbstractChartWriter.Context context,
ChartOuterClass.ChartOrBuilder parent,
ChartOuterClass.ChartOrBuilder subchart)
A callback method invoked when the
write(Context,
ChartOuterClass.ChartOrBuilder, ChartOuterClass.ChartOrBuilder) method has been invoked and it
is time to write a relevant ChartOuterClass.ChartOrBuilder object
(representing a subchart within an encompassing parent Helm
chart). |
protected abstract void |
writeTemplate(AbstractChartWriter.Context context,
TemplateOuterClass.TemplateOrBuilder template)
A callback method invoked when the
write(Context,
ChartOuterClass.ChartOrBuilder, ChartOuterClass.ChartOrBuilder) method has been invoked and it
is time to write a relevant TemplateOuterClass.TemplateOrBuilder object. |
protected AbstractChartWriter()
AbstractChartWriter
.public final void write(ChartOuterClass.ChartOrBuilder chartBuilder) throws IOException
ChartOuterClass.ChartOrBuilder
.chartBuilder
- the ChartOuterClass.ChartOrBuilder
to write; must not
be null
IOException
- if a write error occursNullPointerException
- if chartBuilder
is null
IllegalArgumentException
- if the ChartOuterClass.ChartOrBuilder.getMetadata()
method returns null
, or if
the MetadataOuterClass.MetadataOrBuilder.getName()
method returns null
, or if the MetadataOuterClass.MetadataOrBuilder.getVersion()
method
returns null
IllegalStateException
- if a subclass has overridden the
createYaml()
method to return null
and calls itwrite(Context, ChartOuterClass.ChartOrBuilder,
ChartOuterClass.ChartOrBuilder)
protected void write(AbstractChartWriter.Context context, ChartOuterClass.ChartOrBuilder parent, ChartOuterClass.ChartOrBuilder chartBuilder) throws IOException
chartBuilder
as a subchart of the supplied parent
(which
may be, and often is, null
).context
- the AbstractChartWriter.Context
representing the write
operation; may be null
parent
- the ChartOuterClass.ChartOrBuilder
functioning as the
parent chart; may be, and often is, null
; must not be
identical to the chartBuilder
parameter valuechartBuilder
- the ChartOuterClass.ChartOrBuilder
to actually write;
must not be null
; must not be identical to the parent
parameter valueIOException
- if a write error occursNullPointerException
- if chartBuilder
is null
IllegalArgumentException
- if parent
is
identical to chartBuilder
, or if the ChartOuterClass.ChartOrBuilder.getMetadata()
method returns null
, or if
the MetadataOuterClass.MetadataOrBuilder.getName()
method returns null
, or if the MetadataOuterClass.MetadataOrBuilder.getVersion()
method
returns null
IllegalStateException
- if a subclass has overridden the
createYaml()
method to return null
and calls itbeginWrite(Context, ChartOuterClass.ChartOrBuilder, ChartOuterClass.ChartOrBuilder)
,
writeMetadata(Context, MetadataOuterClass.MetadataOrBuilder)
,
writeConfig(Context, ConfigOuterClass.ConfigOrBuilder)
,
writeTemplate(Context, TemplateOuterClass.TemplateOrBuilder)
,
writeFile(Context, AnyOrBuilder)
,
writeSubchart(Context, ChartOuterClass.ChartOrBuilder, ChartOuterClass.ChartOrBuilder)
,
endWrite(Context, ChartOuterClass.ChartOrBuilder, ChartOuterClass.ChartOrBuilder)
protected Yaml createYaml()
Yaml
instance for (optional)
use in writing ConfigOuterClass.ConfigOrBuilder
and MetadataOuterClass.MetadataOrBuilder
objects.
This method never returns null
.
Overrides of this method must not return null
.
Behavior is undefined if overrides of this method interact with other methods defined by this class.
null
Yaml
instanceprotected final String toYAML(AbstractChartWriter.Context context, Object data) throws IOException
Object
to YAML in the context of
the supplied AbstractChartWriter.Context
and returns the result.
This method never returns null
.
This method may call the createYaml()
method.
context
- the AbstractChartWriter.Context
representing the write
operation; must not be null
data
- the Object
to convert to its YAML
representation; may be null
null
String
consisting of the
appropriate YAML represesentation of the supplied data
IOException
- if a YAML serialization error occursNullPointerException
- if context
is null
createYaml()
,
Yaml.dumpAsMap(Object)
protected void beginWrite(AbstractChartWriter.Context context, ChartOuterClass.ChartOrBuilder parent, ChartOuterClass.ChartOrBuilder chartBuilder) throws IOException
write(Context,
ChartOuterClass.ChartOrBuilder, ChartOuterClass.ChartOrBuilder)
method has been invoked.
The default implementation of this method does nothing.
context
- the AbstractChartWriter.Context
representing the write
operation; must not be null
parent
- the ChartOuterClass.ChartOrBuilder
functioning as the
parent chart; may be, and often is, null
; must not be
identical to the chartBuilder
parameter valuechartBuilder
- the ChartOuterClass.ChartOrBuilder
to actually write;
must not be null
; must not be identical to the parent
parameter valueIOException
- if a write error occursNullPointerException
- if either context
or chartBuilder
is null
IllegalArgumentException
- if parent
is
identical to chartBuilder
IllegalStateException
- if a subclass has overridden the
createYaml()
method to return null
and calls it
from this method for some reasonprotected abstract void writeMetadata(AbstractChartWriter.Context context, MetadataOuterClass.MetadataOrBuilder metadata) throws IOException
write(Context,
ChartOuterClass.ChartOrBuilder, ChartOuterClass.ChartOrBuilder)
method has been invoked and it
is time to write a relevant MetadataOuterClass.MetadataOrBuilder
object.context
- the AbstractChartWriter.Context
representing the write
operation; must not be null
metadata
- the MetadataOuterClass.MetadataOrBuilder
to write; must not
be null
IOException
- if a write error occursNullPointerException
- if either context
or
metadata
is null
IllegalStateException
- if a subclass has overridden the
createYaml()
method to return null
and calls it
from this methodprotected abstract void writeConfig(AbstractChartWriter.Context context, ConfigOuterClass.ConfigOrBuilder config) throws IOException
write(Context,
ChartOuterClass.ChartOrBuilder, ChartOuterClass.ChartOrBuilder)
method has been invoked and it
is time to write a relevant ConfigOuterClass.ConfigOrBuilder
object.context
- the AbstractChartWriter.Context
representing the write
operation; must not be null
config
- the ConfigOuterClass.ConfigOrBuilder
to write; must not
be null
IOException
- if a write error occursNullPointerException
- if either context
or
config
is null
IllegalStateException
- if a subclass has overridden the
createYaml()
method to return null
and calls it
from this methodprotected abstract void writeTemplate(AbstractChartWriter.Context context, TemplateOuterClass.TemplateOrBuilder template) throws IOException
write(Context,
ChartOuterClass.ChartOrBuilder, ChartOuterClass.ChartOrBuilder)
method has been invoked and it
is time to write a relevant TemplateOuterClass.TemplateOrBuilder
object.context
- the AbstractChartWriter.Context
representing the write
operation; must not be null
template
- the TemplateOuterClass.TemplateOrBuilder
to write; must not
be null
IOException
- if a write error occursNullPointerException
- if either context
or
template
is null
IllegalStateException
- if a subclass has overridden the
createYaml()
method to return null
and calls it
from this method for some reasonprotected abstract void writeFile(AbstractChartWriter.Context context, AnyOrBuilder file) throws IOException
write(Context,
ChartOuterClass.ChartOrBuilder, ChartOuterClass.ChartOrBuilder)
method has been invoked and it
is time to write a relevant AnyOrBuilder
object
(representing an otherwise undifferentiated Helm chart file).context
- the AbstractChartWriter.Context
representing the write
operation; must not be null
file
- the AnyOrBuilder
to write; must not be null
IOException
- if a write error occursNullPointerException
- if either context
or
file
is null
IllegalStateException
- if a subclass has overridden the
createYaml()
method to return null
and calls it
from this method for some reasonprotected void writeSubchart(AbstractChartWriter.Context context, ChartOuterClass.ChartOrBuilder parent, ChartOuterClass.ChartOrBuilder subchart) throws IOException
write(Context,
ChartOuterClass.ChartOrBuilder, ChartOuterClass.ChartOrBuilder)
method has been invoked and it
is time to write a relevant ChartOuterClass.ChartOrBuilder
object
(representing a subchart within an encompassing parent Helm
chart).
The default implementation of this method calls the write(Context, ChartOuterClass.ChartOrBuilder, ChartOuterClass.ChartOrBuilder)
method.
context
- the AbstractChartWriter.Context
representing the write
operation; must not be null
parent
- the ChartOuterClass.ChartOrBuilder
representing the Helm
chart that parents the subchart
parameter value; must not
be null
subchart
- the ChartOuterClass.ChartOrBuilder
representing the
subchart to write; must not be null
IOException
- if a write error occursNullPointerException
- if either context
or
parent
or subchart
is null
IllegalArgumentException
- if parent
is
identical to subchart
, or if the ChartOuterClass.ChartOrBuilder.getMetadata()
method returns null
when
invoked on either non-null
ChartOuterClass.ChartOrBuilder
, or if
the MetadataOuterClass.MetadataOrBuilder.getName()
method returns null
, or if the MetadataOuterClass.MetadataOrBuilder.getVersion()
method
returns null
IllegalStateException
- if a subclass has overridden the
createYaml()
method to return null
and calls it
from this method for some reasonwrite(Context, ChartOuterClass.ChartOrBuilder, ChartOuterClass.ChartOrBuilder)
protected void endWrite(AbstractChartWriter.Context context, ChartOuterClass.ChartOrBuilder parent, ChartOuterClass.ChartOrBuilder chartBuilder) throws IOException
write(Context,
ChartOuterClass.ChartOrBuilder, ChartOuterClass.ChartOrBuilder)
method has been invoked and it
is time to end the write operation.
The default implementation of this method does nothing.
context
- the AbstractChartWriter.Context
representing the write
operation; must not be null
parent
- the ChartOuterClass.ChartOrBuilder
representing the Helm
chart that parents the chartBuilder
parameter value; may be,
and often is, null
chartBuilder
- the ChartOuterClass.ChartOrBuilder
representing the
chart currently involved in the write operation; must not be
null
IOException
- if a write error occursNullPointerException
- if either context
or
chartBuilder
is null
IllegalArgumentException
- if parent
is
identical to chartBuilder
IllegalStateException
- if a subclass has overridden the
createYaml()
method to return null
and calls it
from this method for some reasonCopyright © 2017–2018, microBean. All rights reserved.