object ScalaReflection extends ScalaReflection
A default version of ScalaReflection that uses the runtime universe.
- Alphabetic
- By Inheritance
- ScalaReflection
- ScalaReflection
- Logging
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Type Members
Value Members
- final def !=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def ##: Int
- Definition Classes
- AnyRef → Any
- final def ==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- def attributesFor[T](implicit arg0: scala.reflect.api.JavaUniverse.TypeTag[T]): Seq[Attribute]
Returns a Sequence of attributes for the given case class type.
- def cleanUpReflectionObjects[T](func: => T): T
Any codes calling
scala.reflect.api.Types.TypeApi.<:<should be wrapped by this method to clean up the Scala reflection garbage automatically.Any codes calling
scala.reflect.api.Types.TypeApi.<:<should be wrapped by this method to clean up the Scala reflection garbage automatically. Otherwise, it will leak some objects toscala.reflect.runtime.JavaUniverse.undoLog.- Definition Classes
- ScalaReflection
- See also
https://github.com/scala/bug/issues/8302
- def clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @native()
- def constructParams(tpe: scala.reflect.api.JavaUniverse.Type): Seq[scala.reflect.api.JavaUniverse.Symbol]
- Attributes
- protected
- Definition Classes
- ScalaReflection
- def dataTypeFor[T](implicit arg0: scala.reflect.api.JavaUniverse.TypeTag[T]): DataType
Returns the Spark SQL DataType for a given scala type.
Returns the Spark SQL DataType for a given scala type. Where this is not an exact mapping to a native type, an ObjectType is returned. Special handling is also used for Arrays including those that hold primitive types.
Unlike
schemaFor, this function doesn't do any massaging of types into the Spark SQL type system. As a result, ObjectType will be returned for things like boxed Integers - def dataTypeJavaClass(dt: DataType): Class[_]
- def definedByConstructorParams(tpe: scala.reflect.api.JavaUniverse.Type): Boolean
Whether the fields of the given type is defined entirely by its constructor parameters.
- def deserializerForType(tpe: scala.reflect.api.JavaUniverse.Type): Expression
Returns an expression that can be used to deserialize a Spark SQL representation to an object of type
Twith a compatible schema.Returns an expression that can be used to deserialize a Spark SQL representation to an object of type
Twith a compatible schema. The Spark SQL representation is located at ordinal 0 of a row, i.e.,GetColumnByOrdinal(0, _). Nested classes will have their fields accessed usingUnresolvedExtractValue.The returned expression is used by
ExpressionEncoder. The encoder will resolve and bind this deserializer expression when using it. - def encodeFieldNameToIdentifier(fieldName: String): String
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def equals(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef → Any
- def expressionJavaClasses(arguments: Seq[Expression]): Seq[Class[_]]
- def finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.Throwable])
- def findConstructor[T](cls: Class[T], paramTypes: Seq[Class[_]]): Option[(Seq[AnyRef]) => T]
Finds an accessible constructor with compatible parameters.
Finds an accessible constructor with compatible parameters. This is a more flexible search than the exact matching algorithm in
Class.getConstructor. The first assignment-compatible matching constructor is returned if it exists. Otherwise, we check for additional compatible constructors defined in the companion object asapplymethods. Otherwise, it returnsNone. - final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- def getClassFromType(tpe: scala.reflect.api.JavaUniverse.Type): Class[_]
- def getClassNameFromType(tpe: scala.reflect.api.JavaUniverse.Type): String
Returns the full class name for a type.
Returns the full class name for a type. The returned name is the canonical Scala name, where each component is separated by a period. It is NOT the Java-equivalent runtime name (no dollar signs).
In simple cases, both the Scala and Java names are the same, however when Scala generates constructs that do not map to a Java equivalent, such as singleton objects or nested classes in package objects, it uses the dollar sign ($) to create synthetic classes, emulating behaviour in Java bytecode.
- def getConstructorParameterNames(cls: Class[_]): Seq[String]
Returns the parameter names for the primary constructor of this class.
Returns the parameter names for the primary constructor of this class.
Logically we should call
getConstructorParametersand throw away the parameter types to get parameter names, however there are some weird scala reflection problems and this method is a workaround to avoid getting parameter types. - def getConstructorParameterValues(obj: DefinedByConstructorParams): Seq[AnyRef]
Returns the parameter values for the primary constructor of this class.
- def getConstructorParameters(cls: Class[_]): Seq[(String, scala.reflect.api.JavaUniverse.Type)]
Returns the parameter names and types for the primary constructor of this class.
Returns the parameter names and types for the primary constructor of this class.
Note that it only works for scala classes with primary constructor, and currently doesn't support inner class.
- def getConstructorParameters(tpe: scala.reflect.api.JavaUniverse.Type): Seq[(String, scala.reflect.api.JavaUniverse.Type)]
Returns the parameter names and types for the primary constructor of this type.
Returns the parameter names and types for the primary constructor of this type.
Note that it only works for scala classes with primary constructor, and currently doesn't support inner class.
- Definition Classes
- ScalaReflection
- def hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- def initializeLogIfNecessary(isInterpreter: Boolean, silent: Boolean): Boolean
- Attributes
- protected
- Definition Classes
- Logging
- def initializeLogIfNecessary(isInterpreter: Boolean): Unit
- Attributes
- protected
- Definition Classes
- Logging
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- def isNativeType(dt: DataType): Boolean
Returns true if the value of this data type is same between internal and external.
- def isTraceEnabled(): Boolean
- Attributes
- protected
- Definition Classes
- Logging
- def javaBoxedType(dt: DataType): Class[_]
- def localTypeOf[T](implicit arg0: scala.reflect.api.JavaUniverse.TypeTag[T]): scala.reflect.api.JavaUniverse.Type
Return the Scala Type for
Tin the current classloader mirror.Return the Scala Type for
Tin the current classloader mirror.Use this method instead of the convenience method
universe.typeOf, which assumes that all types can be found in the classloader that loaded scala-reflect classes. That's not necessarily the case when running using Eclipse launchers or even Sbt console or test (withoutfork := true).- Definition Classes
- ScalaReflection
- See also
SPARK-5281
- def log: Logger
- Attributes
- protected
- Definition Classes
- Logging
- def logDebug(msg: => String, throwable: Throwable): Unit
- Attributes
- protected
- Definition Classes
- Logging
- def logDebug(msg: => String): Unit
- Attributes
- protected
- Definition Classes
- Logging
- def logError(msg: => String, throwable: Throwable): Unit
- Attributes
- protected
- Definition Classes
- Logging
- def logError(msg: => String): Unit
- Attributes
- protected
- Definition Classes
- Logging
- def logInfo(msg: => String, throwable: Throwable): Unit
- Attributes
- protected
- Definition Classes
- Logging
- def logInfo(msg: => String): Unit
- Attributes
- protected
- Definition Classes
- Logging
- def logName: String
- Attributes
- protected
- Definition Classes
- Logging
- def logTrace(msg: => String, throwable: Throwable): Unit
- Attributes
- protected
- Definition Classes
- Logging
- def logTrace(msg: => String): Unit
- Attributes
- protected
- Definition Classes
- Logging
- def logWarning(msg: => String, throwable: Throwable): Unit
- Attributes
- protected
- Definition Classes
- Logging
- def logWarning(msg: => String): Unit
- Attributes
- protected
- Definition Classes
- Logging
- def mirror: Mirror
The mirror used to access types in the universe
The mirror used to access types in the universe
- Definition Classes
- ScalaReflection → ScalaReflection
- final def ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- final def notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- def optionOfProductType(tpe: scala.reflect.api.JavaUniverse.Type): Boolean
Returns true if the given type is option of product type, e.g.
Returns true if the given type is option of product type, e.g.
Option[Tuple2]. Note that, we also treat DefinedByConstructorParams as product type. - def schemaFor(tpe: scala.reflect.api.JavaUniverse.Type): Schema
Returns a catalyst DataType and its nullability for the given Scala Type using reflection.
- def schemaFor[T](implicit arg0: scala.reflect.api.JavaUniverse.TypeTag[T]): Schema
Returns a catalyst DataType and its nullability for the given Scala Type using reflection.
- def serializerForType(tpe: scala.reflect.api.JavaUniverse.Type): Expression
Returns an expression for serializing an object of type T to Spark SQL representation.
Returns an expression for serializing an object of type T to Spark SQL representation. The input object is located at ordinal 0 of a row, i.e.,
BoundReference(0, _).If the given type is not supported, i.e. there is no encoder can be built for this type, an UnsupportedOperationException will be thrown with detailed error message to explain the type path walked so far and which class we are not supporting. There are 4 kinds of type path: * the root type:
root class: "abc.xyz.MyClass"* the value type of Option:option value class: "abc.xyz.MyClass"* the element type of Array or Seq:array element class: "abc.xyz.MyClass"* the field of Product:field (class: "abc.xyz.MyClass", name: "myField") - final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- def toString(): String
- Definition Classes
- AnyRef → Any
- val typeBoxedJavaMapping: Map[DataType, Class[_]]
- val typeJavaMapping: Map[DataType, Class[_]]
- val universe: scala.reflect.runtime.universe.type
The universe we work in (runtime or macro)
The universe we work in (runtime or macro)
- Definition Classes
- ScalaReflection → ScalaReflection
- final def wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException]) @native()