All Downloads are FREE. Search and download functionalities are using the official Maven repository.

cdc.mf.model.MfNameItem Maven / Gradle / Ivy

The newest version!
package cdc.mf.model;

import java.util.Comparator;
import java.util.Objects;
import java.util.function.Predicate;

import cdc.util.strings.StringUtils;

/**
 * Interface of elements that have an optional name.
 * 

* All elements, except {@link MfDocumentation} can have a name. * * @author Damien Carbonne */ public interface MfNameItem extends MfElement { public static final Comparator NAME_COMPARATOR = Comparator.comparing(x -> x.getName() == null ? "" : x.getName()); public static Predicate named(String name) { return x -> Objects.equals(name, x.getName()); } /** * @return The name or {@code null}. */ public String getName(); public default boolean hasName() { return !StringUtils.isNullOrEmpty(getName()); } }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy