java.lang.Objectjava.beans.Encoder
public class Encoder
An Encoder is a class which can be used to create
files or streams that encode the state of a collection of
JavaBeans in terms of their public APIs. The Encoder,
in conjunction with its persistence delegates, is responsible for
breaking the object graph down into a series of Statementss
and Expressions which can be used to create it.
A subclass typically provides a syntax for these expressions
using some human readable form - like Java source code or XML.
| Constructor Summary | |
|---|---|
Encoder()
|
|
| Method Summary | |
|---|---|
Object |
get(Object oldInstance)
Returns a tentative value for oldInstance in
the environment created by this stream. |
ExceptionListener |
getExceptionListener()
Gets the exception handler for this stream. |
PersistenceDelegate |
getPersistenceDelegate(Class<?> type)
Returns the persistence delegate for the given type. |
Object |
remove(Object oldInstance)
Removes the entry for this instance, returning the old entry. |
void |
setExceptionListener(ExceptionListener exceptionListener)
Sets the exception handler for this stream to exceptionListener. |
void |
setPersistenceDelegate(Class<?> type,
PersistenceDelegate persistenceDelegate)
Sets the persistence delegate associated with this type to
persistenceDelegate. |
void |
writeExpression(Expression oldExp)
The implementation first checks to see if an expression with this value has already been written. |
protected void |
writeObject(Object o)
Write the specified object to the output stream. |
void |
writeStatement(Statement oldStm)
Writes statement oldStm to the stream. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public Encoder()
| Method Detail |
|---|
protected void writeObject(Object o)
o - The object to be written to the stream.XMLDecoder.readObject()public void setExceptionListener(ExceptionListener exceptionListener)
exceptionListener.
The exception handler is notified when this stream catches recoverable
exceptions.
exceptionListener - The exception handler for this stream;
if null the default exception listener will be used.getExceptionListener()public ExceptionListener getExceptionListener()
setExceptionListener(java.beans.ExceptionListener)public PersistenceDelegate getPersistenceDelegate(Class<?> type)
BeanDescriptor
which defined a "persistenceDelegate" property, this
value is returned.
type - The type of the object.
setPersistenceDelegate(java.lang.Class>, java.beans.PersistenceDelegate),
Introspector.getBeanInfo(java.lang.Class>),
BeanInfo.getBeanDescriptor()public void setPersistenceDelegate(Class<?> type, PersistenceDelegate persistenceDelegate)
type to
persistenceDelegate.
type - The class of objects that persistenceDelegate applies to.persistenceDelegate - The persistence delegate for instances of type.getPersistenceDelegate(java.lang.Class>),
Introspector.getBeanInfo(java.lang.Class>),
BeanInfo.getBeanDescriptor()public Object remove(Object oldInstance)
oldInstance - The entry that should be removed.
get(java.lang.Object)public Object get(Object oldInstance)
oldInstance in
the environment created by this stream. A persistence
delegate can use its mutatesTo method to
determine whether this value may be initialized to
form the equivalent object at the output or whether
a new object must be instantiated afresh. If the
stream has not yet seen this value, null is returned.
oldInstance - The instance to be looked up.
public void writeStatement(Statement oldStm)
oldStm to the stream.
The oldStm should be written entirely
in terms of the callers environment, i.e. the
target and all arguments should be part of the
object graph being written. These expressions
represent a series of "what happened" expressions
which tell the output stream how to produce an
object graph like the original.
The implementation of this method will produce
a second expression to represent the same expression in
an environment that will exist when the stream is read.
This is achieved simply by calling writeObject
on the target and all the arguments and building a new
expression with the results.
oldStm - The expression to be written to the stream.public void writeExpression(Expression oldExp)
writeStatement,
and the value of this expression is reconciled
with the value of the cloned expression
by calling writeObject.
oldExp - The expression to be written to the stream.Ces informations proviennent du site de http://java.sun.com
Le contenu de cette page provient du site de Sun, et est généré depuis un cache sur l'infobrol après certains traitements automatisés. La présentation peut donc différer du document original, mais le contenu aussi. Vous pouvez utiliser ce bouton pour afficher la page originale du site de Sun :
Maintenir les pages en cache sur différents sites peut offrir plus de disponibilité.
Chaque page est indexée dans la base de donnée, ce qui permet de retrouver facilement les informations, au moyen des sommaires, du moteur de recherche interne, etc.
Des facilités sont mises en place pour que les membres de l'infobrol puissent effectuer des traductions en français des différents documents. Ceci devrait permettre aux débutants en programmation Java de consulter les API en français s'ils maîtrisent moins bien la langue de Shakespeare. Dans le cas où une traduction a été soumise, elle est disponible au moyen d'un lien en bas de page. Si la traduction a été validée, la page s'affiche par défaut en français, et un lien en bas de page permet d'atteindre la version en anglais.
Le code sur l'infobrol est automatiquement coloré selon la syntaxe, et les différents mots clés sont transformés en liens pour accéder rapidement aux informations.
Vous avez la possibilité de partager vos expériences en proposant vos propres extraits de code en utilisant le bouton "ajouter un commentaire" en bas de page. Si vous visitez simplement l'infobrol, vous avez déjà accès à cette fonction, mais si vous étes membre du brol, vous pouvez en plus utiliser des boutons supplémentaires de mise en forme, dont la coloration automatique de vos extraits de codes.
Vous pouvez modifier vos préférences dans votre profil pour ne plus afficher les interactions avec les réseaux sociaux sur ces pages.
6 mots clés dont 0 définis manuellement (plus d'information...).
Avertissement
Cette page ne possède pas encore de mots clés manuels, ceci est donc un exemple automatique (les niveaux de pertinence sont fictifs, mais les liens sont valables). Pour tester le nuage avec une page qui contient des mots définis manuellement, vous pouvez cliquer ici.Vous pouvez modifier vos préférences dans votre profil pour ne plus afficher le nuage de mots clés.
Recherche (afficher)
Utilisateur (masquer)
Navigation (masquer)
Apparence (afficher)
Stats (afficher)
Citation (masquer)