Ted Neward did this one as well. Metadata, to shortcut to an
explanation, is XDoclet built into the language, compiler, and
runtime.
Metadata, or "annotations," can be used in places of marker
interfaces (like Serializable or Cloneable),
and in place of naming conventions like getProperty() and
setProperty().
If you want to mark something as Serializable, you use an
annotation to mark it. If you have modifier and an accessor methods
for a property, you mark those methods with an annotation. Then, at
runtime, instead of seeing if a class implement
Serializable, or reflectively calling a method by naming
convention, you lookup the annotations and use that
metadata.
similar to asserts, you can enable annotations to be
enabled or disabled at runtime. It's a little more complicated:
Annotations can be available to pre-processors only. Once it's
running, or compiled, the annotations aren't available.
They can be available in the compiled code, for
post-processors.
They can be available at runtime
I'm not sure if there's a hiarchy to these, or if they can be
turned on and off independent of each other.