1. Brief notes

An Annotation is a special mark in JAVA program code that usually identifies additional information; Annotated information is analytic; In later framework content, annotations can replace or simplify configuration files (relevant configuration information is moved from configuration files to annotations)

Summary: Annotations are not annotations (annotations have nothing to do with annotations)

Annotations are new syntax (new feature) in JDK1.5

In the future, framework based development will mostly use annotation patterns (unless the project is extremely large………).

2. JAVA’s three built-in annotations

@suppresswarnings: SuppressWarnings

@ SuppressWarnings (” unused “) unused (no use) | unchecked (do not check syntax) | deprecation (outdated)……

@ Override: rewrite

@deprecated: It will be removed in the future.

3. Create annotations

To create annotations, you need to parse them yourself

Public @interface MyAnnotation {} Note: Syntax for an interfaceCopy the code
4. Meta-annotations

1. A note to a note (a note added to a note is called a meta-note).

Metadata: The data describing the data is called metadata;

@target: Identifies where annotations can be added

Documented: Generate a help document with annotated information

Inherited: Annotations exist in the child class.

@Retention: Retention of annotations (at what stage in the program annotations are valid)

RetentionPolicy. RUNTIME | RetentionPolicy. CLASS | RetentionPolicy. The SOURCE if you want to parse annotations, must be the RUNTIME, otherwise can’t get the information annotation

5. Parse annotations

Take annotated information: use reflection

Incidentally a bill of lading meta-test

Unit testing

Testing: software development is an independent position, we often develop their own unit test writing is not good

Unit testing: is a basic skill programmers need to master; Unit testing is all about testing your own code

Unit: Can be understood simply as a method in a class

Unit testing requires a specialized unit testing framework – in the case of the JAVA language, the JUNIT framework, which is integrated into Eclispe and can be used directly

Unit Test naming conventions: Test Class (xxxTest), Test Method (testXXX)

In the Test class, only methods annotated with @test can run on the JUNIT Test framework

keeps the bar green to keep the code clean