Skip to content

Commit

Permalink
Add getSupportedContentFormat to LwM2mNode/Encoder/Decoder
Browse files Browse the repository at this point in the history
  • Loading branch information
sbernard31 committed Jun 3, 2021
1 parent f15debb commit 67e77aa
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;

import org.eclipse.leshan.core.model.LwM2mModel;
import org.eclipse.leshan.core.node.LwM2mNode;
Expand Down Expand Up @@ -244,4 +245,9 @@ public static Class<? extends LwM2mNode> nodeClassFromPath(LwM2mPath path) {
public boolean isSupported(ContentFormat format) {
return nodeDecoders.get(format) != null;
}

@Override
public Set<ContentFormat> getSupportedContentFormat() {
return nodeDecoders.keySet();
};
}
Original file line number Diff line number Diff line change
Expand Up @@ -221,4 +221,9 @@ public byte[] encodePaths(List<LwM2mPath> paths, ContentFormat format) throws Co
public boolean isSupported(ContentFormat format) {
return nodeEncoders.get(format) != null;
}

@Override
public Set<ContentFormat> getSupportedContentFormat() {
return nodeEncoders.keySet();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

import java.util.List;
import java.util.Map;
import java.util.Set;

import org.eclipse.leshan.core.model.LwM2mModel;
import org.eclipse.leshan.core.node.LwM2mNode;
Expand Down Expand Up @@ -111,4 +112,9 @@ List<TimestampedLwM2mNode> decodeTimestampedData(byte[] content, ContentFormat f
*/
boolean isSupported(ContentFormat format);

/**
* @return {@link ContentFormat} supported by this decoder
*/
Set<ContentFormat> getSupportedContentFormat();

}
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

import java.util.List;
import java.util.Map;
import java.util.Set;

import org.eclipse.leshan.core.model.LwM2mModel;
import org.eclipse.leshan.core.node.LwM2mNode;
Expand Down Expand Up @@ -86,4 +87,9 @@ byte[] encodeTimestampedData(List<TimestampedLwM2mNode> timestampedNodes, Conten
* return true is the given {@link ContentFormat} is supported
*/
boolean isSupported(ContentFormat format);

/**
* @return {@link ContentFormat} supported by this Encoder
*/
Set<ContentFormat> getSupportedContentFormat();
}

0 comments on commit 67e77aa

Please sign in to comment.