All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.twitter.finatra.json.internal.caseclass.jackson.ImmutableAnnotations.scala Maven / Gradle / Ivy

There is a newer version: 2.1.6
Show newest version
package com.twitter.finatra.json.internal.caseclass.jackson

import com.fasterxml.jackson.databind.util.Annotations
import com.twitter.finatra.conversions.seq._
import java.lang.annotation.Annotation

case class ImmutableAnnotations(
  annotations: Seq[Annotation])
  extends Annotations {

  private val annotationsMap: Map[Class[_ <: Annotation], Annotation] =
    annotations.groupBySingleValue(_.annotationType)

  override def get[A <: Annotation](cls: Class[A]): A = {
    annotationsMap.get(cls).orNull.asInstanceOf[A]
  }

  override def size(): Int = {
    annotationsMap.size
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy