/[Apache-SVN]
ViewVC logotype

Revision 1636971


Jump to revision: Previous Next
Author: rwhitcomb
Date: Wed Nov 5 21:47:40 2014 UTC (9 years, 5 months ago)
Changed paths: 4
Log Message:
PIVOT-960: Add macro processing capability to JSONSerializer.

This provides a very general way to use constant definitions inside a style
sheet (for instance) or to compose values from parts defined separately.

Macros are defined used "#define NAME VALUE" and undefined with "#undef NAME".
Macros are expanded using "${NAME}" and can be recursively defined (that is,
one macro is defined in terms of another, such as:
#define TWO 2
#define ZERO 0
#define TWENTY ${TWO}${ZERO}
...
padding : ${TWENTY}
will expand to:
padding : 20

Updating the JSONSerializerTest to more thoroughly test the various macro
definitions and expansions, using an update "map.json" with a number of
macros defined in it.

The main program is "MacroReader.java" which is just a Reader that can be
combined with any other Reader to add macro capabilities to any other text
stream (such as XML, CSV, etc).  For now we have only added it to JSONSerializer.


Changed paths

Path Details
Directorypivot/trunk/core/src/org/apache/pivot/json/JSONSerializer.java modified , text changed
Directorypivot/trunk/core/src/org/apache/pivot/serialization/MacroReader.java added
Directorypivot/trunk/core/test/org/apache/pivot/json/test/JSONSerializerTest.java modified , text changed
Directorypivot/trunk/core/test/org/apache/pivot/json/test/map.json modified , text changed

infrastructure at apache.org
ViewVC Help
Powered by ViewVC 1.1.26