Skip navigation links
net.sf.kdgcommons.lang

Class ClassTable<T>

    • Constructor Detail

      • ClassTable

        public ClassTable()
    • Method Detail

      • size

        public int size()
        Returns the number of mappings in this object. Useful for debugging/testing.
      • put

        public void put(Class<?> klass,
                        T object)
        Adds a mapping to the table, replacing any previous exact mapping for that class. Subclass mappings are not affected.
      • get

        public T get(Class<?> klass)
        Returns the mapping corresponding to the passed class, traversing its concrete inheritance hierarchy until a match is found. Returns null if unable to find a match.
      • getByObject

        public T getByObject(Object obj)
        Returns the mapping corresponding to the passed object's class.
      • replace

        public void replace(Class<?> klass,
                            T value)
        Replaces the mapping for the passed class and all known subclasses. This is an atomic operation. Note, however, that concurrent threads may see either the old or new mapping.