`
seasons
  • 浏览: 107739 次
  • 来自: 北京
最近访客 更多访客>>
社区版块
存档分类
最新评论

关于Marker Interface

阅读更多
以前对Maker Interface一直不是特别清晰, 在网上搜了一下, 是这么说的, 回头再仔细看看. 特别是JVM如何处理Maker Interface的

Marker Interfaces are giving specification to the JVM about the implementing classes.
One of the features of the Java programming language is that it mandates a separation between interfaces (pure behavior) and classes (state and behavior). Interfaces are used in Java to specify the behavior of derived classes. Often you will come across interfaces in Java that have no behavior. In other words, they are just empty interface definitions. These are known as marker interfaces. Marker interfaces are also called "tag" interfaces since they tag all the derived classes into a category based on their purpose.
Some examples of marker interfaces in the Java API include: -
Java.lang.Cloneable
A class implements the Cloneable interface to indicate to the Object.clone() method that it is legal for that method to make a field-for-field copy of instances of that class.
java.io.Serializable
Serialization is nothing but s saving the state of an object to persistent storage as byte stream. Serializability of a class is enabled by the class implementing the java.io.Serializable interface. Classes that do not implement this interface will not have any of their state serialized or deserialized. All subtypes of a serializable class are themselves serializable. The serialization interface has no methods or fields and serves only to identify the semantics of being serializable. To allow subtypes of non-serializable classes to be serialized, the subtype may assume responsibility for saving and restoring the state of the supertype's public, protected, and (if accessible) package fields. The subtype may assume this responsibility only if the class it extends has an accessible no-arg constructor to initialize the class's state. It is an error to declare a class Serializable if this is not the case. The error will be detected at runtime.
java.util.EventListener
A tagging interface that all event listener interfaces must extend.
java.rmi.Remote
The Remote interface serves to identify interfaces whose methods may be invoked from a non-local virtual machine. Any object that is a remote object must directly or indirectly implement this interface. Only those methods specified in a "remote interface", an interface that extends java.rmi.Remote are available remotely.
Javax.servlet.SingleThreadModel
Ensures that servlets handle only one request at a time. This interface has no methods. If a servlet implements this interface, you are guaranteed that no two threads will execute concurrently in the servlet's service method.
Java.util.RandomAccess
This Marker interface used by List implementations (ArrayList, Vector) to indicate that they support fast (generally constant time) random access. The primary purpose of this interface is to allow generic algorithms to alter their behavior to provide good performance when applied to either random or sequential access lists.
Javax.ejb.EnterpriseBean
The EnterpriseBean interface must be implemented by every enterprise Bean class. It is a common superinterface for the SessionBean, EntityBean and MessageDrivenBean interfaces.
Reference From Sun Documentation
 
http://pmd.sourceforge.net/rules/clone.html这个可以参考, 它是来检查一个实现了clone()方法是否实现了Cloneable接口
分享到:
评论

相关推荐

    java @interface 注解详解及实例

    下面是关于 Java @interface 注解的详解及实例。 一、定义注解 在 Java 中,定义注解其实和定义接口差不多,只需要在 interface 前添加一个 @ 符号就可以,即 `@interface Zhujie{ }`,这就表明我们定义了一个名为...

    (EN) NGOD 2.0 - Edge Resource____ Interface - R6

    例如,ECR #21-410112005添加了对ln Band Marker扩展头的引用,而ECR #37-410112005则更新了消息流程图并清理了文本描述,以更准确地反映实际的消息类型。这些ECR的实施,反映了NGOD 2.0在不断演进和完善的过程中对...

    Android代码-StickyHeaders

    StickyHeaders Easily add Sticky Headers to your RecyclerView Setup Implement StickyHeaderHandler in your...For items in your dataset that you want to act as sticky headers, implement the marker interface

    ccna实验之ppp 用的是繁荣模拟器

    *Mar 1 00:02:38.923: %LINEPROTO-5-UPDOWN: Line protocol on Interface Serial1/2, changed state to up r1(config-if)#end r1#sh run Building configuration... *Mar 1 00:02:58.663: %SYS-5-CONFIG_I: ...

    2022年Java语言的接口与类型安全Java教程.docx

    标识接口(Marker Interface)如`Serializable`,没有任何方法,仅仅表示实现该接口的类具有特定的性质。常量接口(Constant Interface)虽然可以用来存储常量,但不推荐这样做,因为这违反了接口的设计原则,更好的...

    ArcObject 10.3.1 For .Net 对象模型(ODM)

    此外,类图还区分了出站接口(Outbound Interface)和入站接口(Inbound Interface),这有助于理解类如何与其他类进行通信。出站接口是类对外提供的服务,而入站接口是类接受的服务。 总之,ArcObject 10.3.1 For ...

    Hp_AMap.zip

    API(Application Programming Interface)是一组预定义的函数,允许开发者访问地图服务,如绘制地图、添加标记、获取地理位置信息等。在高德地图API中,大头针通常被称为“Marker”,它用于表示地图上的特定位置。 ...

    高德地图api多地点自定义显示名字+文字标识

    API(Application Programming Interface)是应用程序接口,它允许开发者通过调用特定的函数或方法来与地图服务进行交互。高德地图API提供了JavaScript SDK和Android/iOS SDK等多种版本,适用于网页和移动设备的应用...

    百度地图API使用整合(javascript)

    首先,我们需要理解什么是API(Application Programming Interface),它是一组预定义的函数、类和协议,允许开发者访问特定服务或平台的功能。百度地图API是百度提供的一种服务,允许开发者在其网站上嵌入地图、...

    java 术语 a-z

    22. **标记接口 (marker interface)**:没有方法的接口,仅作为标记,表明实现它的类具有某种特性。 这些术语构成了Java编程的基础,理解并熟练应用它们对于成为专业的Java开发者至关重要。在实际编程中,掌握这些...

    手机访问虚拟机

    interface FastEthernet0/0 no ip address shutdown duplex half ! interface FastEthernet1/0 ip address 192.168.1.3 255.255.255.0 duplex auto speed auto ! interface FastEthernet1/1 no ip address shutdown ...

    百度地图点击标注,弹出窗口.7z

    这是一个常见的交互设计,可以为用户提供更多关于地理位置的详细信息。下面我们将深入探讨这个功能的实现原理和技术要点。 首先,我们需要了解百度地图API(Application Programming Interface)。百度地图API是...

    百度地图坐标地理位置详情显示js代码实例

    百度地图API(Application Programming Interface)是一套用于开发基于地图的应用程序的工具集。它允许开发者通过JavaScript调用各种地图服务,如绘制地图、获取地理编码、定位、路径规划等。在使用百度地图API之前...

    cisco路由器常用配置

    6. **boot-start-marker** 和 **boot-end-marker**: - 这两个命令用于标记启动配置文件的开始和结束位置,便于查找和管理配置文件。 7. **no aa new-model**: - 关闭新的AAA(认证、授权、记账)模型。 8. **...

    demo(百度地图)实例

    百度地图API(Application Programming Interface)是一套由百度提供的工具集,允许开发者通过JavaScript或Android/iOS SDK来调用地图服务,创建交互式的地图应用。这个“demo”实例可能包含了地图的基本功能,如...

    Adams-EDEM cosim帮助文档

    Adams Co-Simulation Interface (ACSI) 是一个MSC co-simulation工具,基于Elliot et al.[1, 2, 3, 4]设计的算法。ACSI支持的co-simulation拓扑结构是Adams模型与一个或多个MSC Marc进程和一个EDEM进程(DEM ...

    objective-c 谷歌地图

    @interface ViewController () @property (nonatomic, strong) GMSMapView *mapView; @end @implementation ViewController - (void)viewDidLoad { [super viewDidLoad]; GMSCameraPosition *camera = ...

    百度地图JS api Demo

    百度地图JavaScript API(Application Programming Interface)提供了一套完整的接口,允许开发者在网页上集成百度地图功能,实现自定义的地图展示、定位、路径规划等功能。下面我们将深入探讨如何使用这个API,通过...

    google map api 开发实例

    API(Application Programming Interface)是一组预定义的函数、协议和工具,用于构建软件应用程序。Google Maps API为开发者提供了丰富的功能,如地图展示、定位、路线规划、地理编码(地址转换为经纬度)等。 **...

Global site tag (gtag.js) - Google Analytics