Movatterモバイル変換


[0]ホーム

URL:


Scala 3
3.7.4
LearnInstallPlaygroundFind A LibraryCommunityBlog
Scala 3
LearnInstallPlaygroundFind A LibraryCommunityBlog
DocsAPI
Generated with
Copyright (c) 2002-2025, LAMP/EPFL
Copyright (c) 2002-2025, LAMP/EPFL
Scala 3/scala/scala.reflect

scala.reflect

Members list

Type members

Classlikes

abstractclassAnyValManifest[T <:AnyVal](valtoString:String) extendsManifest[T],Equals

Attributes

Source
Manifest.scala
Supertypes
traitManifest[T]
traitClassTag[T]
traitEquals
traitOptManifest[T]
classObject
traitMatchable
classAny
Show all

ClassManifestFactory defines factory methods for manifests.

ClassManifestFactory defines factory methods for manifests. It is intended for use by the compiler and should not be used in client code.

UnlikeClassManifest, this factory isn't annotated with a deprecation warning. This is done to prevent avalanches of deprecation warnings in the code that calls methods with manifests.

In a perfect world, we would just remove the @deprecated annotation fromClassManifest the object and then delete it in 2.11. After all, that object is explicitly marked as internal, so no one should use it. However a lot of existing libraries disregarded the Scaladoc that comes withClassManifest, so we need to somehow nudge them into migrating prior to removing stuff out of the blue. Hence we've introduced this design decision as the lesser of two evils.

Attributes

Source
ClassManifestDeprecatedApis.scala
Supertypes
classObject
traitMatchable
classAny
Self type

AClassTag[T] stores the erased class of a given typeT, accessible via theruntimeClass field.

AClassTag[T] stores the erased class of a given typeT, accessible via theruntimeClass field. This is particularly useful for instantiatingArrays whose element types are unknown at compile time.

ClassTags are a weaker special case ofscala.reflect.api.TypeTags.TypeTags, in that they wrap only the runtime class of a given type, whereas aTypeTag contains all static type information. That is,ClassTags are constructed from knowing only the top-level class of a type, without necessarily knowing all of its argument types. This runtime information is enough for runtimeArray creation.

For example:

scala> def mkArray[T : ClassTag](elems: T*) = Array[T](elems: _*)mkArray: [T](elems: T*)(implicit evidence$1: scala.reflect.ClassTag[T])Array[T]scala> mkArray(42, 13)res0: Array[Int] = Array(42, 13)scala> mkArray("Japan","Brazil","Germany")res1: Array[String] = Array(Japan, Brazil, Germany)

Seescala.reflect.api.TypeTags for more examples, or theReflection Guide: TypeTags for more details.

Attributes

Companion
object
Source
ClassTag.scala
Supertypes
traitEquals
traitOptManifest[T]
classObject
traitMatchable
classAny
Show all
Known subtypes
traitManifest[T]
objectClassTag

Class tags corresponding to primitive types and constructor/extractor for ClassTags.

Class tags corresponding to primitive types and constructor/extractor for ClassTags.

Attributes

Companion
trait
Source
ClassTag.scala
Supertypes
classObject
traitMatchable
classAny
Self type

A base trait of all Scala enum definitions

A base trait of all Scala enum definitions

Attributes

Source
Enum.scala
Supertypes
traitProduct
traitEquals
classAny
traitManifest[T] extendsClassTag[T],Equals

AManifest[T] is an opaque descriptor for type T.

AManifest[T] is an opaque descriptor for type T. Its supported use is to give access to the erasure of the type as aClass instance, as is necessary for the creation of nativeArrays if the class is not known at compile time.

The type-relation operators<:< and=:= should be considered approximations only, as there are numerous aspects of type conformance which are not yet adequately represented in manifests.

Example usages:

def arr[T] = new Array[T](0)                          // does not compiledef arr[T](implicit m: Manifest[T]) = new Array[T](0) // compilesdef arr[T: Manifest] = new Array[T](0)                // shorthand for the preceding// Methods manifest and optManifest are in [[scala.Predef]].def isApproxSubType[T: Manifest, U: Manifest] = manifest[T] <:< manifest[U]isApproxSubType[List[String], List[AnyRef]] // trueisApproxSubType[List[String], List[Int]]    // falsedef methods[T: Manifest] = manifest[T].runtimeClass.getMethodsdef retType[T: Manifest](name: String) =  methods[T] find (_.getName == name) map (_.getGenericReturnType)retType[Map[_, _]]("values")  // Some(scala.collection.Iterable<B>)

Attributes

Companion
object
Source
Manifest.scala
Supertypes
traitClassTag[T]
traitEquals
traitOptManifest[T]
classObject
traitMatchable
classAny
Show all
Known subtypes
objectManifest

The objectManifest defines factory methods for manifests.

The objectManifest defines factory methods for manifests. It is intended for use by the compiler and should not be used in client code.

Attributes

Companion
trait
Source
Manifest.scala
Supertypes
classObject
traitMatchable
classAny
Self type

ManifestFactory defines factory methods for manifests.

ManifestFactory defines factory methods for manifests. It is intended for use by the compiler and should not be used in client code.

UnlikeManifest, this factory isn't annotated with a deprecation warning. This is done to prevent avalanches of deprecation warnings in the code that calls methods with manifests. Why so complicated? Read up the comments forClassManifestFactory.

Attributes

Source
Manifest.scala
Supertypes
classObject
traitMatchable
classAny
Self type

Provides functions to encode and decode Scala symbolic names.

Provides functions to encode and decode Scala symbolic names. Also provides some constants.

Attributes

Source
NameTransformer.scala
Supertypes
classObject
traitMatchable
classAny
Self type

One of the branches of anscala.reflect.OptManifest.

One of the branches of anscala.reflect.OptManifest.

Attributes

Source
NoManifest.scala
Supertypes
classObject
traitMatchable
classAny
Self type
traitOptManifest[+T] extendsSerializable

AOptManifest[T] is an optionalscala.reflect.Manifest.

AOptManifest[T] is an optionalscala.reflect.Manifest.

It is either aManifest or the valueNoManifest.

Attributes

Source
OptManifest.scala
Supertypes
classObject
traitMatchable
classAny
Known subtypes

A class that implements structural selections using Java reflection.

A class that implements structural selections using Java reflection.

It can be used as a supertrait of a class or be made available as an implicit conversion viareflectiveSelectable.

In Scala.js, it is implemented using a separate Scala.js-specific mechanism, since Java reflection is not available.

Attributes

Companion
object
Source
Selectable.scala
Supertypes
classObject
traitMatchable
classAny

Attributes

Companion
trait
Source
Selectable.scala
Supertypes
classObject
traitMatchable
classAny
Self type
traitTypeTest[-S,T] extendsSerializable

ATypeTest[S, T] contains the logic needed to know at runtime if a value of typeS is an instance ofT.

ATypeTest[S, T] contains the logic needed to know at runtime if a value of typeS is an instance ofT.

If a pattern match is performed on a term of types: S that is uncheckable withs.isInstanceOf[T] and the pattern is one of the following forms:

  • t: T
  • t @ X() whereX.unapply takes an argument of typeT then a given instance ofTypeTest[S, T] is summoned and used to perform the test.

Attributes

Companion
object
Source
TypeTest.scala
Supertypes
classObject
traitMatchable
classAny
objectTypeTest

Attributes

Companion
trait
Source
TypeTest.scala
Supertypes
classObject
traitMatchable
classAny
Self type

Deprecated classlikes

Attributes

Deprecated
[Since version 2.10.0]use scala.reflect.ClassTag instead
Source
ClassManifestDeprecatedApis.scala
Supertypes
traitOptManifest[T]
classObject
traitMatchable
classAny
Known subtypes
traitClassTag[T]
traitManifest[T]
Self type

Types

typeTypeable[T] =TypeTest[Any,T]

A shorhand forTypeTest[Any, T]. ATypeable[T] contains the logic needed to know at runtime if a value can be downcasted toT`.

A shorhand forTypeTest[Any, T]. ATypeable[T] contains the logic needed to know at runtime if a value can be downcasted toT`.

If a pattern match is performed on a term of types: Any that is uncheckable withs.isInstanceOf[T] and the pattern are of the form:

  • t: T
  • t @ X() where theX.unapply has takes an argument of typeT then a given instance ofTypeable[T] (TypeTest[Any, T]) is summoned and used to perform the test.

Attributes

Source
Typeable.scala

Deprecated types

AClassManifest[T] is an opaque descriptor for typeT.

AClassManifest[T] is an opaque descriptor for typeT. It is used by the compiler to preserve information necessary for instantiatingArrays in those cases where the element type is unknown at compile time.

The type-relation operators make an effort to present a more accurate picture than can be realized with erased types, but they should not be relied upon to give correct answers. In particular they are likely to be wrong when variance is involved or when a subtype has a different number of type arguments than a supertype.

Attributes

Deprecated
[Since version 2.10.0]use scala.reflect.ClassTag instead
Source
package.scala

Value members

Concrete methods

defclassTag[T](implicitctag:ClassTag[T]):ClassTag[T]

Attributes

Source
package.scala

Make a java reflection object accessible, if it is not already and it is possible to do so.

Make a java reflection object accessible, if it is not already and it is possible to do so. If a SecurityException is thrown in the attempt, it is caught and discarded.

Attributes

Source
package.scala

Deprecated fields

The objectClassManifest defines factory methods for manifests.

The objectClassManifest defines factory methods for manifests. It is intended for use by the compiler and should not be used in client code.

Attributes

Deprecated
[Since version 2.10.0]use scala.reflect.ClassTag instead
Source
package.scala
In this article
Generated with
Copyright (c) 2002-2025, LAMP/EPFL
Copyright (c) 2002-2025, LAMP/EPFL

[8]ページ先頭

©2009-2025 Movatter.jp