public interface ConvertibleNut extends Nut
A convertible nut has a content which can be transformed with a chain of transformers
.
During transformation, the state of the nut can change and not only its content. For instance, the nut becomes
compressed or refers new nuts.
Transformation process should change the state once. The implementation has to deal with this to not let the transformers add duplicated data to the nut's state.
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 . |
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.
|
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.
|
Boolean |
isCompressed()
Indicates if the nut is compressed.
|
boolean |
isSubResource()
Indicates if this nut is a sub resource of the nut referencing it.
|
boolean |
isTransformed()
Indicates if this nut is transformed or not.
|
void |
onReady(Pipe.OnReady onReady)
Adds the given callback to be invoked once transformation occurs.
|
void |
setIsCompressed(Boolean c)
Indicates if the nut is compressed.
|
void |
setIsSubResource(boolean subResource)
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.
|
void |
transform(Pipe.OnReady... onReady)
Transforms the source stream with all registered transformers and calls the given callback in addition
to callbacks previously registered.
|
getInitialName, getInitialNutType, getParentFile, getProxyUri, getVersionNumber, isDynamic, openStream, setProxyUri
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
.
null
if this nut is actually originalString getName()
Returns the name potentially altered by other components like transformers.
NutType getNutType()
Returns the nut type potentially modified by other components like transformers.
void setNutName(String nutName)
Sets the nut name.
nutName
- the namevoid setNutType(NutType nutType)
Sets the nut type.
nutType
- the new nut typevoid transform(Pipe.OnReady... onReady) throws IOException
Transforms the source stream with all registered transformers and calls the given callback in addition to callbacks previously registered. The method also writes the result to the given output stream.
onReady
- the callbackIOException
- if an I/O error occursvoid onReady(Pipe.OnReady onReady)
Adds the given callback to be invoked once transformation occurs.
onReady
- the callback to addList<Pipe.OnReady> getReadyCallbacks()
Gets the callbacks notified when transformation has been done.
void addTransformer(Pipe.Transformer<ConvertibleNut> transformer)
Adds a Pipe.Transformer
.
transformer
- the transformerSet<Pipe.Transformer<ConvertibleNut>> getTransformers()
Gets the registered transformers. The set must be ordered.
void addReferencedNut(ConvertibleNut referenced)
Adds a new nut referenced by this nut.
referenced
- the referenced nutList<ConvertibleNut> getReferencedNuts()
Gets the nuts referenced by this nut.
null
if no nut is referencedboolean isTransformed()
Indicates if this nut is transformed or not.
true
if transformed, false
otherwisevoid setIsCompressed(Boolean c)
Indicates if the nut is compressed.
c
- true
if the nut is compressed, false
otherwiseBoolean isCompressed()
Indicates if the nut is compressed.
true
if the nut is compressed, false
otherwiseboolean isSubResource()
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.
true
if the nut is a sub resource, false
otherwisevoid setIsSubResource(boolean subResource)
Mark this nut as a sub resource or not.
subResource
- true
if the nut is a sub resource, false
otherwiseCopyright © 2012-2015. All Rights Reserved.