001/*- 002 ******************************************************************************* 003 * Copyright (c) 2011, 2016 Diamond Light Source Ltd. 004 * All rights reserved. This program and the accompanying materials 005 * are made available under the terms of the Eclipse Public License v1.0 006 * which accompanies this distribution, and is available at 007 * http://www.eclipse.org/legal/epl-v10.html 008 * 009 * Contributors: 010 * Peter Chang - initial API and implementation and/or initial documentation 011 *******************************************************************************/ 012 013package org.eclipse.january.dataset; 014 015import java.util.List; 016 017import org.eclipse.january.MetadataException; 018import org.eclipse.january.metadata.IMetadata; 019import org.eclipse.january.metadata.MetadataType; 020 021/** 022 * Interface which acts to provide metadata from an object 023 */ 024public interface IMetadataProvider { 025 026 /** 027 * @deprecated Use {@code getFirstMetadata(IMetadata.class)} instead 028 * @return an instance of IMetadata 029 * @throws Exception when failing to fetch metadata 030 */ 031 @Deprecated 032 public IMetadata getMetadata() throws Exception; 033 034 /** 035 * @param <T> metadata sub-interface 036 * @param clazz if null return everything 037 * @return list of metadata with given class (or its super interface) 038 * @throws MetadataException when failing to fetch metadata 039 */ 040 public <T extends MetadataType> List<T> getMetadata(Class<T> clazz) throws MetadataException; 041 042 /** 043 * @param <T> metadata sub-interface 044 * @param clazz if null return first from everything 045 * @return first element from list of metadata with given class (or its super interface) 046 */ 047 public <T extends MetadataType> T getFirstMetadata(Class<T> clazz); 048}