-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added java friendly type converter per #588
- Loading branch information
Showing
1 changed file
with
19 additions
and
0 deletions.
There are no files selected for viewing
19 changes: 19 additions & 0 deletions
19
modules/swagger-core/src/main/scala/com/wordnik/swagger/converter/TypeConverter.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package com.wordnik.swagger.converter | ||
|
||
import scala.collection.mutable.HashMap | ||
|
||
class TypeConverter extends ModelConverter with BaseConverter { | ||
private val LOGGER = LoggerFactory.getLogger(this.getClass) | ||
|
||
val m = new HashMap[String, String] | ||
|
||
def read(cls: Class[_], typeMap: Map[String, String]): Option[Model] = None | ||
def add(sourceClassName: String, destClassName: String) = { | ||
m += sourceClassName.toLower -> destClassName | ||
} | ||
|
||
override def typeMap = m.toMap | ||
|
||
// don't expand mapped models | ||
override def ignoredClasses: Set[String] = m.keys.toSet | ||
} |