< prev index next >

src/jdk.accessibility/share/classes/com/sun/java/accessibility/util/Translator.java

Print this page




  61 @jdk.Exported
  62 public class Translator extends AccessibleContext
  63         implements Accessible, AccessibleComponent {
  64 
  65     /** The source object needing translating. */
  66     protected Object source;
  67 
  68     /**
  69      * Find a translator for this class.  If one doesn't exist for this
  70      * class explicitly, try its superclass and so on.
  71      *
  72      * @param c a Class
  73      * @return the {@code Translator} Class for the Class passed in
  74      */
  75     protected static Class<?> getTranslatorClass(Class<?> c) {
  76         Class<?> t = null;
  77         if (c == null) {
  78             return null;
  79         }
  80         try {
  81             t = Class.forName("com.sun.java.accessibility.util."
  82                               + c.getName()
  83                               + "Translator");
  84             return t;
  85         } catch (Exception e) {
  86             return getTranslatorClass(c.getSuperclass());
  87         }
  88     }
  89 
  90     /**
  91      * Obtain an object that implements interface {@code Accessible}.  If the object
  92      * passed in already implements interface {@code Accessible}, {@code getAccessible}
  93      * merely returns the object.
  94      *
  95      * @param o an Object; if a null is passed in a null is returned
  96      * @return an {@code Object}, possibly the {@code Object} passed in, that
  97      *     implements the {@code Accessible} interface for the {@code Object}
  98      *     which was passed in
  99      */
 100     public static Accessible getAccessible(Object o) {
 101         Accessible a = null;
 102 




  61 @jdk.Exported
  62 public class Translator extends AccessibleContext
  63         implements Accessible, AccessibleComponent {
  64 
  65     /** The source object needing translating. */
  66     protected Object source;
  67 
  68     /**
  69      * Find a translator for this class.  If one doesn't exist for this
  70      * class explicitly, try its superclass and so on.
  71      *
  72      * @param c a Class
  73      * @return the {@code Translator} Class for the Class passed in
  74      */
  75     protected static Class<?> getTranslatorClass(Class<?> c) {
  76         Class<?> t = null;
  77         if (c == null) {
  78             return null;
  79         }
  80         try {
  81             t = Class.forName("com.sun.java.accessibility.util.internal"
  82                               + c.getSimpleName()
  83                               + "Translator");
  84             return t;
  85         } catch (Exception e) {
  86             return getTranslatorClass(c.getSuperclass());
  87         }
  88     }
  89 
  90     /**
  91      * Obtain an object that implements interface {@code Accessible}.  If the object
  92      * passed in already implements interface {@code Accessible}, {@code getAccessible}
  93      * merely returns the object.
  94      *
  95      * @param o an Object; if a null is passed in a null is returned
  96      * @return an {@code Object}, possibly the {@code Object} passed in, that
  97      *     implements the {@code Accessible} interface for the {@code Object}
  98      *     which was passed in
  99      */
 100     public static Accessible getAccessible(Object o) {
 101         Accessible a = null;
 102 


< prev index next >