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

com.identityx.clientSDK.queryHolders.BaseSpec Maven / Gradle / Ivy

There is a newer version: 5.6.0.2
Show newest version
/*
* Copyright Daon.
*
* 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 com.identityx.clientSDK.queryHolders;

import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.HashMap;
import java.util.Map;


public abstract class BaseSpec {

	public Map buildSearchValues() {
		
		HashMap result = new HashMap();
		Method[] methods = this.getClass().getDeclaredMethods();
		
		try {
			Object value;
			for (int i = 0; i < methods.length; i++) {
				String methodName = methods[i].getName();
				if (methodName.startsWith("get") && methodName.length() > 3) {
					value = methods[i].invoke(this, null);
					if (value != null) {
						String fieldName = methodName.substring(3, 4).toLowerCase();
						if (methodName.length() > 4) {
							fieldName = fieldName + methodName.substring(4, methodName.length());
						}
						result.put(fieldName, value.toString());
					}

				}
			}
		} catch (IllegalAccessException e) {
		} catch (IllegalArgumentException e) {
		} catch (InvocationTargetException e) {
		}

		return result;
	}
	
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy