Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Square brackets in delphi?

Tags:

delphi

Can someone tell me what is the function of the square brackets below? Or what they are called and I can google about it. I'm not sure what to put in the search box...

type
  [Entity]
  [Automapping]
  TPerson = class
  private
    FId: integer;
    FLastName: string;
    FFirstName: string;
    FEmail: string;
  public
    property Id: integer read FId;
    property LastName: string read FLastName write FLastName;
    property FirstName: string read FFirstName write FFirstName;
    property Email: string read FEmail write FEmail;
  end;
like image 997
Meh Nada Avatar asked Feb 07 '13 01:02

Meh Nada


1 Answers

Those are attributes that decorate the class.

Attributes are a language feature in Delphi that allows annotating types and type members with special objects that carry additional information. This information can be queried at run time. Attributes extend the normal Object-Oriented model with Aspect-Oriented elements. In general, attributes are useful when building general purpose frameworks that analyze structured types such as objects or records at run time and introduce new behavior based on additional information supplied by the annotated attributes.

It's a feature equivalent to the annotations of other languages.

like image 104
jachguate Avatar answered Oct 05 '22 18:10

jachguate