You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Ran into a wall trying to write a converter for a class using a facade pattern. Here are my classes: @JsonObject
class Ribbon {
@JsonField
List tiles
}
class TileAsset {
private Metadata metadata
public TileAsset(Metadata metadata) {
mMetadata = metadata;
}
}
I am trying to write a type converter but have not found a way to implement it. This is an attempt:
public static class TileAssetConverter implements TypeConverter { @OverRide
public TileAsset parse(JsonParser jsonParser) throws IOException {
Mlog.d(TAG, "parse(%s)", jsonParser.getInputSource());
if (jsonParser.getInputSource() instanceof InputStream) {
// PROBLEM: jsonParser.getInputSource() is always null: need a way to get the input stream
// Next problem: is that jackson's parser needs to advance past this object when done
Metadata metadata = LoganSquare.parse((InputStream) jsonParser.getInputSource(), Metadata.class);
return new TileAsset(metadata);
}
return null;
}
Ran into a wall trying to write a converter for a class using a facade pattern. Here are my classes:
@JsonObject
class Ribbon {
@JsonField
List tiles
}
class TileAsset {
private Metadata metadata
public TileAsset(Metadata metadata) {
mMetadata = metadata;
}
}
@JsonObject
class Metadata {
}
I am trying to write a type converter but have not found a way to implement it. This is an attempt:
public static class TileAssetConverter implements TypeConverter {
@OverRide
public TileAsset parse(JsonParser jsonParser) throws IOException {
Mlog.d(TAG, "parse(%s)", jsonParser.getInputSource());
if (jsonParser.getInputSource() instanceof InputStream) {
// PROBLEM: jsonParser.getInputSource() is always null: need a way to get the input stream
// Next problem: is that jackson's parser needs to advance past this object when done
Metadata metadata = LoganSquare.parse((InputStream) jsonParser.getInputSource(), Metadata.class);
return new TileAsset(metadata);
}
return null;
}
The text was updated successfully, but these errors were encountered: