1 /*
   2  * Copyright (c) 1997, 2013, Oracle and/or its affiliates. All rights reserved.
   3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
   4  *
   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.  Oracle designates this
   8  * particular file as subject to the "Classpath" exception as provided
   9  * by Oracle in the LICENSE file that accompanied this code.
  10  *
  11  * This code is distributed in the hope that it will be useful, but WITHOUT
  12  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  13  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  14  * version 2 for more details (a copy is included in the LICENSE file that
  15  * accompanied this code).
  16  *
  17  * You should have received a copy of the GNU General Public License version
  18  * 2 along with this work; if not, write to the Free Software Foundation,
  19  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  20  *
  21  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  22  * or visit www.oracle.com if you need additional information or have any
  23  * questions.
  24  */
  25 
  26 package java.awt.datatransfer;
  27 
  28 import java.util.Map;
  29 
  30 
  31 /**
  32  * A two-way Map between "natives" (Strings), which correspond to platform-
  33  * specific data formats, and "flavors" (DataFlavors), which correspond to
  34  * platform-independent MIME types. FlavorMaps need not be symmetric, but
  35  * typically are.
  36  *
  37  *
  38  * @since 1.2
  39  */
  40 public interface FlavorMap {
  41 
  42     /**
  43      * Returns a <code>Map</code> of the specified <code>DataFlavor</code>s to
  44      * their corresponding <code>String</code> native. The returned
  45      * <code>Map</code> is a modifiable copy of this <code>FlavorMap</code>'s
  46      * internal data. Client code is free to modify the <code>Map</code>
  47      * without affecting this object.
  48      *
  49      * @param flavors an array of <code>DataFlavor</code>s which will be the
  50      *        key set of the returned <code>Map</code>. If <code>null</code> is
  51      *        specified, a mapping of all <code>DataFlavor</code>s currently
  52      *        known to this <code>FlavorMap</code> to their corresponding
  53      *        <code>String</code> natives will be returned.
  54      * @return a <code>java.util.Map</code> of <code>DataFlavor</code>s to
  55      *         <code>String</code> natives
  56      */
  57     Map<DataFlavor,String> getNativesForFlavors(DataFlavor[] flavors);
  58 
  59     /**
  60      * Returns a <code>Map</code> of the specified <code>String</code> natives
  61      * to their corresponding <code>DataFlavor</code>. The returned
  62      * <code>Map</code> is a modifiable copy of this <code>FlavorMap</code>'s
  63      * internal data. Client code is free to modify the <code>Map</code>
  64      * without affecting this object.
  65      *
  66      * @param natives an array of <code>String</code>s which will be the
  67      *        key set of the returned <code>Map</code>. If <code>null</code> is
  68      *        specified, a mapping of all <code>String</code> natives currently
  69      *        known to this <code>FlavorMap</code> to their corresponding
  70      *        <code>DataFlavor</code>s will be returned.
  71      * @return a <code>java.util.Map</code> of <code>String</code> natives to
  72      *         <code>DataFlavor</code>s
  73      */
  74     Map<String,DataFlavor> getFlavorsForNatives(String[] natives);
  75 }