Self-reflexivity is a literary device through which a piece of writing draws attention to its manner of composition. The most favorable genre to allow for its use seems to be the novel. At the same time as the author unravels the story, she tells you about her choices, quanderies, timing, and organization of the material among other things.
Although it is generally claimed that self-reflexivity is typical of postmodern literature, there is consensus that it dates back to the 18th century and that it can be found in Laurence Sterne's Tristram Shandy, a nine-volume novel published between 1759 and 1766.
Clear contemporary examples of this device are found in Brooke Lenz's John Fowles: Visionary and Voyeur and in Martin Amis' London Fields.
Consider this excerpt from Amis' novel: "... Of course, I write these words in the awed hush that follows my completion of the first chapter. I don't dare go through it yet. I wonder if I ever will."
The author is letting the reader into his mindset as he writes. Yet that this is his actual mindset is not necessarily true, since we are talking of a literary device. In his introduction to The Magus, Fowles warns us that he will cheat on us, and that we need to distinguish between truth and lies.
Another aspect of self-reflexivity appears in works that include self-reference. In Don Quixote, Cervantes mentioned one of his previous books, just as in painting many artists portrayed themselves as anonymous characters inside large compositions.