Package com.bradmcevoy.http.quota

Source Code of com.bradmcevoy.http.quota.DefaultQuotaDataAccessor

package com.bradmcevoy.http.quota;

import com.bradmcevoy.http.QuotaResource;
import com.bradmcevoy.http.Resource;

/**
* Default implementation which just reads the quota properties from
* QuotaResource, if the given resource implements it. Otherwise
* returns null;
*
* @author brad
*/
public class DefaultQuotaDataAccessor implements QuotaDataAccessor {

    public Long getQuotaAvailable( Resource res ) {
        if( res instanceof QuotaResource ) {
            QuotaResource quotaRes = (QuotaResource) res;
            Long l = quotaRes.getQuotaAvailable();
            return l;
        } else {
            return null;
        }

    }

    public Long getQuotaUsed( Resource res ) {
        if( res instanceof QuotaResource ) {
            QuotaResource quotaRes = (QuotaResource) res;
            Long l = quotaRes.getQuotaUsed();
            return l;
        } else {
            return null;
        }
    }
}
TOP

Related Classes of com.bradmcevoy.http.quota.DefaultQuotaDataAccessor

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.