litesoft
@ 961
litesoft / trunk / DeviceDesktopTest / src / org / litesoft / template / ChunkWithKey.java
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
package org.litesoft.template; public class ChunkWithKey implements Chunk { private final String mKey; /** * @param pKey !null */ public ChunkWithKey( String pKey ) { mKey = pKey; } @Override public void dump( Sink pWriter, ValueProvider pValueProvider ) { Object zValue = pValueProvider.valueFor( mKey ); if ( zValue instanceof Chunk ) { ((Chunk) zValue).dump( pWriter, pValueProvider ); } else if ( zValue == null ) { pWriter.write( "[" + mKey + "]" ); } else { String zText = zValue.toString(); if ( zText == null ) { pWriter.write( "[" + mKey + "...null]" ); } else if ( zText.length() != 0 ) { pWriter.write( zText ); } } } } |