[x3d-public] HelloWorldProgramOutputCanonical.x3d Report/Discussion on X3DJSONLD serializers (not checked in). Problem with X3dToJson.xslt as run by X3DJSAIL.

Don Brutzman brutzman at nps.edu
Thu May 13 15:24:44 PDT 2021

Pattern summary:

Any method starting with "set" replaces existing values.

Any method starting with "add" keeps existing values (if any) and append the provided values.  These are only provided for MF multiple-field arrays.

There are also "clear" methods to remove existing field values (if any) such as clearMetadata() and clearValue().

Everything is pipelined (Java jargon: lambda expressions) which allows appending one method after another, "daisy chaining" to set all the fields of any object.  This style of expression leads to the terseness and precision you see in the Java examples provided.

On 5/13/2021 2:59 PM, John Carlson wrote:
> It looks like you've got an extra setMetadata() to throw an error from
> your code generated from the tested X3dToJava.xslt?  The addValue() text
> within the extra setMetadata() is confusing!
> Wondering.

If there is more than a single method provided (aka method overloading) then close inspection will show that each one has differently typed inputs.  This means that Java programmers have consistent usage and excellent flexibility, making it easier to program.

The stylesheet applies these patterns, rather than having a comprehensive/endless list of custom method names.  Since we are applying it to 4000 X3D example scenes as a set of unit tests, any rare errors which might occur hold special interest.  Rephrase: error reports welcome.

all the best, Don
Don Brutzman  Naval Postgraduate School, Code USW/Br       brutzman at nps.edu
Watkins 270,  MOVES Institute, Monterey CA 93943-5000 USA   +1.831.656.2149
X3D graphics, virtual worlds, navy robotics http://faculty.nps.edu/brutzman

More information about the x3d-public mailing list