public abstract class Entity
extends java.lang.Object
Constructor and Description |
---|
Entity(MetadataService metadataService)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
abstract boolean |
exists()
Indicates if the entity does exist.
|
java.lang.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 java.lang.String |
getBaseName(java.lang.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 java.util.List<Entity> |
getChildren()
Returns the list of contained entities if the current entity is a
directory, null otherwise.
|
java.util.Collection<java.lang.String> |
getExtensions()
Returns the list of known extensions.
|
static java.util.Collection<java.lang.String> |
getExtensions(java.lang.String name,
MetadataService metadataService)
Returns the list of known extensions taken from a given entity name.
|
static java.util.Collection<java.lang.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 java.lang.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(java.lang.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 java.lang.String getBaseName(java.lang.String name, MetadataService metadataService)
name
- The given name.metadataService
- Service that holds the known extensions.public static java.util.Collection<java.lang.String> getExtensions(java.lang.String name, MetadataService metadataService)
name
- the given name.metadataService
- Service that holds the known extensions.public static java.util.Collection<java.lang.String> getExtensions(Variant variant, MetadataService metadataService)
variant
- the given variant.metadataService
- Service that holds the known extensions.public static void updateMetadata(java.lang.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 java.lang.String getBaseName()
public abstract java.util.List<Entity> getChildren()
public java.util.Collection<java.lang.String> getExtensions()
public MetadataService getMetadataService()
public abstract java.lang.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-2020 Restlet.