# Annotations & Properties

Flatland provides two options for annotating schemas and data.

## Standard Python

Element schemas are normal Python classes and can be extended in all of the usual ways. For example, you can add an attribute when subclassing:

Once an attribute has been added to an element class, its value can be overridden by further subclassing or, more compactly, with the :meth:~Element.using schema constructor:

Both are equivalent, and the custom tooltip will be inherited by any subclasses of Password. Likewise, instances of Password will have the attribute as well.

And because the :meth:Element constructor allows overriding any schema attribute by keyword argument, individual element instances can be constructed with own values, masking the value provided by their class.

## Properties

Another option for annotation is the :attr:~Element.properties mapping of element classes and instances. Unlike class attributes, almost any object you like can be used as the key in the mapping.

The unique feature of :attr:~Element.properties is data inheritance:

Annotations made on a schema are visible to itself and any subclasses, but not to its parents.

## Annotating With Properties

To create a new schema that includes additional properties, construct it with :meth:~Element.with_properties:

Or if the schema has already been created, manipulate its :attr:~Element.properties mapping:

The :attr:~Element.properties mapping is implemented as a view over the Element schema inheritance hierarchy. If annotations are added to a superclass such as :class:~flatland.schema.scalars.String, they are visible immediately to all Strings and subclasses.

## Private Annotations

To create a schema with completely unrelated properties, not inheriting from its superclass at all, declare it with :meth:~Element.using:

Or when subclassing longhand, construct a :class:~flatland.schema.properties.Properties collection explicitly.

An instance may also have a private collection of properties. This can be done either at or after construction:

Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.