Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Marker interface pattern
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
==Critique== One problem with marker interfaces is that, since an interface defines a contract for implementing classes, and that contract is inherited by all subclasses, a marker cannot be "unimplemented". In the example given, any subclass not intended for serialization (perhaps it depends on transient state), must explicitly throw NotSerializableException exceptions (per <code>ObjectOutputStream</code> docs). Another solution is for the language to support [[metadata]] directly: * Both the [[.NET Framework]] and [[Java (software platform)|Java]] (as of Java 5 (1.5)) provide support for such metadata. In .NET, they are called ''"custom attributes"'', in Java they are called ''"[[Java annotation|annotations]]"''. Despite the different name, they are conceptually the same thing. They can be defined on classes, member variables, methods, and method parameters and may be accessed using [[Reflection (computer science)|reflection]]. * In [[Python (programming language)|Python]], the term "marker interface" is common in [[Zope]] and [[Plone (software)|Plone]]. Interfaces are declared as metadata and subclasses can use <code>implementsOnly</code> to declare they do not implement everything from their super classes.
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)