net.sf.mmm.util.xml.base.jaxb
Class JaxbBeanHolderImpl<VIEW,BEAN extends VIEW>

java.lang.Object
  extended by net.sf.mmm.util.component.base.AbstractLoggableObject
      extended by net.sf.mmm.util.xml.base.jaxb.JaxbBeanHolderImpl<VIEW,BEAN>
Type Parameters:
VIEW - is the generic type for the API of the JAXB bean.
BEAN - is the generic type for the implementation of the JAXB bean.
All Implemented Interfaces:
Flushable, Refreshable, JaxbBeanHolder<VIEW>

public class JaxbBeanHolderImpl<VIEW,BEAN extends VIEW>
extends AbstractLoggableObject
implements JaxbBeanHolder<VIEW>, Flushable

This is the implementation of JaxbBeanHolder.

Since:
2.0.0
Author:
Joerg Hohwiller (hohwille at users.sourceforge.net)

Field Summary
private  boolean allowSave
           
private  BEAN bean
           
private  XmlBeanMapper<BEAN> beanMapper
          The XmlBeanMapper.
private  DataResource dataResource
          The DataResource where the bean was loaded from.
private  Date modificationDate
           
 
Constructor Summary
JaxbBeanHolderImpl(BEAN bean, DataResource resource, XmlBeanMapper<BEAN> beanMapper)
          The constructor.
JaxbBeanHolderImpl(BEAN bean, DataResource resource, XmlBeanMapper<BEAN> beanMapper, boolean allowSave)
          The constructor.
 
Method Summary
 void flush()
          
 BEAN getBean()
          This method gets the current JAXB bean.
protected  DataResource getDataResource()
          This method gets the DataResource where the bean was loaded from.
 boolean isAllowSave()
          This method determines if this implementation allows to save.
 boolean refresh()
          This method will reload the configuration if it has changed.
 
Methods inherited from class net.sf.mmm.util.component.base.AbstractLoggableObject
getLogger
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

dataResource

private final DataResource dataResource
The DataResource where the bean was loaded from.


beanMapper

private final XmlBeanMapper<BEAN extends VIEW> beanMapper
The XmlBeanMapper.


allowSave

private final boolean allowSave
See Also:
isAllowSave()

bean

private BEAN extends VIEW bean
See Also:
getBean()

modificationDate

private Date modificationDate
See Also:
refresh()
Constructor Detail

JaxbBeanHolderImpl

public JaxbBeanHolderImpl(BEAN bean,
                          DataResource resource,
                          XmlBeanMapper<BEAN> beanMapper)
The constructor.

Parameters:
bean - is the JAXB bean.
resource - is the resource.
beanMapper - is the XmlBeanMapper used for flush() and refresh().

JaxbBeanHolderImpl

public JaxbBeanHolderImpl(BEAN bean,
                          DataResource resource,
                          XmlBeanMapper<BEAN> beanMapper,
                          boolean allowSave)
The constructor.

Parameters:
bean - is the JAXB bean.
resource - is the resource.
beanMapper - is the XmlBeanMapper used for flush() and refresh().
allowSave - - see isAllowSave().
Method Detail

isAllowSave

public boolean isAllowSave()
This method determines if this implementation allows to save.

Returns:
true if saving is allowed, false otherwise.

getBean

public BEAN getBean()
This method gets the current JAXB bean.

Specified by:
getBean in interface JaxbBeanHolder<VIEW>
Returns:
the current JAXB bean.

getDataResource

protected DataResource getDataResource()
This method gets the DataResource where the bean was loaded from.

Returns:
the DataResource.

flush

public void flush()

Specified by:
flush in interface Flushable

refresh

public boolean refresh()
This method will reload the configuration if it has changed. This method refreshes the given object. This can be anything from reloading configuration to rebuilding the internal state. An invocation of this method may be expensive and should only be invoked as needed. The implementation of this method should be thread-safe if the object itself is to be used by separate consumers at all.

Specified by:
refresh in interface Refreshable
Specified by:
refresh in interface JaxbBeanHolder<VIEW>
Returns:
true if something has changed, false otherwise. If the implementation can not determine the change it should return true.


Copyright © 2001-2010 mmm-Team. All Rights Reserved.