Package org.marketcetera.util.l10n
Class ContainerClassInfo
- java.lang.Object
-
- org.marketcetera.util.l10n.ContainerClassInfo
-
- All Implemented Interfaces:
MessageInfoProvider
public class ContainerClassInfo extends Object implements MessageInfoProvider
Holder of meta-information about a message container class, such asMessages. Note that only static, non-null fields are introspected.- Since:
- 0.6.0
- Version:
- $Id: ContainerClassInfo.java 16154 2012-07-14 16:34:05Z colin $
- Author:
- tlerios@marketcetera.com
- See Also:
org.marketcetera.util.log
-
-
Field Summary
Fields Modifier and Type Field Description private Class<?>mContainerprivate List<MessageInfo>mMessageInfoprivate I18NMessageProvidermProvider
-
Constructor Summary
Constructors Constructor Description ContainerClassInfo(Class<?> container)Creates a new meta-information holder for the given message container class.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected voidaddMessage(I18NMessage message)Adds the given message to the receiver's meta-information.Class<?>getContainer()Returns the receiver's container class.List<MessageInfo>getMessageInfo()Returns the receiver's meta-information.I18NMessageProvidergetProvider()Returns the internationalized message provider declared in the receiver's container class.private voidsetProvider(I18NMessageProvider provider)Sets the internationalized message provider declared in the receiver's container class to the given one.
-
-
-
Field Detail
-
mContainer
private Class<?> mContainer
-
mProvider
private I18NMessageProvider mProvider
-
mMessageInfo
private List<MessageInfo> mMessageInfo
-
-
Constructor Detail
-
ContainerClassInfo
public ContainerClassInfo(Class<?> container) throws I18NException
Creates a new meta-information holder for the given message container class.- Parameters:
container- The class.- Throws:
I18NException- Thrown if introspection of the given class fails, or the class does not contain a message provider.
-
-
Method Detail
-
addMessage
protected void addMessage(I18NMessage message) throws I18NException
Adds the given message to the receiver's meta-information.- Parameters:
message- The message.- Throws:
I18NException- Thrown if addition of the message fails due to the message having a different message provider than other messages in the receiver's container class.
-
getContainer
public Class<?> getContainer()
Returns the receiver's container class.- Returns:
- The class.
-
setProvider
private void setProvider(I18NMessageProvider provider) throws I18NException
Sets the internationalized message provider declared in the receiver's container class to the given one.- Parameters:
provider- The provider.- Throws:
I18NException- Thrown if the provider has already been set to a different one.
-
getProvider
public I18NMessageProvider getProvider()
Returns the internationalized message provider declared in the receiver's container class.- Returns:
- The provider.
-
getMessageInfo
public List<MessageInfo> getMessageInfo()
Description copied from interface:MessageInfoProviderReturns the receiver's meta-information.- Specified by:
getMessageInfoin interfaceMessageInfoProvider- Returns:
- The meta-information.
-
-