foreign key// Their primary key refers to the primary key @entity@primarykeyjoincolumn (name= "id") of the user table as a foreign key publicclasscustomer extendsuser{ @Getter @Setter privatestringphone;} @Entity @primarykeyjoincolumn (NAMENBSP;=NBSP; " ID ") publicclassemployeeextendsuser{ @Getter @Setter NBSP;PRIVATENBSP;STRINGNBSP;QQ;} plane is the parent class of A370 and J10 @entity@inheritance (strategy=inheritancetype.single_table) @Discrimi
Closed Principle)
2. centrally manage the composite relationship between objects and make it easy to read
Annotation
1. Fast Development
2. It is easy to find the source of the error during compilation.
Disadvantages
Configuration File
1. the development speed is relatively slow;
2. It is difficult to check for errors during compilation, but it is difficult to locate errors during running and make debugging difficult.
Sometimes in spring, a class marks a lot of annotations.
In fact, Java annotations can be inherited (that is, merging multiple annotations into 1)
such as Springmvc's notes.
@RestController
@RequestMapping ("/person")
Can be merged into
Java custom Annotation to get the Annotation value set by Annotation in the Annotation class
Java annotation mechanism is widely used in various frameworks. Some values can be set in annotations. How can this problem be solved.
To obtain the
Java annotation mechanism is widely used in various frameworks, and some values can be set in annotations.To get the annotation value set in the annotation class annotation: traverse the method in the custom annotation, reflect the execution method, and the result is the cor
[C Language] annotation Conversion -- C annotation is converted into a standard C ++ language annotation, AnnotationI. Specific requirements:
1: C-style comments/**/comments are converted to Standard C ++ styles // comments
2: // The style comment remains unchanged
3: All conversions must comply with syntax rules.
4: Support for
annotation through the Java reflection API, the returned value will be an object that implements the annotation class interface. By accessing this object, we can easily access its annotation member. The subsequent sections will refer to the three quasi-annotation types contained in the Java. lang Package of java5.0.
C
use the name = value pair to overwrite the default values of other members. Some similar class inheritance features. The constructor of the parent class can be used as the default constructor of the subclass, but can also be overwritten by the quilt class.
D. Marker annotation type:An annotation type without Member definition is called marker
declaring the default value of any Annotation Member: An Annotation can use the name = value pair as the value of an Annotation member without defining the default value, you can also use the name = value pair to overwrite the default values of other members. Some similar class inheritance features. The constructor of
. annotation member:The annotation member is declared in the form of a non-parameter method in the annotation type. The method name and return value define the name and type of the member. There is a specific default hereSyntax: the default value of any annotation member can be declared: An
, reserved during RUNTIME)
@ Brief ented:
@Documented is used to describe other types of annotation which should be used as a public API of the labeled Program Member. Therefore, it can be Documented by tools such as javadoc. Incluented is a tag Annotation with no members.
@ Inherited:
@ Inherited meta annotation is a tag
. If a annotation type using the @inherited modifier is used for a class, the annotation will be used for subclasses of that class.
Note: The @Inherited annotation type is inherited by subclasses of the annotated class. The class does not inherit annotation from the interface it implements, and the method does not inhe
inheritance in which the virtual base class stores offsets relative to the virtual base class table pointer.ii. Types of inheritance1, ordinary inheritance (does not contain virtual functions)A, single inheritanceClass Base{public: base (int a = 1): Base (a) {} void Fun0 () {cout B, multiple inheritanceClass Base1{public: Base1 (int a = 2): Base1 (a) {} void Fun1 () {cout C, Diamond
annotation can name=value to a annotation member that does not have a defined default value, and of course can use Name= value pairs to override other member defaults. This is somewhat similar to the inheritance attribute of the class, which can be the default constructor of a subclass, but can also be overridden by a quilt class.
name and type of the member. Here is a specific default syntax: Allows you to declare the default value for any annotation member: A annotation can use Name=value as a value for a annotation member that does not have a default value defined, and of course it can be used name= The value pair overrides the other member's default value. This is somewhat similar to
Spring for Java EE development, including condition annotation, combination annotation and meta annotation, and javaeespring
In the previous blog, we talked in detail about multithreaded programming and task timer in Spring developed by JavaEE. In this blog, we will talk about condition annotation @ Conditional and com
Inheritance and Polymorphism in C ++ (lower)-single inheritance, multi-inheritance, and diamond inheritance (including inheritance of virtual functions)
1. classes with virtual functions
class Base{public: virtual void FunTest1() {
Java custom annotation and use reflection to read annotation, java Annotation
I. Custom annotations
Meta annotation:
@ Interface annotation: Define annotation interface
@ Target annotation
labeled method overload the parent class method and plays the role of assertion. If we use this annotation, the java compiler will warn you of a compilation error when a method that does not overwrite the parent class method. This annotaton often adds a guaranteed verification process when we try to override the parent class method and make sure that the method name is wrong. Deprecated and Deprecated are also marker
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.