Back to articles
bridge99
News

bridge99

via Dev.toQuery Filter

private String extractValue ( Object value ) { if ( value == null ) return "null" ; // 1. Unmask Spring's TypedStringValue immediately if ( value instanceof TypedStringValue ) { String raw = (( TypedStringValue ) value ). getValue (); return xmlEscape ( raw != null ? raw . trim () : "null" ); } // 2. Handle Bean References (@name) if ( value instanceof BeanReference ) { return "@" + (( BeanReference ) value ). getBeanName (); } // 3. Handle Inner Bean Definitions (Short Class Name only) if ( value instanceof BeanDefinition ) { String className = (( BeanDefinition ) value ). getBeanClassName (); if ( className != null ) { return "<i>" + className . substring ( className . lastIndexOf ( '.' ) + 1 ). trim () + "</i>" ; } return "<i>InnerBean</i>" ; } // 4. Handle Collections (Lists/Sets) - Recursive clean if ( value instanceof Iterable ) { List < String > cleaned = new ArrayList <>(); int count = 0 ; for ( Object item : ( Iterable <?>) value ) { if ( count ++ >= 15 ) { cleaned . add ( "..

Continue reading on Dev.to

Opens in a new tab

Read Full Article
5 views

Related Articles