com.cedarsoft.spring.rcp.renderer.DefaultLabelProvider Maven / Gradle / Ivy
package com.cedarsoft.spring.rcp.renderer;
import org.jetbrains.annotations.NotNull;
import org.springframework.richclient.selection.binding.support.LabelProvider;
/**
* Default label provider that handles null safely. It returns an empty string ("") for null.
*
* @param the type this provider returns a label for
*/
public abstract class DefaultLabelProvider implements LabelProvider {
@Override
public String getLabel( Object item ) {
if ( item == null ) {
return getLabelForNull();
}
return getLabelFor( ( T ) item );
}
@NotNull
protected String getLabelForNull() {
return "";
}
@NotNull
protected abstract String getLabelFor( @NotNull T item );
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy