protected void setComplex(Level level, boolean complex){ boolean isAlreadyComplex = level.isComplex; super.setComplex(level, complex); if(complex && !isAlreadyComplex){ Level parentLevel = level.parentLevel; if(parentLevel != null && parentLevel.isCollection && parentLevel.isEmptyCollection()){ parentLevel.setEmptyCollection(false); } if((parentLevel != null && parentLevel.isCollection && !parentLevel.isEmptyCollection()) || level.keyName == null){ jsonGenerator.writeStartObject(); }else{ jsonGenerator.writeStartObject(level.keyName); } } }
protected void setComplex(Level level, boolean complex){ boolean isAlreadyComplex = level.isComplex; super.setComplex(level, complex); if(complex && !isAlreadyComplex){ Level parentLevel = level.parentLevel; if(parentLevel != null && parentLevel.isCollection && parentLevel.isEmptyCollection()){ parentLevel.setEmptyCollection(false); } if((parentLevel != null && parentLevel.isCollection && !parentLevel.isEmptyCollection()) || level.keyName == null){ jsonGenerator.writeStartObject(); }else{ jsonGenerator.writeStartObject(level.keyName); } } }
private void addValue(T currentLevel, String keyName, Object value, QName schemaType){ if(currentLevel.isCollection()){ addValueToArray(currentLevel, value, schemaType); currentLevel.setEmptyCollection(false); } else { addValueToObject(currentLevel, keyName, value, schemaType); } } protected abstract void addValueToObject(T currentLevel, String keyName, Object value, QName schemaType);
@Override public void startDocument(String encoding, String version) { if(isRootArray){ if(position == null){ startCollection(); } position.setEmptyCollection(false); position = createNewLevel(false, position); isLastEventStart = true; }else{ startRootObject(); } }
@Override public void startDocument(String encoding, String version) { if(isRootArray){ if(position == null){ startCollection(); } position.setEmptyCollection(false); position = createNewLevel(false, position); isLastEventStart = true; }else{ startRootObject(); } }
private void addValue(T currentLevel, String keyName, Object value, QName schemaType){ if(currentLevel.isCollection()){ addValueToArray(currentLevel, value, schemaType); currentLevel.setEmptyCollection(false); } else { addValueToObject(currentLevel, keyName, value, schemaType); } } protected abstract void addValueToObject(T currentLevel, String keyName, Object value, QName schemaType);