All Downloads are FREE. Search and download functionalities are using the official Maven repository.

mobi.cangol.mobile.service.analytics.IMapBuilder Maven / Gradle / Ivy

There is a newer version: 1.2.7
Show newest version
/**
 * Copyright (c) 2013 Cangol
 * 

* Licensed under the Apache License, Version 2.0 (the "License") * you may not use this file except in compliance with the License. * You may obtain a copy of the License at *

* http://www.apache.org/licenses/LICENSE-2.0 *

* Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package mobi.cangol.mobile.service.analytics; import java.util.HashMap; import java.util.Map; import mobi.cangol.mobile.logging.Log; final public class IMapBuilder { private String mUrl; private Map mParams; private IMapBuilder() { mParams = new HashMap<>(); } public static IMapBuilder build() { return new IMapBuilder(); } public String getUrl() { return mUrl; } public IMapBuilder setUrl(String url) { this.mUrl = url; return this; } public IMapBuilder set(String paramName, String paramValue) { if (paramName != null) { mParams.put(paramName, paramValue); } else { Log.w(" IMapBuilder.set() called with a null paramName."); } return this; } public IMapBuilder setAll(Map params) { if (params != null) { mParams.putAll(params); } return this; } public String get(String paramName) { return mParams.get(paramName); } @Override public String toString() { final StringBuilder builder = new StringBuilder(); builder.append("url=") .append(mUrl) .append('\n'); for (final String key : mParams.keySet()) { builder.append(key).append('=').append(mParams.get(key)); } return builder.toString(); } public Map getParams() { return mParams; } }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy