public abstract class Entity extends Object
| Constructor and Description |
|---|
Entity(MetadataService metadataService)
Constructor.
|
| Modifier and Type | Method and Description |
|---|---|
abstract boolean |
exists()
Indicates if the entity does exist.
|
String |
getBaseName()
Return the base name of this entity that is to say the longest part of the
name without known extensions (beginning from the left).
|
static String |
getBaseName(String name,
MetadataService metadataService)
Return the base name that is to say the longest part of a given name without
known extensions (beginning from the left).
|
abstract List<Entity> |
getChildren()
Returns the list of contained entities if the current entity is a directory,
null otherwise.
|
Collection<String> |
getExtensions()
Returns the list of known extensions.
|
static Collection<String> |
getExtensions(String name,
MetadataService metadataService)
Returns the list of known extensions taken from a given entity name.
|
static Collection<String> |
getExtensions(Variant variant,
MetadataService metadataService)
Returns the list of known extensions taken from a given variant.
|
MetadataService |
getMetadataService()
Returns the metadata service to use.
|
abstract String |
getName()
Returns the name.
|
abstract Entity |
getParent()
Returns the parent directory (if any).
|
abstract Representation |
getRepresentation(MediaType defaultMediaType,
int timeToLive)
Returns a representation of this local entity.
|
Variant |
getVariant()
Returns a variant corresponding to the extensions of this entity.
|
abstract boolean |
isDirectory()
Indicates if the entity is a directory.
|
abstract boolean |
isNormal()
Indicates if the entity is a normal entity, especially if it is not a
directory.
|
static void |
updateMetadata(String entryName,
Variant variant,
boolean applyDefault,
MetadataService metadataService)
Updates some variant metadata based on a given entry name with extensions.
|
public Entity(MetadataService metadataService)
metadataService - The metadata service to use.public static String getBaseName(String name, MetadataService metadataService)
name - The given name.metadataService - Service that holds the known extensions.public static Collection<String> getExtensions(String name, MetadataService metadataService)
name - the given name.metadataService - Service that holds the known extensions.public static Collection<String> getExtensions(Variant variant, MetadataService metadataService)
variant - the given variant.metadataService - Service that holds the known extensions.public static void updateMetadata(String entryName, Variant variant, boolean applyDefault, MetadataService metadataService)
entryName - The entry name with extensions.variant - The variant to update.applyDefault - Indicate if default metadata must be applied.metadataService - The parent metadata service.public abstract boolean exists()
public String getBaseName()
public abstract List<Entity> getChildren()
public Collection<String> getExtensions()
public MetadataService getMetadataService()
public abstract String getName()
public abstract Entity getParent()
public abstract Representation getRepresentation(MediaType defaultMediaType, int timeToLive)
public Variant getVariant()
public abstract boolean isDirectory()
public abstract boolean isNormal()
File.isFile(),
File.isDirectory()Copyright © 2005–2025. All rights reserved.