• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
  • Tim Cooke
  • Knute Snortum
  • Bear Bibeault
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Ganesh Patekar
  • Frits Walraven
  • Carey Brown
  • Tim Holloway

Serializable marker interface

Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
how can i create a interface that can be implemented just like serilaizable interface.
I don't wan either to implement Serializable interface or extend any class.
by my interface.
Marker interface doesnotconatins any method declaration.
Ranch Hand
Posts: 1970
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Your question is not very clear (is your space-bar broken?!), but I suspect it does not belong in Advanced forum.

Are you just asking how to create a marker interface? If so, that's just a question of creating an interface with no members.

Identifying whether an object supports a marker interface is a trivial application of "instanceof" operator.

It sounds as if you want to duplicate the serialisation mechanism - why? The serialisation mechanism has, I believe, a few "magic" hooks into the JVM, which you'd struggle to replicate in your own code. Most of it is just pure Java, though, and you can look at it in the JDK source.

If you want to do something like serialisation, but with more control, you could read up on Externalizable interface. This is part of the serialisation mechanism, but more of the implementation is up to you.
Consider Paul's rocket mass heater.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!