Class ClassNameResolver
java.lang.Object
com.inductiveautomation.ignition.common.xmlserialization.ClassNameResolver
Serves as a bidirectional mapping between classes and their names. Supports aliases and package search paths. Also
 comes pre-configured with shortened aliases for most common types (primitives, numbers, lists, etc) and search paths
 for common java packages like lang, util, awt, swing, beans.
- 
Constructor SummaryConstructors
- 
Method SummaryModifier and TypeMethodDescriptionvoidAdds a new alias for this class.voidvoidaddSearchPath(String path) Deprecated.This functionality is deprecated.final ClassclassForName(String name) Attempts to find the Class for the given name, in the context of any aliases and search paths that have been previously configuredprotected ClassclassForNameImpl(String name) static ClassNameResolverReturns the inverse ofclassForName(String).
- 
Constructor Details- 
ClassNameResolverpublic ClassNameResolver()
 
- 
- 
Method Details- 
createBasic
- 
addDefaultspublic void addDefaults()
- 
addAliasAdds a new alias for this class. This alias takes precedence over a search path. Each alias can only be used once, but an class can have more than one alias. The class will resolve to the first alias (name) added for it.
- 
addSearchPathDeprecated.This functionality is deprecated. You can continue to add search paths for the backwards compatibility of de-serializing, but new serialized code will not contain the shortened versions of the classnames.Adds a new search path. For example, if you add the search path of "javax.swing" then the class "javax.swing.JLabel" will map bidirectionally to the string "JLabel"
- 
getNameReturns the inverse ofclassForName(String). That is, the appropriate string for which a call to classForName with the return value of this method would return clazz. Makes use of any configured aliases and search paths, and appropriately encodes array types.
- 
classForNameAttempts to find the Class for the given name, in the context of any aliases and search paths that have been previously configuredLogic is as follows: - Look through the aliases for the given name. These can be configured manually (see
 addAlias(Class, String)), and will also be added automatically to act as a cache of any of the following steps find the class.
- If the name starts with a "[", get call classForName recursively on name.substring(1) to
 find the array component type, and then find the array class using Array.newInstance(Class, int)
- Try Class.forName(name)
- Look through each search path (see addSearchPath(String), looking for Class.forName(searchPath + "." + name)
 - Throws:
- ClassNotFoundException
 
- Look through the aliases for the given name. These can be configured manually (see
 
- 
classForNameImpl- Throws:
- ClassNotFoundException
 
 
-