@Override
    @SuppressWarnings("unchecked")
    public void write(JmeExporter ex) throws IOException {
        OutputCapsule capsule = ex.getCapsule(this);
        capsule.write(name, "name", null);
        capsule.write(worldBound, "world_bound", null);
        capsule.write(cullHint, "cull_mode", CullHint.Inherit);
        capsule.write(batchHint, "batch_hint", BatchHint.Inherit);
        capsule.write(queueBucket, "queue", RenderQueue.Bucket.Inherit);
        capsule.write(shadowMode, "shadow_mode", ShadowMode.Inherit);
        capsule.write(localTransform, "transform", Transform.IDENTITY);
        capsule.write(localLights, "lights", null);
        capsule.writeSavableArrayList(new ArrayList(localOverrides), "overrides", null);

        // Shallow clone the controls array to convert its type.
        capsule.writeSavableArrayList(new ArrayList(controls), "controlsList", null);
        capsule.writeStringSavableMap(userData, "user_data", null);
    }
Note that we are <i>matching</i> the pattern, therefore the pattern
must match the entire pattern (i.e. it behaves as if it is sandwiched
between "^" and "$").
You can set regex modes, like case insensitivity, by using the (?X)
or (?X:Y) constructs.

@param spatialSubclass Subclass which this must implement.
                       Null causes all Spatials to qualify.
@param nameRegex  Regular expression to match this name against.
                       Null causes all Names to qualify.
@return true if this implements the specified class and this's name
        matches the specified pattern.

@see java.util.regex.Pattern
jme3-core/src/main/java/com/jme3/scene/Spatial.java