org.slingerxv.limitart.rpcx.message.service.RPCMeta Maven / Gradle / Ivy
/*
* Copyright (c) 2016-present The Limitart Project
*
* 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 org.slingerxv.limitart.rpcx.message.service;
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
import org.slingerxv.limitart.net.binary.message.Message;
import org.slingerxv.limitart.net.binary.message.MessageMeta;
public abstract class RPCMeta extends Message {
protected final Object decodeObj(Class> type) throws Exception {
return decodeObj(type.getName());
}
@SuppressWarnings("unchecked")
protected final Object decodeObj(String type) throws Exception {
if (type == null || type.equals("null")) {
return null;
} else if (type.equals(Integer.class.getName()) || type.equals(int.class.getName())) {
return getInt();
} else if (type.equals(int[].class.getName())) {
return getIntArray();
} else if (type.equals(Byte.class.getName()) || type.equals(byte.class.getName())) {
return getByte();
} else if (type.equals(byte[].class.getName())) {
return getByteArray();
} else if (type.equals(Short.class.getName()) || type.equals(short.class.getName())) {
return getShort();
} else if (type.equals(short[].class.getName())) {
return getShortArray();
} else if (type.equals(Long.class.getName()) || type.equals(long.class.getName())) {
return getLong();
} else if (type.equals(long[].class.getName())) {
return getLongArray();
} else if (type.equals(Boolean.class.getName()) || type.equals(boolean.class.getName())) {
return getBoolean();
} else if (type.equals(boolean[].class.getName())) {
return getBooleanArray();
} else if (type.equals(String.class.getName())) {
return getString();
} else if (type.equals(String[].class.getName())) {
return getStringArray();
} else if (type.equals(Float.class.getName()) || type.equals(float.class.getName())) {
return getFloat();
} else if (type.equals(float[].class.getName())) {
return getFloatArray();
} else if (type.equals(Double.class.getName()) || type.equals(double.class.getName())) {
return getDouble();
} else if (type.equals(double[].class.getName())) {
return getDoubleArray();
} else if (type.equals(Character.class.getName()) || type.equals(char.class.getName())) {
return getChar();
} else if (type.equals(char[].class.getName())) {
return getCharArray();
} else if (type.equals(ArrayList.class.getName()) || type.equals(List.class.getName())) {
List © 2015 - 2025 Weber Informatics LLC | Privacy Policy