getMaterial();

where is the referance to the material of a spatial??
there is setMaterial(), but not getMaterial()

Only a Geometry can have a Material (there is a getter for it on instances of that class).