|
Play Framework/Scala example source code file (AggregateFileRepository.scala)
The AggregateFileRepository.scala Play Framework example source code/* * Copyright (C) 2009-2014 Typesafe Inc. <http://www.typesafe.com> */ package play.docs import java.io.InputStream import play.doc.{ FileHandle, FileRepository } /** * A file repository that aggregates multiple file repositories * * @param repos The repositories to aggregate */ class AggregateFileRepository(repos: Seq[FileRepository]) extends FileRepository { def this(repos: Array[FileRepository]) = this(repos.toSeq) private def fromFirstRepo[A](load: FileRepository => Option[A]) = repos.collectFirst(Function.unlift(load)) def loadFile[A](path: String)(loader: (InputStream) => A) = fromFirstRepo(_.loadFile(path)(loader)) def handleFile[A](path: String)(handler: (FileHandle) => A) = fromFirstRepo(_.handleFile(path)(handler)) def findFileWithName(name: String) = fromFirstRepo(_.findFileWithName(name)) } Other Play Framework source code examplesHere is a short list of links related to this Play Framework AggregateFileRepository.scala source code file: |
... this post is sponsored by my books ... | |
#1 New Release! |
FP Best Seller |
Copyright 1998-2021 Alvin Alexander, alvinalexander.com
All Rights Reserved.
A percentage of advertising revenue from
pages under the /java/jwarehouse
URI on this website is
paid back to open source projects.