Fork me on GitHub

java中调用scala

案例

说明:主要参照spark源码

编写scala类及半生对象

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
package org.apache.spark.sql.types

import org.apache.spark.annotation.Stable

/**
* The data type representing `NULL` values. Please use the singleton `DataTypes.NullType`.
*
* @since 1.3.0
*/
@Stable
class NullType private() extends DataType {
// The companion object and this class is separated so the companion object also subclasses
// this type. Otherwise, the companion object would be of type "NullType$" in byte code.
// Defined with a private constructor so the companion object is the only possible instantiation.
override def defaultSize: Int = 1

private[spark] override def asNullable: NullType = this
}

/**
* @since 1.3.0
*/
@Stable
case object NullType extends NullType

在java中调用scala

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
package org.apache.spark.sql.types;

import java.util.*;

import org.apache.spark.annotation.Stable;

/**
* To get/create specific data type, users should use singleton objects and factory methods
* provided by this class.
*
* @since 1.3.0
*/
@Stable
public class DataTypes {
/**
* Gets the NullType object.
*/
public static final DataType NullType = NullType$.MODULE$;

本文标题:java中调用scala

文章作者:tang

发布时间:2019年04月20日 - 19:04

最后更新:2019年04月20日 - 19:04

原始链接:https://tgluon.github.io/2019/04/20/java中调用scala/

许可协议: 署名-非商业性使用-禁止演绎 4.0 国际 转载请保留原文链接及作者。

-------------本文结束感谢您的阅读-------------