Skip to content

Commit

Permalink
Make SuperCodec package private again.
Browse files Browse the repository at this point in the history
  • Loading branch information
TomasMikula committed Jun 10, 2016
1 parent 7b17145 commit 290a4e7
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
import java.util.Collections;

import org.fxmisc.richtext.model.Codec;
import org.fxmisc.richtext.model.SuperCodec;
import org.fxmisc.richtext.model.EditableStyledDocument;
import org.fxmisc.richtext.model.SimpleEditableStyledDocument;

Expand All @@ -22,8 +21,8 @@ public StyleClassedTextArea(EditableStyledDocument<Collection<String>, Collectio
);

setStyleCodecs(
SuperCodec.upCast(SuperCodec.collectionListCodec(Codec.STRING_CODEC)),
SuperCodec.upCast(SuperCodec.collectionListCodec(Codec.STRING_CODEC))
Codec.collectionCodec(Codec.STRING_CODEC),
Codec.collectionCodec(Codec.STRING_CODEC)
);
}
public StyleClassedTextArea(boolean preserveStyle) {
Expand Down
5 changes: 5 additions & 0 deletions richtextfx/src/main/java/org/fxmisc/richtext/model/Codec.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import java.io.DataInputStream;
import java.io.DataOutputStream;
import java.io.IOException;
import java.util.Collection;
import java.util.List;
import java.util.Optional;

Expand Down Expand Up @@ -64,6 +65,10 @@ static <T> Codec<List<T>> listCodec(Codec<T> elemCodec) {
return SuperCodec.collectionListCodec(elemCodec);
}

static <T> Codec<Collection<T>> collectionCodec(Codec<T> elemCodec) {
return SuperCodec.upCast(SuperCodec.collectionListCodec(elemCodec));
}

static <T> Codec<Optional<T>> optionalCodec(Codec<T> elemCodec) {
return new Codec<Optional<T>>() {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import java.util.Collection;
import java.util.List;

public interface SuperCodec<S, T extends S> extends Codec<T> {
interface SuperCodec<S, T extends S> extends Codec<T> {
void encodeSuper(DataOutputStream os, S s) throws IOException;

@Override
Expand Down

0 comments on commit 290a4e7

Please sign in to comment.