public abstract class AbstractConvertibleNut extends AbstractNut implements ConvertibleNut
Base class for ConvertibleNut implementation with state management (attributes like transformers or referenced
nuts). Transformation is delegated to subclass.
| Modifier | Constructor and Description |
|---|---|
protected |
AbstractConvertibleNut(Nut o)
Builds a new instance.
|
protected |
AbstractConvertibleNut(String name,
NutType ft,
Future<Long> v,
Boolean c)
Builds a new instance.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addReferencedNut(ConvertibleNut referenced)
Adds a new nut referenced by this nut.
|
void |
addTransformer(Pipe.Transformer<ConvertibleNut> transformer)
Adds a
Pipe.Transformer. |
boolean |
equals(Object other) |
String |
getName()
Returns the name potentially altered by other components like transformers.
|
NutType |
getNutType()
Returns the nut type potentially modified by other components like transformers.
|
List<ConvertibleNut> |
getOriginalNuts()
When this nut is the result of the transformation of another one, then it is actually a processed nut.
|
String |
getParentFile()
If the file is stored in a directory on the file system, then this method returns the directory.
|
List<Pipe.OnReady> |
getReadyCallbacks()
Gets the callbacks notified when transformation has been done.
|
List<ConvertibleNut> |
getReferencedNuts()
Gets the nuts referenced by this nut.
|
Set<Pipe.Transformer<ConvertibleNut>> |
getTransformers()
Gets the registered transformers.
|
int |
hashCode() |
Boolean |
isCompressed()
Indicates if the nut is compressed.
|
boolean |
isDynamic()
Indicates if this nut has a dynamic content, meaning that it could be changed each time
Nut.openStream() is
invoked. |
boolean |
isSubResource()
Indicates if this nut is a sub resource of the nut referencing it.
|
void |
onReady(Pipe.OnReady callback)
Adds the given callback to be invoked once transformation occurs.
|
InputStream |
openStream()
Opens and returns an
InputStream pointing to the nut. |
void |
setIsCompressed(Boolean compressed)
Indicates if the nut is compressed.
|
void |
setIsSubResource(boolean sr)
Mark this nut as a sub resource or not.
|
void |
setNutName(String nutName)
Sets the nut name.
|
void |
setNutType(NutType nutType)
Sets the nut type.
|
protected void |
setOriginalNuts(List<ConvertibleNut> o)
Sets the original nuts.
|
getInitialName, getInitialNutType, getProxyUri, getVersionNumber, setProxyUri, setVersionNumber, toStringclone, finalize, getClass, notify, notifyAll, wait, wait, waitisTransformed, transformgetInitialName, getInitialNutType, getProxyUri, getVersionNumber, setProxyUriprotected AbstractConvertibleNut(Nut o)
Builds a new instance.
o - the converted nutprotected final void setOriginalNuts(List<ConvertibleNut> o)
Sets the original nuts.
o - the original nutspublic Set<Pipe.Transformer<ConvertibleNut>> getTransformers()
Gets the registered transformers. The set must be ordered.
getTransformers in interface ConvertibleNutpublic List<Pipe.OnReady> getReadyCallbacks()
Gets the callbacks notified when transformation has been done.
getReadyCallbacks in interface ConvertibleNutpublic final Boolean isCompressed()
Indicates if the nut is compressed.
isCompressed in interface ConvertibleNuttrue if the nut is compressed, false otherwisepublic final void setIsCompressed(Boolean compressed)
Indicates if the nut is compressed.
setIsCompressed in interface ConvertibleNutcompressed - true if the nut is compressed, false otherwisepublic final void setNutName(String nutName)
Sets the nut name.
setNutName in interface ConvertibleNutnutName - the namepublic final void setNutType(NutType nutType)
Sets the nut type.
setNutType in interface ConvertibleNutnutType - the new nut typepublic final void setIsSubResource(boolean sr)
Mark this nut as a sub resource or not.
setIsSubResource in interface ConvertibleNutsr - true if the nut is a sub resource, false otherwisepublic final boolean isSubResource()
ConvertibleNut
Indicates if this nut is a sub resource of the nut referencing it. If this is true, then this means that
the referencer must loads this nut in order to work.
isSubResource in interface ConvertibleNuttrue if the nut is a sub resource, false otherwisepublic void addTransformer(Pipe.Transformer<ConvertibleNut> transformer)
Adds a Pipe.Transformer.
addTransformer in interface ConvertibleNuttransformer - the transformerpublic void onReady(Pipe.OnReady callback)
Adds the given callback to be invoked once transformation occurs.
onReady in interface ConvertibleNutcallback - the callback to addpublic String getName()
Returns the name potentially altered by other components like transformers.
getName in interface ConvertibleNutpublic NutType getNutType()
Returns the nut type potentially modified by other components like transformers.
getNutType in interface ConvertibleNutpublic void addReferencedNut(ConvertibleNut referenced)
Adds a new nut referenced by this nut.
addReferencedNut in interface ConvertibleNutreferenced - the referenced nutpublic List<ConvertibleNut> getReferencedNuts()
Gets the nuts referenced by this nut.
getReferencedNuts in interface ConvertibleNutnull if no nut is referencedpublic List<ConvertibleNut> getOriginalNuts()
When this nut is the result of the transformation of another one, then it is actually a processed nut. This returns
a list of original nuts that have been transformed to obtain this nut. When this nut is actually an non-transformed
one, say an original nut, then the returned value should be null.
getOriginalNuts in interface ConvertibleNutnull if this nut is actually originalpublic InputStream openStream() throws IOException
Opens and returns an InputStream pointing to the nut.
openStream in interface NutIOException - if an I/O error occurspublic boolean isDynamic()
Indicates if this nut has a dynamic content, meaning that it could be changed each time Nut.openStream() is
invoked. In this case the nut should not be added to any cache and transformation chain should be applied.
isDynamic in interface NutisDynamic in class AbstractNuttrue if content is dynamic, false otherwisepublic String getParentFile()
If the file is stored in a directory on the file system, then this method returns the directory.
getParentFile in interface NutgetParentFile in class AbstractNutnull if the nut is not directly accessible on the file systempublic boolean equals(Object other)
equals in class AbstractNutpublic int hashCode()
hashCode in class AbstractNutCopyright © 2012-2015. All Rights Reserved.