Package net.sourceforge.pmd.util
Class TypeMap
- java.lang.Object
-
- net.sourceforge.pmd.util.TypeMap
-
@Deprecated @InternalApi public class TypeMap extends Object
Deprecated.Is internal APIA specialized map that stores types by both their full and short (without package prefixes) names. If an incoming type shares the same name (but different package/prefix) with a type already in the map then an IllegalArgumentException will be thrown since any subsequent retrievals by said short name could be in error.- Author:
- Brian Remedios
-
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description void
add(Class<?> type)
Deprecated.Adds a type to the receiver and stores it keyed by both its full and short names.void
add(Class<?>... types)
Deprecated.Adds an array of types to the receiver at once.Map<Class<?>,String>
asInverseWithShortName()
Deprecated.Creates and returns a map of short type names (without the package prefixes) keyed by the classes themselves.boolean
contains(Class<?> type)
Deprecated.Returns whether the type is known to the receiver.boolean
contains(String typeName)
Deprecated.Returns whether the typeName is known to the receiver.int
size()
Deprecated.Returns the total number of entries in the receiver.Class<?>
typeFor(String typeName)
Deprecated.Returns the type for the typeName specified.
-
-
-
Constructor Detail
-
TypeMap
public TypeMap(int initialSize)
Deprecated.Constructor for TypeMap.- Parameters:
initialSize
- int
-
TypeMap
public TypeMap(Class<?>... types)
Deprecated.Constructor for TypeMap that takes in an initial set of types.- Parameters:
types
- Class[]
-
-
Method Detail
-
add
public void add(Class<?> type)
Deprecated.Adds a type to the receiver and stores it keyed by both its full and short names. Throws an exception if the short name of the argument matches an existing one already in the map for a different class.- Parameters:
type
- Class- Throws:
IllegalArgumentException
-
contains
public boolean contains(Class<?> type)
Deprecated.Returns whether the type is known to the receiver.- Parameters:
type
- Class- Returns:
- boolean
-
contains
public boolean contains(String typeName)
Deprecated.Returns whether the typeName is known to the receiver.- Parameters:
typeName
- String- Returns:
- boolean
-
typeFor
public Class<?> typeFor(String typeName)
Deprecated.Returns the type for the typeName specified.- Parameters:
typeName
- String- Returns:
- Class
-
add
public void add(Class<?>... types)
Deprecated.Adds an array of types to the receiver at once.- Parameters:
types
- Class[]
-
asInverseWithShortName
public Map<Class<?>,String> asInverseWithShortName()
Deprecated.Creates and returns a map of short type names (without the package prefixes) keyed by the classes themselves.- Returns:
- Map
-
size
public int size()
Deprecated.Returns the total number of entries in the receiver. This will be exactly twice the number of types added.- Returns:
- the total number of entries in the receiver
-
-