AdHocPoBeanConverter.java :  » Database-ORM » ODAL » com » completex » objective » components » persistency » mapper » Java Open Source

Java Open Source » Database ORM » ODAL 
ODAL » com » completex » objective » components » persistency » mapper » AdHocPoBeanConverter.java
package com.completex.objective.components.persistency.mapper;

import com.completex.objective.components.persistency.PersistentObject;
import com.completex.objective.components.persistency.CompoundPersistentObject;

import java.util.Map;

/**
 * Converts persistent objects to corresponding beans without pre-defined mapping. 
 * 
 * @author Gennady Krizhevsky
 */
public interface AdHocPoBeanConverter {
    /**
     * 
     * Converts persistent object to corresponding bean
     * 
     * @param po persistent object
     * @param beanClass bean class
     * @return bean populated with persistent object data
     */
    Object convert(PersistentObject po, Class beanClass);

    /**
     * Converts compound persistent object to corresponding bean array.
     * If number of entries in the compound persistent object > bean classes array size
     * then the common ones get converted, the extra ones get returned unconverted. That is
     * the size of resulting array is equal to the size of the compound entries one.
     * 
     * @param cpo compound persistent object
     * @param beanClasses bean classes array
     * @return bean array populated with persistent object data
     */
    Object[] convert(CompoundPersistentObject cpo, Class[] beanClasses);

    /**
     * Converts persistent object to corresponding bean
     * 
     * @param po persistent object
     * @param beanClass bean class
     * @param typeMap type map containing PersistentEntry column of Link name as a key and 
     * the corresponding bean class as a value 
     * @return bean populated with persistent object data
     */
    Object convert(PersistentObject po, Class beanClass, Map typeMap);
}
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.