jdk/src/sample/share/annotations/index.html
author martin
Wed, 02 Sep 2015 14:11:50 -0700
changeset 32427 c22b7e41adf3
parent 25859 3317bb8137f4
permissions -rw-r--r--
8134984: Text files should end in exactly one newline Summary: automated fixup of newlines at end-of-file via the usual perl one-liner Reviewed-by: chegar, sherman
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
22620
3a49604673ae 8032025: Update repeating annotations demo
anazarov
parents:
diff changeset
     1
<!DOCTYPE html>
3a49604673ae 8032025: Update repeating annotations demo
anazarov
parents:
diff changeset
     2
<html>
3a49604673ae 8032025: Update repeating annotations demo
anazarov
parents:
diff changeset
     3
<head>
3a49604673ae 8032025: Update repeating annotations demo
anazarov
parents:
diff changeset
     4
    <title>Repeating Annotations Demo</title>
3a49604673ae 8032025: Update repeating annotations demo
anazarov
parents:
diff changeset
     5
</head>
3a49604673ae 8032025: Update repeating annotations demo
anazarov
parents:
diff changeset
     6
<body>
3a49604673ae 8032025: Update repeating annotations demo
anazarov
parents:
diff changeset
     7
<h2>Repeating Annotations Demo</h2>
3a49604673ae 8032025: Update repeating annotations demo
anazarov
parents:
diff changeset
     8
3a49604673ae 8032025: Update repeating annotations demo
anazarov
parents:
diff changeset
     9
<p>
3a49604673ae 8032025: Update repeating annotations demo
anazarov
parents:
diff changeset
    10
    This demo shows how to use repeating annotations at runtime and at compile time.
3a49604673ae 8032025: Update repeating annotations demo
anazarov
parents:
diff changeset
    11
</p>
3a49604673ae 8032025: Update repeating annotations demo
anazarov
parents:
diff changeset
    12
3a49604673ae 8032025: Update repeating annotations demo
anazarov
parents:
diff changeset
    13
<ul>
3a49604673ae 8032025: Update repeating annotations demo
anazarov
parents:
diff changeset
    14
    <li><h3>Dependency checker.</h3>
3a49604673ae 8032025: Update repeating annotations demo
anazarov
parents:
diff changeset
    15
3a49604673ae 8032025: Update repeating annotations demo
anazarov
parents:
diff changeset
    16
        <p>
3a49604673ae 8032025: Update repeating annotations demo
anazarov
parents:
diff changeset
    17
            Shows how to define repeating annotations and process them at compile time.
3a49604673ae 8032025: Update repeating annotations demo
anazarov
parents:
diff changeset
    18
            The problem domain is some code that performs useful operations on hardware devices.
3a49604673ae 8032025: Update repeating annotations demo
anazarov
parents:
diff changeset
    19
            The code relies on "modules" to be present on the devices. Applicability of the code to a particular
3a49604673ae 8032025: Update repeating annotations demo
anazarov
parents:
diff changeset
    20
            device is checked while compiling the code for a particular device.
3a49604673ae 8032025: Update repeating annotations demo
anazarov
parents:
diff changeset
    21
            A set of modules provided by a device is listed in an xml file that turns red during the compilation
3a49604673ae 8032025: Update repeating annotations demo
anazarov
parents:
diff changeset
    22
            phase and is compared with the required module set specified by annotations.
3a49604673ae 8032025: Update repeating annotations demo
anazarov
parents:
diff changeset
    23
            For instance, there is kettle with hardware modules: thermometer, display, and clock.
3a49604673ae 8032025: Update repeating annotations demo
anazarov
parents:
diff changeset
    24
            There is also a boiler plug-in that requires clock, thermometer, heater, and optionally an LED light.
3a49604673ae 8032025: Update repeating annotations demo
anazarov
parents:
diff changeset
    25
3a49604673ae 8032025: Update repeating annotations demo
anazarov
parents:
diff changeset
    26
            Build the PluginChecker annotation processor first.
3a49604673ae 8032025: Update repeating annotations demo
anazarov
parents:
diff changeset
    27
            Then, run javac with the annotation processor against plug-in sources using the following command: </p>
3a49604673ae 8032025: Update repeating annotations demo
anazarov
parents:
diff changeset
    28
3a49604673ae 8032025: Update repeating annotations demo
anazarov
parents:
diff changeset
    29
        <code>javac -cp "PluginChecker.jar" -processor checker.PluginChecker -Adevice=Kettle.xml -proc:only &lt;source
3a49604673ae 8032025: Update repeating annotations demo
anazarov
parents:
diff changeset
    30
            files&gt;</code>
3a49604673ae 8032025: Update repeating annotations demo
anazarov
parents:
diff changeset
    31
3a49604673ae 8032025: Update repeating annotations demo
anazarov
parents:
diff changeset
    32
        <p>
3a49604673ae 8032025: Update repeating annotations demo
anazarov
parents:
diff changeset
    33
            where <code>PluginChecker.jar</code> - path to jar file that contains PluginChecker annotation processor
3a49604673ae 8032025: Update repeating annotations demo
anazarov
parents:
diff changeset
    34
            class. </br>
3a49604673ae 8032025: Update repeating annotations demo
anazarov
parents:
diff changeset
    35
            <code>Kettle.xml</code> - path to device descriptor Kettle.xml                                         </br>
3a49604673ae 8032025: Update repeating annotations demo
anazarov
parents:
diff changeset
    36
            <code>&lt;source files&gt;</code> - source files in Plugins/src
3a49604673ae 8032025: Update repeating annotations demo
anazarov
parents:
diff changeset
    37
        </p>
3a49604673ae 8032025: Update repeating annotations demo
anazarov
parents:
diff changeset
    38
        For more information, see the source files.
3a49604673ae 8032025: Update repeating annotations demo
anazarov
parents:
diff changeset
    39
        </p>
3a49604673ae 8032025: Update repeating annotations demo
anazarov
parents:
diff changeset
    40
        <ul>
3a49604673ae 8032025: Update repeating annotations demo
anazarov
parents:
diff changeset
    41
            <li>Annotation processor sources: <a href="DependencyChecker/PluginChecker/src/">DependencyChecker/PluginChecker/src</a>
3a49604673ae 8032025: Update repeating annotations demo
anazarov
parents:
diff changeset
    42
            <li>Processing of repeating annotations can be found in <a href="DependencyChecker/PluginChecker/src/checker/PluginChecker.java">PluginChecker.java</a>
3a49604673ae 8032025: Update repeating annotations demo
anazarov
parents:
diff changeset
    43
            <li>Usage of repeating annotation is shown in modules sources.<a href="DependencyChecker/Plugins/src">DependencyChecker/Plugins/src</a>
3a49604673ae 8032025: Update repeating annotations demo
anazarov
parents:
diff changeset
    44
        </ul>
3a49604673ae 8032025: Update repeating annotations demo
anazarov
parents:
diff changeset
    45
3a49604673ae 8032025: Update repeating annotations demo
anazarov
parents:
diff changeset
    46
    <li><h3>Validator.</h3>
3a49604673ae 8032025: Update repeating annotations demo
anazarov
parents:
diff changeset
    47
3a49604673ae 8032025: Update repeating annotations demo
anazarov
parents:
diff changeset
    48
        <p>
3a49604673ae 8032025: Update repeating annotations demo
anazarov
parents:
diff changeset
    49
            Shows how to define repeating annotations and process them at runtime.
3a49604673ae 8032025: Update repeating annotations demo
anazarov
parents:
diff changeset
    50
            A problem domain is code that needs to validate provided Suppliers for conformance to some criteria.
3a49604673ae 8032025: Update repeating annotations demo
anazarov
parents:
diff changeset
    51
            The criteria are implemented by the Validator class which is applied by using annotations that are placed in
3a49604673ae 8032025: Update repeating annotations demo
anazarov
parents:
diff changeset
    52
            the code whenever validation is needed. For more information, see the
3a49604673ae 8032025: Update repeating annotations demo
anazarov
parents:
diff changeset
    53
            source files.
3a49604673ae 8032025: Update repeating annotations demo
anazarov
parents:
diff changeset
    54
        </p>
3a49604673ae 8032025: Update repeating annotations demo
anazarov
parents:
diff changeset
    55
3a49604673ae 8032025: Update repeating annotations demo
anazarov
parents:
diff changeset
    56
        <p>
3a49604673ae 8032025: Update repeating annotations demo
anazarov
parents:
diff changeset
    57
        <ul>
3a49604673ae 8032025: Update repeating annotations demo
anazarov
parents:
diff changeset
    58
            <li>Usage of repeating annotation is described in <a href="Validator/src/PositiveIntegerSupplier.java">PositiveIntegerSupplier.java</a>
3a49604673ae 8032025: Update repeating annotations demo
anazarov
parents:
diff changeset
    59
            <li> Example of how to define a repeating annotation type can be found in
3a49604673ae 8032025: Update repeating annotations demo
anazarov
parents:
diff changeset
    60
                <a href="Validator/src/Validate.java">Validate.java</a>
3a49604673ae 8032025: Update repeating annotations demo
anazarov
parents:
diff changeset
    61
            <li> Usages of the new reflective methods can be found in <a href="Validator/src/SupplierValidator.java">SupplierValidator.java</a>
3a49604673ae 8032025: Update repeating annotations demo
anazarov
parents:
diff changeset
    62
        </ul>
3a49604673ae 8032025: Update repeating annotations demo
anazarov
parents:
diff changeset
    63
        </p>
3a49604673ae 8032025: Update repeating annotations demo
anazarov
parents:
diff changeset
    64
        Sources: <a href="Validator/src/">Validator/src/</a>
3a49604673ae 8032025: Update repeating annotations demo
anazarov
parents:
diff changeset
    65
</ul>
3a49604673ae 8032025: Update repeating annotations demo
anazarov
parents:
diff changeset
    66
</body>
32427
c22b7e41adf3 8134984: Text files should end in exactly one newline
martin
parents: 25859
diff changeset
    67
</html>