SystemFlavorMap.java 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170
  1. /* SystemFlavorMap.java -- Maps between native flavor names and MIME types.
  2. Copyright (C) 2001 Free Software Foundation, Inc.
  3. This file is part of GNU Classpath.
  4. GNU Classpath is free software; you can redistribute it and/or modify
  5. it under the terms of the GNU General Public License as published by
  6. the Free Software Foundation; either version 2, or (at your option)
  7. any later version.
  8. GNU Classpath is distributed in the hope that it will be useful, but
  9. WITHOUT ANY WARRANTY; without even the implied warranty of
  10. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  11. General Public License for more details.
  12. You should have received a copy of the GNU General Public License
  13. along with GNU Classpath; see the file COPYING. If not, write to the
  14. Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
  15. 02111-1307 USA.
  16. Linking this library statically or dynamically with other modules is
  17. making a combined work based on this library. Thus, the terms and
  18. conditions of the GNU General Public License cover the whole
  19. combination.
  20. As a special exception, the copyright holders of this library give you
  21. permission to link this library with independent modules to produce an
  22. executable, regardless of the license terms of these independent
  23. modules, and to copy and distribute the resulting executable under
  24. terms of your choice, provided that you also meet, for each linked
  25. independent module, the terms and conditions of the license of that
  26. module. An independent module is a module which is not derived from
  27. or based on this library. If you modify this library, you may extend
  28. this exception to your version of the library, but you are not
  29. obligated to do so. If you do not wish to do so, delete this
  30. exception statement from your version. */
  31. package java.awt.datatransfer;
  32. import java.util.HashMap;
  33. import java.util.Map;
  34. import java.util.List;
  35. /**
  36. * This class maps between native platform type names and DataFlavors.
  37. *
  38. * XXX - The current implementation does no mapping at all.
  39. *
  40. * @author Mark Wielaard (mark@klomp.org)
  41. *
  42. * @since 1.2
  43. */
  44. public final class SystemFlavorMap implements FlavorMap, FlavorTable
  45. {
  46. /**
  47. * The default (instance) flavor map.
  48. */
  49. private static FlavorMap defaultFlavorMap;
  50. /**
  51. * Private constructor.
  52. */
  53. private SystemFlavorMap ()
  54. {
  55. }
  56. /**
  57. * Maps the specified <code>DataFlavor</code> objects to the native
  58. * data type name. The returned <code>Map</code> has keys that are
  59. * the data flavors and values that are strings. The returned map
  60. * may be modified. This can be useful for implementing nested mappings.
  61. *
  62. * @param flavors An array of data flavors to map
  63. * or null for all data flavors.
  64. *
  65. * @return A <code>Map</code> of native data types to data flavors.
  66. */
  67. public Map getNativesForFlavors (DataFlavor[] flavors)
  68. {
  69. return new HashMap();
  70. }
  71. /**
  72. * Maps the specified native type names to <code>DataFlavor</code>'s.
  73. * The returned <code>Map</code> has keys that are strings and values
  74. * that are <code>DataFlavor</code>'s. The returned map may be
  75. * modified. This can be useful for implementing nested mappings.
  76. *
  77. * @param natives An array of native types to map
  78. * or null for all native types.
  79. *
  80. * @return A <code>Map</code> of data flavors to native type names.
  81. */
  82. public Map getFlavorsForNatives (String[] natives)
  83. {
  84. return new HashMap();
  85. }
  86. /**
  87. * Returns the default (instance) (System)FlavorMap.
  88. */
  89. public static FlavorMap getDefaultFlavorMap ()
  90. {
  91. if (defaultFlavorMap == null)
  92. defaultFlavorMap = new SystemFlavorMap ();
  93. return defaultFlavorMap;
  94. }
  95. /**
  96. * Returns the native type name for the given java mime type.
  97. */
  98. public static String encodeJavaMIMEType (String mime)
  99. {
  100. return null;
  101. }
  102. /**
  103. * Returns the native type name for the given data flavor.
  104. */
  105. public static String encodeDataFlavor (DataFlavor df)
  106. {
  107. return null;
  108. }
  109. /**
  110. * Returns true if the native type name can be represented as
  111. * a java mime type.
  112. */
  113. public static boolean isJavaMIMEType (String name)
  114. {
  115. return false;
  116. }
  117. /**
  118. * Returns the java mime type for the given the native type name.
  119. */
  120. public static String decodeJavaMIMEType (String name)
  121. {
  122. return null;
  123. }
  124. /**
  125. * Returns the data flavor given the native type name
  126. * or null when no such data flavor exists.
  127. */
  128. public static DataFlavor decodeDataFlavor (String name)
  129. throws ClassNotFoundException
  130. {
  131. String javaMIMEType = decodeJavaMIMEType (name);
  132. if (javaMIMEType != null)
  133. return new DataFlavor (javaMIMEType);
  134. else
  135. return null;
  136. }
  137. public List getFlavorsForNative (String nat)
  138. {
  139. throw new Error ("Not implemented");
  140. }
  141. public List getNativesForFlavor (DataFlavor flav)
  142. {
  143. throw new Error ("Not implemented");
  144. }
  145. } // class SystemFlavorMap