tmf: Bug 497038: Custom parser field names conflict with built-in tags
[deliverable/tracecompass.git] / tmf / org.eclipse.tracecompass.tmf.core / src / org / eclipse / tracecompass / tmf / core / parsers / custom / CustomXmlInputAttribute.java
index 5040c3df3bfd8ac354d31a514598fe2fad4c2d6a..5bbb8848a8e3116844dcf5f3031cb38f48264c2f 100644 (file)
@@ -1,5 +1,5 @@
 /*******************************************************************************
- * Copyright (c) 2014 Ericsson
+ * Copyright (c) 2014, 2016 Ericsson
  *
  * All rights reserved. This program and the accompanying materials are
  * made available under the terms of the Eclipse Public License v1.0 which
@@ -12,6 +12,8 @@
  *******************************************************************************/
 package org.eclipse.tracecompass.tmf.core.parsers.custom;
 
+import org.eclipse.tracecompass.tmf.core.parsers.custom.CustomTraceDefinition.Tag;
+
 /**
  * Wrapper for XML element attributes
  */
@@ -20,6 +22,9 @@ public final class CustomXmlInputAttribute {
     /** Name of the XML attribute */
     private final String fAttributeName;
 
+    /** Input tag */
+    private final Tag fInputTag;
+
     /** Input name */
     private final String fInputName;
 
@@ -40,10 +45,39 @@ public final class CustomXmlInputAttribute {
      *            Input action
      * @param inputFormat
      *            Input format
+     * @deprecated Use
+     *             {@link #CustomXmlInputAttribute(String, Tag, String, int, String)}
+     *             instead.
      */
+    @Deprecated
     public CustomXmlInputAttribute(String attributeName, String inputName,
             int inputAction, String inputFormat) {
         fAttributeName = attributeName;
+        fInputTag = Tag.IGNORE;
+        fInputName = inputName;
+        fInputAction = inputAction;
+        fInputFormat = inputFormat;
+    }
+
+    /**
+     * Constructor
+     *
+     * @param attributeName
+     *            Name of the XML attribute
+     * @param inputTag
+     *            Input tag
+     * @param inputName
+     *            Input name
+     * @param inputAction
+     *            Input action
+     * @param inputFormat
+     *            Input format
+     * @since 2.1
+     */
+    public CustomXmlInputAttribute(String attributeName, Tag inputTag,
+            String inputName, int inputAction, String inputFormat) {
+        fAttributeName = attributeName;
+        fInputTag = inputTag;
         fInputName = inputName;
         fInputAction = inputAction;
         fInputFormat = inputFormat;
@@ -56,6 +90,14 @@ public final class CustomXmlInputAttribute {
         return fAttributeName;
     }
 
+    /**
+     * @return the inputTag
+     * @since 2.1
+     */
+    public Tag getInputTag() {
+        return fInputTag;
+    }
+
     /**
      * @return the inputName
      */
This page took 0.026801 seconds and 5 git commands to generate.