/*******************************************************************************
- * Copyright (c) 2012, 2013 Ericsson
+ * Copyright (c) 2012, 2014 Ericsson
*
* All rights reserved. This program and the accompanying materials are
* made available under the terms of the Eclipse Public License v1.0 which
*
* Contributors:
* Francois Chouinard - Initial API and implementation
+ * Alexandre Montplaisir - Removed arrays from the API
*******************************************************************************/
package org.eclipse.linuxtools.tmf.core.event;
+import java.util.Collection;
+
+import org.eclipse.jdt.annotation.NonNull;
+
/**
* The generic event payload in TMF. Each field can be either a terminal or
* further decomposed into subfields.
/**
* The root field id (the main container)
*/
- public static final String ROOT_FIELD_ID = ":root:"; //$NON-NLS-1$
+ public static final @NonNull String ROOT_FIELD_ID = ":root:"; //$NON-NLS-1$
// ------------------------------------------------------------------------
// Getters
String getFormattedValue();
/**
- * @return the list of subfield names (empty array if none)
- */
- String[] getFieldNames();
-
- /**
- * @param index The index of the field
- * @return the nth field name (null if absent or inexistent)
+ * Return the subfield names. The iteration order is the same as
+ * {@link #getFields()}. The returned Collection is immutable.
+ *
+ * @return The subfield names (empty Collection if none)
+ * @since 3.0
*/
- String getFieldName(int index);
+ Collection<String> getFieldNames();
/**
- * @return the list of subfields (empty array if none)
+ * Return the subfield. The iteration order is the same as
+ * {@link #getFieldNames()}. The returned Collection is immutable.
+ *
+ * @return The subfields (empty Collection if none)
+ * @since 3.0
*/
- ITmfEventField[] getFields();
+ Collection<? extends ITmfEventField> getFields();
/**
* @param name The name of the field
*/
ITmfEventField getField(String name);
- /**
- * @param index The index of the field to return
- * @return a specific subfield by index (null if absent or inexistent)
- */
- ITmfEventField getField(int index);
-
/**
* Gets the a sub-field of this field, which may be multiple levels down.
*
* found
* @since 3.0
*/
- ITmfEventField getSubField(String[] path);
+ ITmfEventField getSubField(String... path);
}