RequestContext.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 » RequestContext.java
package com.completex.objective.components.persistency.mapper;

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

import java.util.HashSet;
import java.util.Set;
import java.util.Map;

/**
 * @author Gennady Krizhevsky
 */
public class RequestContext {
    private Object parentBean;
    private Set seen = new HashSet();
    private Map typeMap;

    public RequestContext() {
    }

    public RequestContext(Map typeMap) {
        this.typeMap = typeMap;
    }

    public Object getParentBean() {
        return parentBean;
    }

    public void setParentBean(Object parentBean) {
        if (parentBean != null && this.parentBean == null) {
            this.parentBean = parentBean;
        }
    }

    public void addToSeen(String valuePath) {
        seen.add(valuePath);
    }

    public boolean isSeen(String valuePath) {
        return seen.contains(valuePath);
    }

    public Map getTypeMap() {
        return typeMap;
    }

    public void setTypeMap(Map typeMap) {
        this.typeMap = typeMap;
    }

    public Class getByFieldName(String name) {
        return typeMap == null ? null : (Class) typeMap.get(name);
    }

    public boolean typeMappingExists(String name) {
        return getByFieldName(name) != null;
    }

}
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.