Java - (Descriptor|Metadata)

Java Conceptuel Diagram

About

Example of (Descriptor|Metadata) implementation in java.

The source of the descriptor can be:

  • in the code
  • in an external file (xml, properties, …)
  • or generated (see class)

Descriptor

Class

The javase/9/docs/api/java/lang/Class.html is a public final class that describe a class.

Class has no public constructor. Instead Class objects are constructed automatically by the Java Virtual Machine as classes are loaded and by calls to the defineClass method in the class loader.

System.out.println("The class of " + obj +
                            " is " + obj.getClass().getName());

Subclass

In a subclass, you can return (Describe|Metadata) information with the help of a function that returns

  • a static field
  • or a static class (usually inner) which is a singleton for every concrete action (or implementation).

If

a.getClass() == b.getClass()

then by default

a.getDescriptor() == b.getDescriptor()

The return value is static but the describe function is not (and then can be added to an interface definition)

(Deployment|Action)

See for instance: Java - Deployment descriptors (Metadata)

Property

Mutable or immutable

A descriptor can be mutable or immutable. An immutable descriptor, once created, never changes.

Documentation / Reference

Hudson

byShortName/Descriptor

A Descriptor/Describable combination is used throughout in Hudson to implement a configuration/extensibility mechanism.

Beans





Discover More
Java Conceptuel Diagram
Java - Deployment descriptors (Metadata)

Deployment descriptors are XML documents included in the JARs that describes: component's configuration, deployment settings of an application, a module, or a component of and instructions to the...
Card Puncher Data Processing
Maven - Plugin Development

How to develop a maven plugin with Java Annotation. (It's important for the configuration). The code result of this tutorial is on github. gerardnico/helloworld-maven-pluginhelloworld-maven-plugin ...



Share this page:
Follow us:
Task Runner