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

com.enonic.xp.content.ContentName Maven / Gradle / Ivy

There is a newer version: 7.14.4
Show newest version
package com.enonic.xp.content;

import java.util.UUID;

import com.enonic.xp.annotation.PublicApi;
import com.enonic.xp.name.Name;

@PublicApi
public final class ContentName
    extends Name
{
    private static final String UNNAMED_PREFIX = "__unnamed__";

    private ContentName( final String name )
    {
        super( name );
    }

    public boolean isUnnamed()
    {
        return this.value.startsWith( UNNAMED_PREFIX );
    }

    public boolean hasUniqueness()
    {
        return isUnnamed() && this.value.length() > UNNAMED_PREFIX.length();
    }

    public static ContentName unnamed()
    {
        return from( UNNAMED_PREFIX );
    }

    public static ContentName from( final String name )
    {
        return new ContentName( name );
    }

    public static ContentName uniqueUnnamed()
    {
        return from( UNNAMED_PREFIX + UUID.randomUUID() );
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy