Class XmlFormatter
- java.lang.Object
-
- com._1c.g5.modeling.xml.serializer.XmlFormatter
-
- All Implemented Interfaces:
IFormatter
public class XmlFormatter extends Object implements IFormatter
КлассXmlFormatter
на основе интерфесаIFormatter
обеспечивает стандартное форматирование для элементов модели, которые не получили информацию о форматировании при парсинге
-
-
Field Summary
Fields Modifier and Type Field Description protected org.eclipse.emf.ecore.EClass
anySimpleType
protected org.eclipse.emf.ecore.EClass
anyType
protected ICrossReferenceSerializer
crossReferenceSerializer
protected boolean
declareSchemaLocation
protected boolean
declareSchemaLocationImplementation
protected boolean
declareXML
protected org.eclipse.emf.ecore.xmi.XMLResource.ElementHandler
elementHandler
protected Map<org.eclipse.emf.ecore.EObject,org.eclipse.emf.ecore.xml.type.AnyType>
eObjectToExtensionMap
protected Escape
escape
protected Escape
escapeURI
protected org.eclipse.emf.ecore.util.ExtendedMetaData
extendedMetaData
protected Lookup
featureTable
protected org.eclipse.emf.ecore.xmi.XMLHelper
helper
protected String
idAttributeName
protected int
indent
protected String
indentString
protected static int
INDEX_LOOKUP
protected boolean
keepDefaults
protected String
lineSeparator
protected org.eclipse.emf.ecore.xmi.XMLResource.XMLMap
map
protected static Location
NULL_LOCATION
protected static String
OPTION_CUSTOM_INDENT
Опция для определения отступа в документеprotected static String
OPTION_INDENT_ROOT_ELEMENT
Начальный отступ корневого элементаprotected FormattingXmlResource
resource
protected DocumentRoot
rootNode
protected boolean
saveTypeInfo
protected boolean
saveXsiType
protected org.eclipse.emf.ecore.EPackage
xmlSchemaTypePackage
protected org.eclipse.emf.ecore.xmi.XMLSave.XMLTypeInfo
xmlTypeInfo
protected static String
XSI_NO_NAMESPACE_SCHEMA_LOCATION
protected static String
XSI_SCHEMA_LOCATION
protected static String
XSI_TYPE_NS
protected static String
XSI_XMLNS
-
Constructor Summary
Constructors Constructor Description XmlFormatter()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
createAttributeManyElementsNodes(org.eclipse.emf.ecore.EObject obj, org.eclipse.emf.ecore.EStructuralFeature f, ContainmentReferenceNode node)
protected void
createAttributeNode(org.eclipse.emf.ecore.EObject obj, org.eclipse.emf.ecore.EStructuralFeature f, ContainmentReferenceNode parent, int mark)
protected void
createContainmentReferenceNode(org.eclipse.emf.ecore.EObject obj, INode parent)
protected boolean
createFeatures(org.eclipse.emf.ecore.EObject obj, ContainmentReferenceNode node, boolean isRootNode)
Создает ноды по фичам.protected void
createNonContaimentManyReferenceNodes(org.eclipse.emf.ecore.EObject obj, org.eclipse.emf.ecore.EStructuralFeature f, ContainmentReferenceNode parent)
protected NonContainmentReferenceNode
createNonContaimentReferenceNode(org.eclipse.emf.ecore.EObject obj, org.eclipse.emf.ecore.EStructuralFeature f, ContainmentReferenceNode parent)
protected void
createRootNode(org.eclipse.emf.ecore.EObject root, INode parent)
protected TextNode
createTextNodeWithIndent(INode parentNode, boolean isLast)
protected void
createXsiTypeNode(org.eclipse.emf.ecore.EStructuralFeature f, org.eclipse.emf.ecore.EObject value, AbstractNode parent)
protected void
createXsiTypeRootNode(org.eclipse.emf.ecore.EObject root, ContainmentReferenceNode parent)
INode
format(org.eclipse.emf.ecore.xmi.XMLHelper helper, Map<?,?> options)
protected void
formatEObject(org.eclipse.emf.ecore.EObject obj, INode parentNode)
protected void
formatExistFeaturesLikeElements(org.eclipse.emf.ecore.EObject obj, ContainmentReferenceNode parent, List<org.eclipse.emf.ecore.EStructuralFeature> listExistFeatures, List<INode> listExistElementNodes)
protected void
formatExistFeaturesWithoutElements(org.eclipse.emf.ecore.EObject obj, ContainmentReferenceNode parent, ContainmentReferenceNode oldParent, List<org.eclipse.emf.ecore.EStructuralFeature> listExistFeatures, List<INode> listExistElementNodes, List<org.eclipse.emf.ecore.EStructuralFeature> listExistElementFeatures)
protected boolean
formatFeatures(org.eclipse.emf.ecore.EObject obj, ContainmentReferenceNode parent, ContainmentReferenceNode oldParent)
protected void
formatingContainmentReferenceNode(ContainmentReferenceNode oldNode, INode parent, org.eclipse.emf.ecore.EObject obj)
protected void
formatingRootNode(ContainmentReferenceNode oldNode, INode parent, org.eclipse.emf.ecore.EObject root)
protected void
formatNewFeaturesLikeElements(org.eclipse.emf.ecore.EObject obj, ContainmentReferenceNode parent, List<org.eclipse.emf.ecore.EStructuralFeature> listExistFeatures, List<org.eclipse.emf.ecore.EStructuralFeature> listExistElementFeatures, List<org.eclipse.emf.ecore.EStructuralFeature> featureElementsList)
protected void
formatNewFeaturesWithoutElements(org.eclipse.emf.ecore.EObject obj, ContainmentReferenceNode parent, List<org.eclipse.emf.ecore.EStructuralFeature> listExistFeatures, List<org.eclipse.emf.ecore.EStructuralFeature> listExistElementFeatures, List<org.eclipse.emf.ecore.EStructuralFeature> featureElementsList)
protected void
formatPreviousTextNodes(INode oldNode, INode parent)
protected void
formatRootNode()
protected void
formatXsiTypeNode(org.eclipse.emf.ecore.EStructuralFeature f, org.eclipse.emf.ecore.EObject value, AbstractNode parent, NamespaceNode oldNode)
protected void
formatXsiTypeRootNode(org.eclipse.emf.ecore.EObject root, ContainmentReferenceNode parent, NamespaceNode oldNode)
protected NamespaceNode
getXsiTypeAttributeNode(String uri)
protected String
getXsiTypeName(org.eclipse.emf.ecore.EStructuralFeature f, org.eclipse.emf.ecore.EObject value)
protected String
getXsiTypeRootName(org.eclipse.emf.ecore.EObject root)
protected boolean
hasAnnotationName(org.eclipse.emf.ecore.EClass eClass, org.eclipse.emf.ecore.EStructuralFeature f)
Метод возвращает имя объекта записанного в аннотацииvoid
init(org.eclipse.emf.ecore.xmi.XMLHelper helper, Map<?,?> options)
void
setUriEncoder(LazyUriEncoder uriEncoder)
protected boolean
shouldSaveFeature(org.eclipse.emf.ecore.EObject o, org.eclipse.emf.ecore.EStructuralFeature f)
protected boolean
shouldSaveObject(org.eclipse.emf.ecore.EObject child)
-
-
-
Field Detail
-
OPTION_INDENT_ROOT_ELEMENT
protected static final String OPTION_INDENT_ROOT_ELEMENT
Начальный отступ корневого элемента- See Also:
- Constant Field Values
-
OPTION_CUSTOM_INDENT
protected static final String OPTION_CUSTOM_INDENT
Опция для определения отступа в документе(" " по умолчанию)
- See Also:
- Constant Field Values
-
XSI_TYPE_NS
protected static final String XSI_TYPE_NS
- See Also:
- Constant Field Values
-
XSI_XMLNS
protected static final String XSI_XMLNS
- See Also:
- Constant Field Values
-
XSI_SCHEMA_LOCATION
protected static final String XSI_SCHEMA_LOCATION
- See Also:
- Constant Field Values
-
XSI_NO_NAMESPACE_SCHEMA_LOCATION
protected static final String XSI_NO_NAMESPACE_SCHEMA_LOCATION
- See Also:
- Constant Field Values
-
INDEX_LOOKUP
protected static final int INDEX_LOOKUP
- See Also:
- Constant Field Values
-
NULL_LOCATION
protected static final Location NULL_LOCATION
-
indent
protected int indent
-
indentString
protected String indentString
-
rootNode
protected DocumentRoot rootNode
-
helper
protected org.eclipse.emf.ecore.xmi.XMLHelper helper
-
declareXML
protected boolean declareXML
-
saveTypeInfo
protected boolean saveTypeInfo
-
xmlTypeInfo
protected org.eclipse.emf.ecore.xmi.XMLSave.XMLTypeInfo xmlTypeInfo
-
keepDefaults
protected boolean keepDefaults
-
escape
protected Escape escape
-
escapeURI
protected Escape escapeURI
-
featureTable
protected Lookup featureTable
-
idAttributeName
protected String idAttributeName
-
lineSeparator
protected String lineSeparator
-
declareSchemaLocation
protected boolean declareSchemaLocation
-
declareSchemaLocationImplementation
protected boolean declareSchemaLocationImplementation
-
xmlSchemaTypePackage
protected org.eclipse.emf.ecore.EPackage xmlSchemaTypePackage
-
map
protected org.eclipse.emf.ecore.xmi.XMLResource.XMLMap map
-
extendedMetaData
protected org.eclipse.emf.ecore.util.ExtendedMetaData extendedMetaData
-
anySimpleType
protected org.eclipse.emf.ecore.EClass anySimpleType
-
anyType
protected org.eclipse.emf.ecore.EClass anyType
-
resource
protected FormattingXmlResource resource
-
eObjectToExtensionMap
protected Map<org.eclipse.emf.ecore.EObject,org.eclipse.emf.ecore.xml.type.AnyType> eObjectToExtensionMap
-
elementHandler
protected org.eclipse.emf.ecore.xmi.XMLResource.ElementHandler elementHandler
-
saveXsiType
protected boolean saveXsiType
-
crossReferenceSerializer
@Inject(optional=true) protected ICrossReferenceSerializer crossReferenceSerializer
-
-
Method Detail
-
setUriEncoder
public void setUriEncoder(LazyUriEncoder uriEncoder)
-
init
public void init(org.eclipse.emf.ecore.xmi.XMLHelper helper, Map<?,?> options)
-
format
public INode format(org.eclipse.emf.ecore.xmi.XMLHelper helper, Map<?,?> options)
- Specified by:
format
in interfaceIFormatter
-
shouldSaveFeature
protected boolean shouldSaveFeature(org.eclipse.emf.ecore.EObject o, org.eclipse.emf.ecore.EStructuralFeature f)
-
shouldSaveObject
protected boolean shouldSaveObject(org.eclipse.emf.ecore.EObject child)
-
formatRootNode
protected void formatRootNode()
-
formatEObject
protected void formatEObject(org.eclipse.emf.ecore.EObject obj, INode parentNode)
-
formatingRootNode
protected void formatingRootNode(ContainmentReferenceNode oldNode, INode parent, org.eclipse.emf.ecore.EObject root)
-
formatingContainmentReferenceNode
protected void formatingContainmentReferenceNode(ContainmentReferenceNode oldNode, INode parent, org.eclipse.emf.ecore.EObject obj)
-
formatFeatures
protected boolean formatFeatures(org.eclipse.emf.ecore.EObject obj, ContainmentReferenceNode parent, ContainmentReferenceNode oldParent)
-
formatExistFeaturesWithoutElements
protected void formatExistFeaturesWithoutElements(org.eclipse.emf.ecore.EObject obj, ContainmentReferenceNode parent, ContainmentReferenceNode oldParent, List<org.eclipse.emf.ecore.EStructuralFeature> listExistFeatures, List<INode> listExistElementNodes, List<org.eclipse.emf.ecore.EStructuralFeature> listExistElementFeatures)
-
formatNewFeaturesWithoutElements
protected void formatNewFeaturesWithoutElements(org.eclipse.emf.ecore.EObject obj, ContainmentReferenceNode parent, List<org.eclipse.emf.ecore.EStructuralFeature> listExistFeatures, List<org.eclipse.emf.ecore.EStructuralFeature> listExistElementFeatures, List<org.eclipse.emf.ecore.EStructuralFeature> featureElementsList)
-
formatExistFeaturesLikeElements
protected void formatExistFeaturesLikeElements(org.eclipse.emf.ecore.EObject obj, ContainmentReferenceNode parent, List<org.eclipse.emf.ecore.EStructuralFeature> listExistFeatures, List<INode> listExistElementNodes)
-
formatNewFeaturesLikeElements
protected void formatNewFeaturesLikeElements(org.eclipse.emf.ecore.EObject obj, ContainmentReferenceNode parent, List<org.eclipse.emf.ecore.EStructuralFeature> listExistFeatures, List<org.eclipse.emf.ecore.EStructuralFeature> listExistElementFeatures, List<org.eclipse.emf.ecore.EStructuralFeature> featureElementsList)
-
formatXsiTypeRootNode
protected void formatXsiTypeRootNode(org.eclipse.emf.ecore.EObject root, ContainmentReferenceNode parent, NamespaceNode oldNode)
-
formatXsiTypeNode
protected void formatXsiTypeNode(org.eclipse.emf.ecore.EStructuralFeature f, org.eclipse.emf.ecore.EObject value, AbstractNode parent, NamespaceNode oldNode)
-
createRootNode
protected void createRootNode(org.eclipse.emf.ecore.EObject root, INode parent)
-
createContainmentReferenceNode
protected void createContainmentReferenceNode(org.eclipse.emf.ecore.EObject obj, INode parent)
-
createFeatures
protected boolean createFeatures(org.eclipse.emf.ecore.EObject obj, ContainmentReferenceNode node, boolean isRootNode)
Создает ноды по фичам.- Parameters:
obj
-node
-isRootNode
-- Returns:
- true - если среди созданых фич есть элементы.
-
createNonContaimentManyReferenceNodes
protected void createNonContaimentManyReferenceNodes(org.eclipse.emf.ecore.EObject obj, org.eclipse.emf.ecore.EStructuralFeature f, ContainmentReferenceNode parent)
-
createNonContaimentReferenceNode
protected NonContainmentReferenceNode createNonContaimentReferenceNode(org.eclipse.emf.ecore.EObject obj, org.eclipse.emf.ecore.EStructuralFeature f, ContainmentReferenceNode parent)
-
createAttributeManyElementsNodes
protected void createAttributeManyElementsNodes(org.eclipse.emf.ecore.EObject obj, org.eclipse.emf.ecore.EStructuralFeature f, ContainmentReferenceNode node)
-
createAttributeNode
protected void createAttributeNode(org.eclipse.emf.ecore.EObject obj, org.eclipse.emf.ecore.EStructuralFeature f, ContainmentReferenceNode parent, int mark)
-
createTextNodeWithIndent
protected TextNode createTextNodeWithIndent(INode parentNode, boolean isLast)
-
createXsiTypeRootNode
protected void createXsiTypeRootNode(org.eclipse.emf.ecore.EObject root, ContainmentReferenceNode parent)
-
createXsiTypeNode
protected void createXsiTypeNode(org.eclipse.emf.ecore.EStructuralFeature f, org.eclipse.emf.ecore.EObject value, AbstractNode parent)
-
getXsiTypeRootName
protected String getXsiTypeRootName(org.eclipse.emf.ecore.EObject root)
-
getXsiTypeName
protected String getXsiTypeName(org.eclipse.emf.ecore.EStructuralFeature f, org.eclipse.emf.ecore.EObject value)
-
getXsiTypeAttributeNode
protected NamespaceNode getXsiTypeAttributeNode(String uri)
-
hasAnnotationName
protected boolean hasAnnotationName(org.eclipse.emf.ecore.EClass eClass, org.eclipse.emf.ecore.EStructuralFeature f)
Метод возвращает имя объекта записанного в аннотации- Parameters:
eClass
- объектаf
- которой объект является в contein объекте- Returns:
- Возвращает имя объекта либо null если нет подходящей аннотации
-
-