net.sf.eos.entity
Class CommonNameResolver

java.lang.Object
  extended by net.sf.eos.config.Configured
      extended by net.sf.eos.entity.CommonNameResolver
All Implemented Interfaces:
Configurable

public abstract class CommonNameResolver
extends Configured

The common name resolver maps an ID of an entity to the common name of the entity.

Author:
Sascha Kohlmann

Field Summary
static String COMMON_NAME_RESOLVER_IMPL_CONFIG_NAME
          The configuration key name for the classname of the factory.
 
Constructor Summary
CommonNameResolver()
           
 
Method Summary
static CommonNameResolver newInstance(Configuration config)
          Creates a new instance of a of the recognizer.
 String resolveCommonName(String id)
          Resolves the common entity name for the default locale of the platform.
abstract  String resolveCommonName(String id, Locale locale)
          Resolves the common entity name for the given locale if available.
 
Methods inherited from class net.sf.eos.config.Configured
configure, getConfiguration
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

COMMON_NAME_RESOLVER_IMPL_CONFIG_NAME

@ConfigurationKey(type=CLASSNAME,
                  description="Resolver remaps an entity ID to a common name (human readable).")
public static final String COMMON_NAME_RESOLVER_IMPL_CONFIG_NAME
The configuration key name for the classname of the factory.

See Also:
newInstance(Configuration), Constant Field Values
Constructor Detail

CommonNameResolver

public CommonNameResolver()
Method Detail

newInstance

@FactoryMethod(key="net.sf.eos.entity.CommonNameResolver.impl")
public static final CommonNameResolver newInstance(Configuration config)
                                            throws EosException
Creates a new instance of a of the recognizer. If the Configuration contains a key COMMON_NAME_RESOLVER_IMPL_CONFIG_NAME a new instance of the classname in the value will instantiate.

Parameters:
config - the configuration
Returns:
a new instance
Throws:
EosException - if it is not possible to instantiate an instance

resolveCommonName

public String resolveCommonName(String id)
                         throws EosException
Resolves the common entity name for the default locale of the platform.

Parameters:
id - the ID of the entity
Returns:
a common name or null if the implementation is unable to resolve a common name.
Throws:
EosException - if an error occurs

resolveCommonName

public abstract String resolveCommonName(String id,
                                         Locale locale)
                                  throws EosException
Resolves the common entity name for the given locale if available.

Parameters:
id - the ID of the entity
locale - to get the right language of the common name.
Returns:
a common name or null if the implementation is unable to resolve a common name.
Throws:
EosException - if an error occurs


Copyright © 2008. All Rights Reserved.