= Mixins (and Mixees)

:Notice: Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at. http://www.apache.org/licenses/LICENSE-2.0 . Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR  CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
:page-partial:


This section defines a number of interfaces that define a contract for some framework-defined mixins.

[TIP]
====
See the xref:userguide:fun:overview.adoc#mixins[fundamentals user guide] for a discussion of mixins.
====


[#java-lang-object]
== java.lang.Object

The framework provides a number of mixins that contributes to `java.lang.Object` (in other words, to every domain object):

* core
** xref:refguide:applib:index/mixins/layout/Object_downloadLayoutXml.adoc[Object_downloadLayoutXml]
** xref:refguide:applib:index/mixins/layout/Object_downloadLayoutXml.adoc[Object_downloadLayoutXml]

* Wicket viewer:
** xref:refguide:viewer:index/wicket/viewer/mixins/Object_clearHints.adoc[Object_clearHints]



[[Dto]]
== Dto

JAXB view models can optionally implement the `Dto` interface.
Two mixins contribute to this interface:

* xref:refguide:applib:index/mixins/dto/Dto_downloadXml.adoc[Dto_downloadXml]
* xref:refguide:applib:index/mixins/dto/Dto_downloadXsd.adoc[Dto_downloadXsd]

These allow the view model/DTO to be seriailized, respectively, as XML and as the XSD schema for said XML.


[[Persistable]]
== Persistable


All JDO domain entities implement the DataNucleus `Persistable` role interface as a result of the enhancer process (the fully qualified class name is `org.datanucleus.enhancement.Persistable`).

Using this, the following mixins (actions and properties) are available for all JDO entities:

* xref:refguide:persistence:index/jdo/datanucleus/mixins/Persistable_datanucleusVersionLong.adoc[Persistable_datanucleusVersionLong] (property)
+
only visible if the entity is annotated with `javax.jdo.annotations.Version` and the `version` field introduced by enhancing can be cast to `Long`.

* xref:refguide:persistence:index/jdo/datanucleus/mixins/Persistable_datanucleusVersionTimestamp.adoc[Persistable_datanucleusVersionLong] (property)
+
only visible if the entity is annotated with `javax.jdo.annotations.Version` and the `version` field introduced by enhancing can be cast to `java.sql.Timestamp`.

As a developer you do not need to write any code to obtain the mixins that contribute to this interface.

These mixin properties/actions are all associated with the "Metadata" fieldset.



