org.eclipse.xtext.parsetree.reconstr
Interface ITransientValueService

All Known Implementing Classes:
AbstractTransientValueService, DefaultTransientValueService, XtextTransientValueService

public interface ITransientValueService

Implementations of this service are called when a model is serialized and can decide whether a value needs to be serialized or not.

Author:
Moritz Eysholdt - Initial contribution and API

Method Summary
 boolean isCheckElementsIndividually(org.eclipse.emf.ecore.EObject owner, org.eclipse.emf.ecore.EStructuralFeature feature)
          For features with isMany() == true, isCheckElementsIndividually() has to return true when isTransient should be called for each element of the list instead of once for the whole list.
 boolean isTransient(org.eclipse.emf.ecore.EObject owner, org.eclipse.emf.ecore.EStructuralFeature feature, int index)
          Decides whether a value should be serialized.
 

Method Detail

isCheckElementsIndividually

boolean isCheckElementsIndividually(org.eclipse.emf.ecore.EObject owner,
                                    org.eclipse.emf.ecore.EStructuralFeature feature)
For features with isMany() == true, isCheckElementsIndividually() has to return true when isTransient should be called for each element of the list instead of once for the whole list.

Parameters:
owner - the feature holder
feature - the multi value feature
Returns:
true if all values should be checked individually for their transient state.

isTransient

boolean isTransient(org.eclipse.emf.ecore.EObject owner,
                    org.eclipse.emf.ecore.EStructuralFeature feature,
                    int index)
Decides whether a value should be serialized. If !feature.isMany() or !isMixedList(feature), this method is only called once for each feature. In this case, index is < 0. If feature.isMany() and isMixedList(feature), this method is called for each of the feature's values. Attention: Values marked transient are only not serialized when they are optional in the grammar. Example: Rule1: transientF=INT normalF=INT; In this case, the grammar requires to serialize transientF to produce a valid DSL-script. Attention: Think of how many times the serializer calls this method and supply a fast implementation. The serializer tries to avoid multiple calls to this method using the same parameters, but depending on the grammar and the model, it may happen.

Parameters:
owner - The EObject holding the feature's value
feature - the to-be-checked feature
index - the index in the list for multi value features
Returns:
true, if the feature's value(s) should NOT be serialized