|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.restlet.representation.Variant
org.restlet.representation.RepresentationInfo
org.restlet.representation.Representation
org.restlet.representation.StreamRepresentation
org.restlet.representation.OutputRepresentation
org.restlet.ext.emf.EmfRepresentation<T>
T - The type to wrap.public class EmfRepresentation<T extends EObject>
Representation based on the EMF library. By default, it can serialize and deserialize automatically in either XML, XMI or ECore.
| Field Summary |
|---|
| Fields inherited from class org.restlet.representation.Representation |
|---|
UNKNOWN_SIZE |
| Constructor Summary | |
|---|---|
EmfRepresentation(MediaType mediaType,
T object)
Constructor. |
|
EmfRepresentation(Representation representation)
Constructor. |
|
| Method Summary | |
|---|---|
protected Resource |
createEmfResource(MediaType mediaType)
Creates and configure an EMF resource. |
protected XMLResource |
createEmfXmlResource(MediaType mediaType)
Creates and configure an EMF resource. |
int |
getLineWidth()
Returns the maximum number of characters per line. |
protected Map<?,?> |
getLoadOptions()
Returns the loading options. |
T |
getObject()
Returns the wrapped object either parsed from the representation or to be formatted. |
protected Map<?,?> |
getSaveOptions()
Returns the saving options. |
boolean |
isUsingEncodedAttributeStyle()
Indicates if EMF references should be written as URI anchors. |
void |
setLineWidth(int lineWidth)
Sets the maximum number of characters per line. |
void |
setUsingEncodedAttributeStyle(boolean usingEncodedAttributeStyle)
Indicates if EMF references should be written as URI anchors. |
void |
write(EObject object,
OutputStream outputStream)
Writes the representation based on a given EMF object. |
void |
write(OutputStream outputStream)
If this representation wraps an EObject, then it tries to write
it as either XML, XMI or ECore/EMOF depending on the media type set. |
| Methods inherited from class org.restlet.representation.OutputRepresentation |
|---|
getChannel, getStream |
| Methods inherited from class org.restlet.representation.StreamRepresentation |
|---|
getReader, write, write |
| Methods inherited from class org.restlet.representation.Representation |
|---|
append, exhaust, getAvailableSize, getDigest, getDisposition, getExpirationDate, getRange, getRegistration, getSize, getText, hasKnownSize, isAvailable, isEmpty, isSelectable, isTransient, release, setAvailable, setDigest, setDisposition, setExpirationDate, setListener, setRange, setSize, setTransient |
| Methods inherited from class org.restlet.representation.RepresentationInfo |
|---|
getModificationDate, getTag, setModificationDate, setTag |
| Methods inherited from class org.restlet.representation.Variant |
|---|
createClientInfo, equals, getCharacterSet, getEncodings, getLanguages, getLocationRef, getMediaType, includes, isCompatible, setCharacterSet, setEncodings, setLanguages, setLocationRef, setLocationRef, setMediaType, toString |
| Methods inherited from class java.lang.Object |
|---|
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
|---|
public EmfRepresentation(MediaType mediaType,
T object)
mediaType - The target media type. Supported values are
MediaType.APPLICATION_XMI,
MediaType.APPLICATION_ECORE and XML media types.object - The object to format.public EmfRepresentation(Representation representation)
representation - The representation to parse.| Method Detail |
|---|
protected Resource createEmfResource(MediaType mediaType)
createEmfXmlResource(MediaType).
mediaType - The associated media type.
protected XMLResource createEmfXmlResource(MediaType mediaType)
mediaType - The associated media type (ECore, XMI or XML).
public int getLineWidth()
protected Map<?,?> getLoadOptions()
public T getObject()
throws IOException
IOExceptionprotected Map<?,?> getSaveOptions()
public boolean isUsingEncodedAttributeStyle()
public void setLineWidth(int lineWidth)
lineWidth - The maximum number of characters per line.public void setUsingEncodedAttributeStyle(boolean usingEncodedAttributeStyle)
usingEncodedAttributeStyle - True if EMF references should be written as URI anchors.
public void write(EObject object,
OutputStream outputStream)
throws IOException
object - The EMF object to serialize.outputStream - The target output stream.
IOException
public void write(OutputStream outputStream)
throws IOException
EObject, then it tries to write
it as either XML, XMI or ECore/EMOF depending on the media type set.
Note that in order to write this EObject, an EMF resource is
created, configured for proper serialization and the EObject is
then added to the content of this resource. This could has a side effect
of removing it from a previous resource/container.
write in class RepresentationIOException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||