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

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

The newest version!
package cdc.mf.model;

import java.util.Comparator;

import cdc.util.paths.Path;

/**
 * Interface of elements that have an optional QName.
 *
 * @author Damien Carbonne
 */
public interface MfQNameItem extends MfNameItem, MfTagOwner {
    public static final Comparator QNAME_COMPARATOR =
            Comparator.comparing(x -> x.getQName() == null ? Path.ROOT : x.getQName());
    public static final Comparator NAME_PARENT_PATH_COMPARATOR =
            Comparator.comparing((MfQNameItem x) -> x.getName() == null ? "" : x.getName())
                      .thenComparing(QNAME_COMPARATOR);

    /**
     * @return The QName of this element.
     */
    public Path getQName();

    @Override
    public MfQNameItem getParent();

    public boolean canResolve(Path path);

    public MfQNameItem resolve(Path path);

    public default MfQNameItem resolve(String path) {
        return resolve(Path.of(path));
    }

    public default 

P resolve(Path path, Class

targetClass) { return targetClass.cast(resolve(path)); } public default

P resolve(String path, Class

targetClass) { return resolve(Path.of(path), targetClass); } }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy