Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This PR migrates the remaining [Java files](https://github.com/search?q=repo%3ASRGSSR%2Fsrgdataprovider-android++language%3AJava&type=code) to Kotlin. Each file is migrated in a dedicated commit. To ensure that this doesn't break usages from either Java or Kotlin clients, I've created the following simple classes. They do not test the behavior, only that the API of each class remained the same. ```kotlin package ch.srg.dataProvider.integrationlayer import ch.srg.dataProvider.integrationlayer.data.remote.Quality import ch.srg.dataProvider.integrationlayer.data.remote.Resource import ch.srg.dataProvider.integrationlayer.data.remote.StreamingMethod import ch.srg.dataProvider.integrationlayer.request.IlHost import ch.srg.dataProvider.integrationlayer.utils.IlUrn import ch.srg.dataProvider.integrationlayer.utils.StreamComparator class KotlinUsages { fun ilHost() { IlHost.PROD IlHost.TEST IlHost.STAGE IlHost.MMF IlHost.MMF_PUBLIC IlHost.PROD_SAM IlHost.TEST_SAM IlHost.STAGE_SAM val ilHost = IlHost("custom-host", "my.il.host.com") ilHost.value ilHost.name ilHost.hostUri } fun streamComparator() { StreamComparator.SCORE_NOT_SUPPORTED val resource1 = Resource(url = "https://www.rts.ch/", quality = Quality.HD, streamingMethod = StreamingMethod.HLS) val resource2 = Resource(url = "https://www.srgssr.ch/", quality = Quality.SD, streamingMethod = StreamingMethod.DASH) val streamComparator = StreamComparator(emptyList(), emptyList(), emptyList(), false) streamComparator.compare(resource1, resource2) streamComparator.score(resource1) } fun ilUrn() { IlUrn.ASSET_VIDEO IlUrn.ASSET_VIDEO_SET IlUrn.ASSET_AUDIO IlUrn.ASSET_SHOW IlUrn.ASSET_GROUP IlUrn.isUrn("") IlUrn.format("", "", "") IlUrn.isAudio("") IlUrn.isVideo("") IlUrn.getId("") IlUrn.getAssetType("") val ilUrn1 = IlUrn("") val ilUrn2 = IlUrn("", "", "") ilUrn1.bu ilUrn1.assetType ilUrn1.id ilUrn1.isAudio ilUrn1.isVideo ilUrn1.isShow ilUrn1.equalsToString("") } } ``` ```java package ch.srg.dataProvider.integrationlayer; import java.util.Collections; import ch.srg.dataProvider.integrationlayer.data.remote.Resource; import ch.srg.dataProvider.integrationlayer.request.IlHost; import ch.srg.dataProvider.integrationlayer.utils.IlUrn; import ch.srg.dataProvider.integrationlayer.utils.StreamComparator; public class JavaUsages { void ilHost() { var prod = IlHost.PROD; var test = IlHost.TEST; var stage = IlHost.STAGE; var mmf = IlHost.MMF; var mmfPublic = IlHost.MMF_PUBLIC; var prodSam = IlHost.PROD_SAM; var testSam = IlHost.TEST_SAM; var stageSam = IlHost.STAGE_SAM; var ilHost = new IlHost("custom-host", "my.il.host.com"); ilHost.getValue(); ilHost.getName(); ilHost.getHostUri(); } void streamComparator() { var scoreNotSupported = StreamComparator.SCORE_NOT_SUPPORTED; var resource1 = new Resource(); // This doesn't compile, but the goal is just to see if calls on `StreamComparator` are fine var resource2 = new Resource(); // This doesn't compile, but the goal is just to see if calls on `StreamComparator` are fine var streamComparator = new StreamComparator(Collections.emptyList(), Collections.emptyList(), Collections.emptyList(), false); streamComparator.compare(resource1, resource2); streamComparator.score(resource1); } void ilUrn() { var assetVideo = IlUrn.ASSET_VIDEO; var assetVideoSet = IlUrn.ASSET_VIDEO_SET; var assetAudio = IlUrn.ASSET_AUDIO; var assetShow = IlUrn.ASSET_SHOW; var assetGroup = IlUrn.ASSET_GROUP; IlUrn.isUrn(""); IlUrn.format("", "", ""); IlUrn.isAudio(""); IlUrn.isVideo(""); IlUrn.getId(""); IlUrn.getAssetType(""); var ilUrn1 = new IlUrn(""); var ilUrn2 = new IlUrn("", "", ""); ilUrn1.getBu(); ilUrn1.getAssetType(); ilUrn1.getId(); ilUrn1.isAudio(); ilUrn1.isVideo(); ilUrn1.isShow(); ilUrn1.equalsToString(""); } } ``` These should work the same way on the `master` branch and in this PR. --------- Co-authored-by: Joaquim Stähli <[email protected]>
- Loading branch information