private void startStructure(StructureType structureType, String startDelimiter) { if ( StringHelper.isNotEmpty( startDelimiter ) ) { builder.append( startDelimiter ); } structureTypeStack.push( structureType ); first = true; }
/** * Create a {@link BeanReference} referencing a bean by type and name. * * @param type The bean type. Must not be null. * @param name The bean name. May be null or empty. * @return The corresponding {@link BeanReference}. */ static <T> BeanReference<T> of(Class<T> type, String name) { if ( StringHelper.isNotEmpty( name ) ) { return new TypeAndNameBeanReference<>( type, name ); } else { return new TypeBeanReference<>( type ); } }
/** * Create a {@link BeanReference} referencing a bean by type and name. * * @param type The bean type. Must not be null. * @param name The bean name. May be null or empty. * @return The corresponding {@link BeanReference}. */ static <T> BeanReference<T> of(Class<T> type, String name) { if ( StringHelper.isNotEmpty( name ) ) { return new TypeAndNameBeanReference<>( type, name ); } else { return new TypeBeanReference<>( type ); } }
private void endStructure(StructureType structureType, String endDelimiter) { StructureType lastType = structureTypeStack.peek(); if ( lastType == null ) { throw new AssertionFailure( "Cannot pop, already at root" ); } else if ( lastType != structureType ) { throw new AssertionFailure( "Cannot pop, not inside a " + structureType ); } structureTypeStack.pop(); if ( StringHelper.isNotEmpty( endDelimiter ) ) { appendNewline(); appendIndent(); builder.append( endDelimiter ); } first = false; }
if ( StringHelper.isNotEmpty( name ) ) { builder.append( name ); builder.append( style.nameValueSeparator );