net.sf.jabb.camel
Class CombinedRegistry

java.lang.Object
  extended by net.sf.jabb.camel.CombinedRegistry
All Implemented Interfaces:
org.apache.camel.spi.Registry

public class CombinedRegistry
extends Object
implements org.apache.camel.spi.Registry

It enables you to combine several Registry(s) into one.
它使得你可以把好几个Registry合并在一起。

When looking up something in it, it will try those encapsulated Registry(s) one by one. And it has an internal SimpleRegistry, as the last one to try. You can also write code to add entries to the internal SimpleRegistry.

当查找东西的时候,它会逐个尝试这些个Registry。而且,它内置一个SimpleRegistry, 作为最后一个尝试的Registry。你还可以通过内置的SimpleRegistry来利用 程序添加自己额外的内容。

Author:
Zhengmao HU (James)

Field Summary
protected  org.apache.camel.impl.SimpleRegistry defaultSimpleRegistry
           
protected  List<org.apache.camel.spi.Registry> registryList
           
 
Constructor Summary
CombinedRegistry()
          Constructs an instance that contains only an internal SimpleRegistry.
创建一个实例,它仅含有内置的SimpleRegistry。
CombinedRegistry(org.apache.camel.spi.Registry... registries)
          Constructs an instance that contains not only an internal SimpleRegistry, but also several Registry(s) specified.
创建一个除了内置的SimpleRegistry之外,还包含指定的一些Registry的实例。
CombinedRegistry(org.apache.camel.spi.Registry registry)
          Constructs an instance that contains not only an internal SimpleRegistry, but also the Registry specified.
创建一个除了内置的SimpleRegistry之外,还包含指定Registry的实例。
 
Method Summary
 void addRegistry(org.apache.camel.spi.Registry... registries)
          Adds several Registry(s) which will be put after all others but just before the internal SimpleRegistry.
添加一些Registry,它们的位置会位于其他Registry之后,但是在缺省的SimpleRegistry之前。
 void addRegistry(org.apache.camel.spi.Registry registry)
          Adds a Registry which will be put after all others but just before the internal SimpleRegistry.
添加一个Registry,它的位置会位于其他Registry之后,但是在缺省的SimpleRegistry之前。
 org.apache.camel.impl.SimpleRegistry getDefaultSimpleRegistry()
          Gets the internal SimpleRegistry which can be manipulated later.
获得其内置的缺省SimpleRegistry,其后可以向它进行增删改查操作。
 Object lookup(String name)
          Looks up from all encapsulated Registry(s) one by one, and returns the first result found.
按次序从所封装的Registry中查找,返回第一个找到的结果。
<T> T
lookup(String name, Class<T> type)
          Looks up from all encapsulated Registry(s) one by one, and returns the first result found.
按次序从所封装的Registry中查找,返回第一个找到的结果。
<T> Map<String,T>
lookupByType(Class<T> type)
          Looks up from all encapsulated Registry(s) one by one, and returns all the result found.
按次序从所封装的Registry中查找,并返回所有能找到的结果。
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

defaultSimpleRegistry

protected org.apache.camel.impl.SimpleRegistry defaultSimpleRegistry

registryList

protected List<org.apache.camel.spi.Registry> registryList
Constructor Detail

CombinedRegistry

public CombinedRegistry()
Constructs an instance that contains only an internal SimpleRegistry.
创建一个实例,它仅含有内置的SimpleRegistry。


CombinedRegistry

public CombinedRegistry(org.apache.camel.spi.Registry registry)
Constructs an instance that contains not only an internal SimpleRegistry, but also the Registry specified.
创建一个除了内置的SimpleRegistry之外,还包含指定Registry的实例。

Parameters:
registry - The Registry that will be encapsulated.

CombinedRegistry

public CombinedRegistry(org.apache.camel.spi.Registry... registries)
Constructs an instance that contains not only an internal SimpleRegistry, but also several Registry(s) specified.
创建一个除了内置的SimpleRegistry之外,还包含指定的一些Registry的实例。

Parameters:
registries - The Registry(s) that will be encapsulated.
Method Detail

addRegistry

public void addRegistry(org.apache.camel.spi.Registry registry)
Adds a Registry which will be put after all others but just before the internal SimpleRegistry.
添加一个Registry,它的位置会位于其他Registry之后,但是在缺省的SimpleRegistry之前。


addRegistry

public void addRegistry(org.apache.camel.spi.Registry... registries)
Adds several Registry(s) which will be put after all others but just before the internal SimpleRegistry.
添加一些Registry,它们的位置会位于其他Registry之后,但是在缺省的SimpleRegistry之前。


lookup

public Object lookup(String name)
Looks up from all encapsulated Registry(s) one by one, and returns the first result found.
按次序从所封装的Registry中查找,返回第一个找到的结果。

If no result can be found, null will be returned.

如果全都找不到,则返回null。

Specified by:
lookup in interface org.apache.camel.spi.Registry
See Also:
Registry.lookup(java.lang.String)

lookup

public <T> T lookup(String name,
                    Class<T> type)
Looks up from all encapsulated Registry(s) one by one, and returns the first result found.
按次序从所封装的Registry中查找,返回第一个找到的结果。

If no result can be found, null will be returned.

如果全都找不到,则返回null。

Specified by:
lookup in interface org.apache.camel.spi.Registry
See Also:
Registry.lookup(java.lang.String, java.lang.Class)

lookupByType

public <T> Map<String,T> lookupByType(Class<T> type)
Looks up from all encapsulated Registry(s) one by one, and returns all the result found.
按次序从所封装的Registry中查找,并返回所有能找到的结果。

If no result can be found, an empty Map will be returned.

如果全都找不到,则返回一个空的Map。

Specified by:
lookupByType in interface org.apache.camel.spi.Registry
See Also:
Registry.lookupByType(java.lang.Class)

getDefaultSimpleRegistry

public org.apache.camel.impl.SimpleRegistry getDefaultSimpleRegistry()
Gets the internal SimpleRegistry which can be manipulated later.
获得其内置的缺省SimpleRegistry,其后可以向它进行增删改查操作。

Returns:
The internal SimpleRegistry.


Copyright © 2012. All Rights Reserved.