public class DynamicFormatter
extends eu.bandm.tools.formatfrontends.absy.Visitor
constructor
there are some public fields and some setter methods for configuring the
format generation process.Format.Literal
.
Modifier and Type | Class and Description |
---|---|
protected static class |
DynamicFormatter.ChildInfo |
Modifier and Type | Field and Description |
---|---|
boolean |
cacheFormatForObject
controls caching of generated formats for objects, both putting and getting.
|
boolean |
cachePatternForClass
controls caching of retrieved format code for java classes,
both putting and getting.
|
protected boolean |
checkedmode |
protected DynamicFormatter.ChildInfo |
childinfo |
protected DynamicFormatter.ChildInfo |
CHILDINFO_PLAIN |
protected static HashMap<Class,Method> |
class2formatMethod
"toFormat" method of class, or constant "null" if no pattern and no
toFormat() method exist and default has to be used.
|
protected static HashMap<Class,eu.bandm.tools.formatfrontends.absy.Element_pattern> |
class2pattern
compiled pattern for class
|
int |
default_indentation
used for identation formats without explict number part.
|
protected Format |
emptyList |
protected static int |
FOLD_APPEND |
protected static int |
FOLD_BENEATH |
protected static int |
FOLD_BESIDE |
protected static int |
FOLD_BLOCK |
protected static int |
FOLD_LINE |
protected Format |
format |
protected Object |
foundchild |
protected String |
foundchildname |
protected Map<String,Format> |
literals |
protected Object |
model |
protected MessageReceiver<? super SimpleMessage<XMLDocumentIdentifier>> |
msg |
static String |
NAME_METHOD_getFormatHint
name of the method a class must (re-)define to define the format code
which shall be used for their instances.
|
static String |
NAME_METHOD_toFormat
name of the method a class can (re-)define to build a format
representation for its instances "manually", by calling the
Format factory directly. |
protected static Object[] |
NO_ARGS |
protected static int |
NO_FOLD |
protected static Class[] |
NO_PARAMS |
protected static Format |
NOSUPER |
Format |
null_representation
used for representing the java value null.
|
protected int |
number |
protected static HashMap<Object,Format> |
object2format
Format already generated for this particular object.
|
protected static HashMap<String,eu.bandm.tools.formatfrontends.absy.Element_pattern> |
text2pattern
String value to compiled pattern, for skipping parsing process
in case of identical format source tests for different classes.
|
validating
Modifier | Constructor and Description |
---|---|
protected |
DynamicFormatter(MessageReceiver<? super SimpleMessage<XMLDocumentIdentifier>> msg)
Only constructor.
|
Modifier and Type | Method and Description |
---|---|
protected eu.bandm.tools.formatfrontends.absy.Element_append |
casesInt(eu.bandm.tools.formatfrontends.absy.Element_cases cases,
String childname,
int value) |
protected eu.bandm.tools.formatfrontends.absy.Element_append |
casesStringOrChar(eu.bandm.tools.formatfrontends.absy.Element_cases cases,
String childname,
String value,
boolean ischar) |
protected static Format |
defaultFormat(Object model)
used for representing any java object "model" for which no format code
could be found.
|
protected Format |
deliver(Object model,
Format format) |
protected void |
error(Location<XMLDocumentIdentifier> loc,
String s) |
protected Method |
findToFormatMethod(Class<?> cls) |
protected Format |
foldit(Format[] items) |
Format |
format(Object model)
central method for generating a format for a given object (="model").
|
protected Format |
format(Object model,
eu.bandm.tools.formatfrontends.absy.Element_pattern pattern) |
Format |
format(Object model,
String formathint)
central method for generating a format for a given object (="model").
|
String |
getFormatHint(Class<?> cls)
Side-door entry for interception: retrieve the class specific format description
source text.
|
static String |
getFormatHint(Class cls,
MessageReceiver<SimpleMessage> msg)
convenience method.
|
protected Format |
invokeToFormatMethod(Object model,
Method method) |
eu.bandm.tools.formatfrontends.absy.Element_pattern |
parseHint(String hint)
Side-door entry for interception: Parses a
format front end language string and delivers the AST as a
tdom model.
|
protected Format |
processChild(Object child) |
protected Format |
processCollectionCode(Collection list) |
protected Format |
processFoldOrList(Collection list) |
protected Format |
processMap(Map map) |
static Format |
toFormat(Object model,
MessageReceiver<? super SimpleMessage> msg)
convenience method.
|
static Format |
toFormat(Object model,
String formathint,
MessageReceiver<? super SimpleMessage> msg)
convenience method.
|
void |
visit(eu.bandm.tools.formatfrontends.absy.Element_alternative element) |
void |
visit(eu.bandm.tools.formatfrontends.absy.Element_append element) |
void |
visit(eu.bandm.tools.formatfrontends.absy.Element_appendOp element) |
void |
visit(eu.bandm.tools.formatfrontends.absy.Element_beneath element) |
void |
visit(eu.bandm.tools.formatfrontends.absy.Element_beneathOp element) |
void |
visit(eu.bandm.tools.formatfrontends.absy.Element_beside element) |
void |
visit(eu.bandm.tools.formatfrontends.absy.Element_besideOp element) |
void |
visit(eu.bandm.tools.formatfrontends.absy.Element_block element) |
void |
visit(eu.bandm.tools.formatfrontends.absy.Element_blockOp element) |
void |
visit(eu.bandm.tools.formatfrontends.absy.Element_child element) |
void |
visit(eu.bandm.tools.formatfrontends.absy.Element_clss element) |
void |
visit(eu.bandm.tools.formatfrontends.absy.Element_clssUPCASE element) |
void |
visit(eu.bandm.tools.formatfrontends.absy.Element_emptylistrepr element) |
void |
visit(eu.bandm.tools.formatfrontends.absy.Element_from element) |
void |
visit(eu.bandm.tools.formatfrontends.absy.Element_indent_op element) |
void |
visit(eu.bandm.tools.formatfrontends.absy.Element_indent element) |
void |
visit(eu.bandm.tools.formatfrontends.absy.Element_line element) |
void |
visit(eu.bandm.tools.formatfrontends.absy.Element_lineOp element) |
void |
visit(eu.bandm.tools.formatfrontends.absy.Element_listdescr element) |
void |
visit(eu.bandm.tools.formatfrontends.absy.Element_literal element) |
void |
visit(eu.bandm.tools.formatfrontends.absy.Element_number element) |
void |
visit(eu.bandm.tools.formatfrontends.absy.Element_ref element) |
void |
visit(eu.bandm.tools.formatfrontends.absy.Element_supr element) |
void |
visit(eu.bandm.tools.formatfrontends.absy.Element_swtch element) |
void |
visit(eu.bandm.tools.formatfrontends.absy.Element_tabular element) |
void |
visit(eu.bandm.tools.formatfrontends.absy.Element_thiz element) |
void |
visit(eu.bandm.tools.formatfrontends.absy.Element_too element) |
void |
visit(eu.bandm.tools.formatfrontends.absy.Element_whitespace element) |
protected void |
warning(Location<XMLDocumentIdentifier> loc,
String s) |
visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit, visit
visit
public int default_indentation
public Format null_representation
public boolean cacheFormatForObject
public boolean cachePatternForClass
protected MessageReceiver<? super SimpleMessage<XMLDocumentIdentifier>> msg
protected Object model
protected Format format
protected int number
protected boolean checkedmode
public static final String NAME_METHOD_getFormatHint
public static final String NAME_METHOD_toFormat
Format
factory directly.
Value is "toFormat"protected static final int NO_FOLD
protected static final int FOLD_BENEATH
protected static final int FOLD_BESIDE
protected static final int FOLD_LINE
protected static final int FOLD_BLOCK
protected static final int FOLD_APPEND
protected DynamicFormatter.ChildInfo childinfo
protected final DynamicFormatter.ChildInfo CHILDINFO_PLAIN
protected Format emptyList
protected Object foundchild
protected String foundchildname
protected static final Class[] NO_PARAMS
protected static final Object[] NO_ARGS
protected static Format NOSUPER
protected static final HashMap<Object,Format> object2format
protected static final HashMap<Class,Method> class2formatMethod
protected static final HashMap<Class,eu.bandm.tools.formatfrontends.absy.Element_pattern> class2pattern
protected DynamicFormatter(MessageReceiver<? super SimpleMessage<XMLDocumentIdentifier>> msg)
IllegalArgumentException
- iff msg is equal to null.protected void error(Location<XMLDocumentIdentifier> loc, String s)
protected void warning(Location<XMLDocumentIdentifier> loc, String s)
protected static Format defaultFormat(Object model)
public void visit(eu.bandm.tools.formatfrontends.absy.Element_alternative element)
visit
in class eu.bandm.tools.formatfrontends.absy.Visitor
public void visit(eu.bandm.tools.formatfrontends.absy.Element_beneath element)
visit
in class eu.bandm.tools.formatfrontends.absy.Visitor
public void visit(eu.bandm.tools.formatfrontends.absy.Element_beside element)
visit
in class eu.bandm.tools.formatfrontends.absy.Visitor
public void visit(eu.bandm.tools.formatfrontends.absy.Element_line element)
visit
in class eu.bandm.tools.formatfrontends.absy.Visitor
public void visit(eu.bandm.tools.formatfrontends.absy.Element_block element)
visit
in class eu.bandm.tools.formatfrontends.absy.Visitor
public void visit(eu.bandm.tools.formatfrontends.absy.Element_append element)
visit
in class eu.bandm.tools.formatfrontends.absy.Visitor
public void visit(eu.bandm.tools.formatfrontends.absy.Element_number element)
visit
in class eu.bandm.tools.formatfrontends.absy.Visitor
public void visit(eu.bandm.tools.formatfrontends.absy.Element_indent element)
visit
in class eu.bandm.tools.formatfrontends.absy.Visitor
public void visit(eu.bandm.tools.formatfrontends.absy.Element_indent_op element)
visit
in class eu.bandm.tools.formatfrontends.absy.Visitor
public void visit(eu.bandm.tools.formatfrontends.absy.Element_literal element)
visit
in class eu.bandm.tools.formatfrontends.absy.Visitor
public void visit(eu.bandm.tools.formatfrontends.absy.Element_whitespace element)
visit
in class eu.bandm.tools.formatfrontends.absy.Visitor
public void visit(eu.bandm.tools.formatfrontends.absy.Element_clss element)
visit
in class eu.bandm.tools.formatfrontends.absy.Visitor
public void visit(eu.bandm.tools.formatfrontends.absy.Element_clssUPCASE element)
visit
in class eu.bandm.tools.formatfrontends.absy.Visitor
public void visit(eu.bandm.tools.formatfrontends.absy.Element_tabular element)
visit
in class eu.bandm.tools.formatfrontends.absy.Visitor
public void visit(eu.bandm.tools.formatfrontends.absy.Element_listdescr element)
visit
in class eu.bandm.tools.formatfrontends.absy.Visitor
public void visit(eu.bandm.tools.formatfrontends.absy.Element_emptylistrepr element)
visit
in class eu.bandm.tools.formatfrontends.absy.Visitor
public void visit(eu.bandm.tools.formatfrontends.absy.Element_beneathOp element)
visit
in class eu.bandm.tools.formatfrontends.absy.Visitor
public void visit(eu.bandm.tools.formatfrontends.absy.Element_besideOp element)
visit
in class eu.bandm.tools.formatfrontends.absy.Visitor
public void visit(eu.bandm.tools.formatfrontends.absy.Element_lineOp element)
visit
in class eu.bandm.tools.formatfrontends.absy.Visitor
public void visit(eu.bandm.tools.formatfrontends.absy.Element_blockOp element)
visit
in class eu.bandm.tools.formatfrontends.absy.Visitor
public void visit(eu.bandm.tools.formatfrontends.absy.Element_appendOp element)
visit
in class eu.bandm.tools.formatfrontends.absy.Visitor
public void visit(eu.bandm.tools.formatfrontends.absy.Element_from element)
visit
in class eu.bandm.tools.formatfrontends.absy.Visitor
public void visit(eu.bandm.tools.formatfrontends.absy.Element_too element)
visit
in class eu.bandm.tools.formatfrontends.absy.Visitor
public void visit(eu.bandm.tools.formatfrontends.absy.Element_thiz element)
visit
in class eu.bandm.tools.formatfrontends.absy.Visitor
public void visit(eu.bandm.tools.formatfrontends.absy.Element_ref element)
visit
in class eu.bandm.tools.formatfrontends.absy.Visitor
public void visit(eu.bandm.tools.formatfrontends.absy.Element_swtch element)
visit
in class eu.bandm.tools.formatfrontends.absy.Visitor
protected eu.bandm.tools.formatfrontends.absy.Element_append casesInt(eu.bandm.tools.formatfrontends.absy.Element_cases cases, String childname, int value)
protected eu.bandm.tools.formatfrontends.absy.Element_append casesStringOrChar(eu.bandm.tools.formatfrontends.absy.Element_cases cases, String childname, String value, boolean ischar)
public void visit(eu.bandm.tools.formatfrontends.absy.Element_supr element)
visit
in class eu.bandm.tools.formatfrontends.absy.Visitor
public void visit(eu.bandm.tools.formatfrontends.absy.Element_child element)
visit
in class eu.bandm.tools.formatfrontends.absy.Visitor
protected Format processFoldOrList(Collection list)
protected Format processCollectionCode(Collection list)
public String getFormatHint(Class<?> cls)
static final String NAME_METHOD_getFormatHint
")
and returns the returned String value.public eu.bandm.tools.formatfrontends.absy.Element_pattern parseHint(String hint)
public Format format(Object model)
in the class documentation
.public Format format(Object model, String formathint)
in the class documentation
.protected Format format(Object model, eu.bandm.tools.formatfrontends.absy.Element_pattern pattern)
public static Format toFormat(Object model, MessageReceiver<? super SimpleMessage> msg)
public static Format toFormat(Object model, String formathint, MessageReceiver<? super SimpleMessage> msg)
public static String getFormatHint(Class cls, MessageReceiver<SimpleMessage> msg)
see also the complete user documentation .