Module com.gluonhq.cloudlink.client
Class GluonCloudObjectDataReaderImpl<T>
- java.lang.Object
-
- com.gluonhq.impl.cloudlink.client.data.GluonCloudObjectDataReaderImpl<T>
-
- All Implemented Interfaces:
ObjectDataReader<T>
- Direct Known Subclasses:
GluonCloudObjectDataWriterImpl
public class GluonCloudObjectDataReaderImpl<T> extends Object implements ObjectDataReader<T>
-
-
Field Summary
Fields Modifier and Type Field Description protected static com.gluonhq.impl.cloudlink.client.data.GluonCloudLocalObjectDataWriter
localObjectDataWriter
protected GluonObservableObjectImpl<T>
observable
protected OperationMode
operationMode
-
Constructor Summary
Constructors Constructor Description GluonCloudObjectDataReaderImpl(GluonObservableObjectImpl<T> observable, IncomingSseProcessor sseProcessor, OperationMode mode, UserClient userClient)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected RestDataSource
createRestDataSource()
GluonObservableObject<T>
newGluonObservableObject()
Provide an instance of a GluonObservableObject.protected javax.json.JsonObject
readJsonObject(IODataSource dataSource)
T
readObject()
Reads the object and returns it.protected T
unmarshallObject(javax.json.JsonObject jsonObject)
-
-
-
Field Detail
-
localObjectDataWriter
protected static com.gluonhq.impl.cloudlink.client.data.GluonCloudLocalObjectDataWriter localObjectDataWriter
-
observable
protected GluonObservableObjectImpl<T> observable
-
operationMode
protected final OperationMode operationMode
-
-
Constructor Detail
-
GluonCloudObjectDataReaderImpl
public GluonCloudObjectDataReaderImpl(GluonObservableObjectImpl<T> observable, IncomingSseProcessor sseProcessor, OperationMode mode, UserClient userClient)
-
-
Method Detail
-
newGluonObservableObject
public GluonObservableObject<T> newGluonObservableObject()
Description copied from interface:ObjectDataReader
Provide an instance of a GluonObservableObject. This method is called byDataProvider.retrieveObject(ObjectDataReader)
to get a GluonObservableObject that will contain the actual object when the retrieve operation has completed successfully. Most implementations will just return an instance of GluonObservableObject itself. Note that it is perfectly valid to return existing instances of GluonObservableObject.- Specified by:
newGluonObservableObject
in interfaceObjectDataReader<T>
- Returns:
- an instance of a GluonObservableObject
-
createRestDataSource
protected RestDataSource createRestDataSource() throws IOException
- Throws:
IOException
-
readObject
public T readObject() throws IOException
Description copied from interface:ObjectDataReader
Reads the object and returns it. The actual source of the read and the method that converts the read data into an object instance is completely left to the implementation. This method is called byDataProvider.retrieveObject(ObjectDataReader)
to initiate the actual read process. The returned object will be set on the GluonObservableObject that is returned in theObjectDataReader.newGluonObservableObject()
method.- Specified by:
readObject
in interfaceObjectDataReader<T>
- Returns:
- the read object
- Throws:
IOException
- when an exception occurred during the read process
-
unmarshallObject
protected T unmarshallObject(javax.json.JsonObject jsonObject) throws IOException
- Throws:
IOException
-
readJsonObject
protected javax.json.JsonObject readJsonObject(IODataSource dataSource) throws IOException
- Throws:
IOException
-
-