Class AbstractViewReader
- java.lang.Object
-
- org.soulwing.prospecto.runtime.text.AbstractViewReader
-
- All Implemented Interfaces:
ViewReader
- Direct Known Subclasses:
JsonPViewReader
public abstract class AbstractViewReader extends Object implements ViewReader
An abstract base forViewReader
implementations.- Author:
- Carl Harris
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.soulwing.prospecto.api.ViewReader
ViewReader.Source
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
AbstractViewReader(Options options)
Constructs a new reader
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected void
beginArray(String name)
Adds aView.Event.Type.BEGIN_ARRAY
event to the view.protected void
beginArray(String name, String namespace)
Adds aView.Event.Type.BEGIN_ARRAY
event to the view.protected void
beginObject(String name)
Adds aView.Event.Type.BEGIN_OBJECT
event to the view.protected void
beginObject(String name, String namespace)
Adds aView.Event.Type.BEGIN_OBJECT
event to the view.protected void
discriminator(Object value)
Adds a subtype discriminator to the view.protected void
end()
Adds aView.Event.Type.END_OBJECT
orView.Event.Type.END_ARRAY
event to the view, depending on what was the lastbegin
Type invocation.Options
getOptions()
protected void
meta(String name, Object value)
Adds a metadata value to a view.protected void
nullValue(String name)
Adds a null value to the view.protected abstract void
onReadView()
Notifies the recipient that it should read the textual representation, invoking callbacks as necessary to create the event stream for the view.View
readView()
protected void
value(String name, Boolean value)
Adds a boolean value to the view.protected void
value(String name, Number value)
Adds a numeric value to the view.protected void
value(String name, String value)
Adds a string value to the view.
-
-
-
Constructor Detail
-
AbstractViewReader
protected AbstractViewReader(Options options)
Constructs a new reader- Parameters:
options
- configuration options
-
-
Method Detail
-
getOptions
public Options getOptions()
-
readView
public View readView() throws ViewException
- Specified by:
readView
in interfaceViewReader
- Throws:
ViewException
-
onReadView
protected abstract void onReadView() throws Exception
Notifies the recipient that it should read the textual representation, invoking callbacks as necessary to create the event stream for the view.- Throws:
Exception
-
beginObject
protected final void beginObject(String name)
Adds aView.Event.Type.BEGIN_OBJECT
event to the view.- Parameters:
name
- name of the object
-
beginObject
protected final void beginObject(String name, String namespace)
Adds aView.Event.Type.BEGIN_OBJECT
event to the view.- Parameters:
name
- name of the object
-
beginArray
protected final void beginArray(String name)
Adds aView.Event.Type.BEGIN_ARRAY
event to the view.- Parameters:
name
- name of the object
-
beginArray
protected final void beginArray(String name, String namespace)
Adds aView.Event.Type.BEGIN_ARRAY
event to the view.- Parameters:
name
- name of the object
-
end
protected final void end()
Adds aView.Event.Type.END_OBJECT
orView.Event.Type.END_ARRAY
event to the view, depending on what was the lastbegin
Type invocation.
-
discriminator
protected final void discriminator(Object value)
Adds a subtype discriminator to the view.- Parameters:
value
- discriminator value
-
meta
protected final void meta(String name, Object value)
Adds a metadata value to a view.- Parameters:
name
- metadata namevalue
- metadata value
-
value
protected final void value(String name, String value)
Adds a string value to the view.- Parameters:
name
- name of the valuevalue
- string value (notnull
)
-
value
protected final void value(String name, Number value)
Adds a numeric value to the view.- Parameters:
name
- name of the valuevalue
- numeric value (notnull
)
-
value
protected final void value(String name, Boolean value)
Adds a boolean value to the view.- Parameters:
name
- name of the valuevalue
- boolean value (notnull
)
-
nullValue
protected final void nullValue(String name)
Adds a null value to the view.- Parameters:
name
- name of the value
-
-