The Scala API the InKey and OutKey aliases of type Partition. Type Aliases in Scala: def compileInFn(in:(InKey,InMeta)):Iterable[(OutKey,IntermediateData)]={//InKey and OutKey are aliases of Key //InMeta is alias of Meta //… Equivalent code in Java:.public Iterable<Pair<Key,IntermediateData>>compileInFn(Pair<Key,Meta>in){//…Symbol class in Scala: //Catalog.id and Layer.Id are aliases of Symbol val OutKey=inKey. copy(catalog=Default.OutCatalogId,layer=Layer.Id(“output-layer”)) Equivalent in Java: //Default.OutCatalogId( )and the layer ID are String objects Key outKey=inKey.withCatalog(Default.OutCatalogId( )).withLayer(“output-layer” ); Collections in Scala: def resolveFn(src:(InKey,InMeta)):Map[RefNameMesstone,Set[InKey]]={//… Equipment code in Java: public Map<String,Set<Key>>resolveFn(Pair<Key,Meta>src){//…Option type in Scala: def compileOutFn(outKey:OutKey,intermediate:Iterable[IntermediateData]):Option[Payload]={if(intermediate.isEmpty){None}else{Some(Payload(encodeData(Intermediate)))}}Equivalent code in Java: public Optional<Payload>compileOutFn(Key outKey,Iterable<IntermediateData>imtermediate){if(intermediate.iterator( ).hasNext( )){return Optional.of(new Payload(encodeData(intermediate)));}else{return Optional.empty( );}}Compiler mixins in Scala: class MyCompiler extends RefTreeCompiler[IntermediateData] withCompileInFnWithRefs[IntermediateData]with CompileOut1To1Fn[IntermediateData]{Equivalent code in Java:class MyCompiler implements RefTreeCompiler<IntermediateData>CompileInFnWithRefs<InrermediateData>,CompileOut1To1Fn<IntermediateData>{Extending a PipelineRunner in Scala: object Main extends PipelineRunner with DriverSetupWithBuilder {//configureCompiler provided by DriverSetupWithBuilder def configureCompiler(completeConfig:CompleteConfig,context: DriverContext,builder: DriverBuilder): builder.type={//… Equivalent code in Java:class Main extends PipelineRunner {//confugureCompiler directly provided by PipelineRunner @Override public DriverBuilder configureCompiler(completeConfig completeConfig, DriverContext context, DriverBuilder builder){//…

Leave a comment