}
private void marshalParticles(JavaMethod pJm, LocalJavaField pElement,
ParticleSG[] pParticles) throws SAXException {
for (int i = 0; i < pParticles.length; i++) {
final ParticleSG particle = pParticles[i];
if (particle.isElement()) {
SGlet sgLet = new SGlet(){
public void generate(JavaMethod pMethod, Object pValue) throws SAXException {
marshalElementParticle(pMethod, pValue, particle);
}
};
particle.getPropertySG().forAllNonNullValues(pJm, pElement, sgLet);
} else if (particle.isGroup()) {
marshalGroupParticle(pJm, pElement, particle);
} else if (particle.isWildcard()) {
throw new IllegalStateException("TODO: Add support for wildcards");
} else {
throw new IllegalStateException("Invalid particle type");
}
}