de.tsl2.nano.bean.def.SelectionProvider Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of tsl2.nano.descriptor Show documentation
Show all versions of tsl2.nano.descriptor Show documentation
TSL2 Framework Descriptor (currency-handling, generic formatter, descriptors for beans, collections, actions and values)
/*
* File: $HeadURL$
* Id : $Id$
*
* created by: Thomas Schneider
* created on: Jul 20, 2012
*
* Copyright: (c) Thomas Schneider 2012, all rights reserved
*/
package de.tsl2.nano.bean.def;
import java.util.Collection;
import de.tsl2.nano.bean.ValueHolder;
/**
*
* @author Thomas Schneider
* @version $Revision$
*/
public class SelectionProvider extends ValueHolder> implements ISelectionProvider {
/** serialVersionUID */
private static final long serialVersionUID = -969325041213343728L;
/**
* constructor
* @param selection
*/
public SelectionProvider(Collection selection) {
super(selection);
}
@Override
public T getFirstElement() {
return isEmpty() ? null : getValue().iterator().next();
}
@Override
public boolean isEmpty() {
return getValue() == null || getValue().isEmpty();
}
}