org.springframework.jmx.export.naming

## 类 KeyNamingStrategy

- java.lang.Object
- - org.springframework.jmx.export.naming.KeyNamingStrategy

- 所有已实现的接口:
    org.springframework.beans.factory.InitializingBean, ObjectNamingStrategy

      public class KeyNamingStrategy
      extends Object
      implements ObjectNamingStrategy, org.springframework.beans.factory.InitializingBean

  `ObjectNamingStrategy` implementation that builds `ObjectName` instances from the key used in the "beans" map passed to `MBeanExporter`.

  Can also check object name mappings, given as `Properties` or as `mappingLocations` of properties files. The key used to look up is the key used in `MBeanExporter`'s "beans" map. If no mapping is found for a given key, the key itself is used to build an `ObjectName`.

  从以下版本开始:
    1.2
  作者:
    Rob Harrop, Juergen Hoeller
  另请参阅:
    `setMappings(java.util.Properties)`, `setMappingLocation(org.springframework.core.io.Resource)`, `setMappingLocations(org.springframework.core.io.Resource...)`, `MBeanExporter.setBeans(java.util.Map<java.lang.String, java.lang.Object>)`

- - ### 字段概要

    字段
    限定符和类型 | 字段和说明
    --- | ---
    `protected Log` | `logger` `Log` instance for this class.

  - ### 构造器概要

    构造器
    构造器和说明
    `KeyNamingStrategy()`

  - ### 方法概要

    所有方法 实例方法 具体方法
    限定符和类型 | 方法和说明
    --- | ---
    `void` | `afterPropertiesSet()` Merges the `Properties` configured in the `mappings` and `mappingLocations` into the final `Properties` instance used for `ObjectName` resolution.
    `ObjectName` | `getObjectName(Object managedBean, String beanKey)` Attempts to retrieve the `ObjectName` via the given key, trying to find a mapped value in the mappings first.
    `void` | `setMappingLocation(org.springframework.core.io.Resource location)` Set a location of a properties file to be loaded, containing object name mappings.
    `void` | `setMappingLocations(org.springframework.core.io.Resource... mappingLocations)` Set location of properties files to be loaded, containing object name mappings.
    `void` | `setMappings(Properties mappings)` Set local properties, containing object name mappings, e.g. via the "props" tag in XML bean definitions.

    - ### 从类继承的方法 java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### 字段详细资料

    - #### logger

          protected final Log logger

      `Log` instance for this class.

  - ### 构造器详细资料

    - #### KeyNamingStrategy

          public KeyNamingStrategy()

  - ### 方法详细资料

    - #### setMappings

          public void setMappings(Properties mappings)

      Set local properties, containing object name mappings, e.g. via the "props" tag in XML bean definitions. These can be considered defaults, to be overridden by properties loaded from files.

    - #### setMappingLocation

          public void setMappingLocation(org.springframework.core.io.Resource location)

      Set a location of a properties file to be loaded, containing object name mappings.

    - #### setMappingLocations

          public void setMappingLocations(org.springframework.core.io.Resource... mappingLocations)

      Set location of properties files to be loaded, containing object name mappings.

    - #### afterPropertiesSet

          public void afterPropertiesSet()
                                  throws IOException

      Merges the `Properties` configured in the `mappings` and `mappingLocations` into the final `Properties` instance used for `ObjectName` resolution.
      指定者:
        `afterPropertiesSet` 在接口中 `org.springframework.beans.factory.InitializingBean`
      抛出:
        `IOException`

    - #### getObjectName

          public ObjectName getObjectName(Object managedBean,
                                          @Nullable
                                          String beanKey)
                                   throws MalformedObjectNameException

      Attempts to retrieve the `ObjectName` via the given key, trying to find a mapped value in the mappings first.
      指定者:
        `getObjectName` 在接口中 `ObjectNamingStrategy`
      参数:
        `managedBean` - the bean that will be exposed under the returned `ObjectName`
        `beanKey` - the key associated with this bean in the beans map passed to the `MBeanExporter`
      返回:
        the `ObjectName` instance
      抛出:
        `MalformedObjectNameException` - if the resulting `ObjectName` is invalid