@Override protected ChannelLoudness valueOf(Map.Entry<String, String>[] attributes) throws InvalidValueException { Channel channel = null; Boolean loudness = null; for (Map.Entry<String, String> attribute : attributes) { if (attribute.getKey().equals("channel")) channel = Channel.valueOf(attribute.getValue()); if (attribute.getKey().equals("val")) loudness = new BooleanDatatype().valueOf(attribute.getValue()); } return channel != null && loudness != null ? new ChannelLoudness(channel, loudness) : null; }
@Override public Map.Entry<String, String>[] getAttributes() { return new Map.Entry[]{ new AbstractMap.SimpleEntry<>( "val", new BooleanDatatype().getString(getValue().getMute()) ), new AbstractMap.SimpleEntry<>( "channel", getValue().getChannel().name() ) }; }
@Override protected ChannelMute valueOf(Map.Entry<String, String>[] attributes) throws InvalidValueException { Channel channel = null; Boolean mute = null; for (Map.Entry<String, String> attribute : attributes) { if (attribute.getKey().equals("channel")) channel = Channel.valueOf(attribute.getValue()); if (attribute.getKey().equals("val")) mute = new BooleanDatatype().valueOf(attribute.getValue()); } return channel != null && mute != null ? new ChannelMute(channel, mute) : null; }
@Override public Map.Entry<String, String>[] getAttributes() { return new Map.Entry[]{ new AbstractMap.SimpleEntry<>( "val", new BooleanDatatype().getString(getValue().getLoudness()) ), new AbstractMap.SimpleEntry<>( "channel", getValue().getChannel().name() ) }; }
@Override protected ChannelLoudness valueOf(Map.Entry<String, String>[] attributes) throws InvalidValueException { Channel channel = null; Boolean loudness = null; for (Map.Entry<String, String> attribute : attributes) { if (attribute.getKey().equals("channel")) channel = Channel.valueOf(attribute.getValue()); if (attribute.getKey().equals("val")) loudness = new BooleanDatatype().valueOf(attribute.getValue()); } return channel != null && loudness != null ? new ChannelLoudness(channel, loudness) : null; }
@Override public Map.Entry<String, String>[] getAttributes() { return new Map.Entry[]{ new AbstractMap.SimpleEntry<String, String>( "val", new BooleanDatatype().getString(getValue().getLoudness()) ), new AbstractMap.SimpleEntry<String, String>( "channel", getValue().getChannel().name() ) }; }
@Override protected ChannelMute valueOf(Map.Entry<String, String>[] attributes) throws InvalidValueException { Channel channel = null; Boolean mute = null; for (Map.Entry<String, String> attribute : attributes) { if (attribute.getKey().equals("channel")) channel = Channel.valueOf(attribute.getValue()); if (attribute.getKey().equals("val")) mute = new BooleanDatatype().valueOf(attribute.getValue()); } return channel != null && mute != null ? new ChannelMute(channel, mute) : null; }
@Override public Map.Entry<String, String>[] getAttributes() { return new Map.Entry[]{ new AbstractMap.SimpleEntry<String, String>( "val", new BooleanDatatype().getString(getValue().getMute()) ), new AbstractMap.SimpleEntry<String, String>( "channel", getValue().getChannel().name() ) }; }
@Override protected ChannelLoudness valueOf(Map.Entry<String, String>[] attributes) throws InvalidValueException { Channel channel = null; Boolean loudness = null; for (Map.Entry<String, String> attribute : attributes) { if (attribute.getKey().equals("channel")) channel = Channel.valueOf(attribute.getValue()); if (attribute.getKey().equals("val")) loudness = new BooleanDatatype().valueOf(attribute.getValue()); } return channel != null && loudness != null ? new ChannelLoudness(channel, loudness) : null; }
@Override public Map.Entry<String, String>[] getAttributes() { return new Map.Entry[]{ new AbstractMap.SimpleEntry<>( "val", new BooleanDatatype().getString(getValue().getMute()) ), new AbstractMap.SimpleEntry<>( "channel", getValue().getChannel().name() ) }; }
@Override protected ChannelMute valueOf(Map.Entry<String, String>[] attributes) throws InvalidValueException { Channel channel = null; Boolean mute = null; for (Map.Entry<String, String> attribute : attributes) { if (attribute.getKey().equals("channel")) channel = Channel.valueOf(attribute.getValue()); if (attribute.getKey().equals("val")) mute = new BooleanDatatype().valueOf(attribute.getValue()); } return channel != null && mute != null ? new ChannelMute(channel, mute) : null; }
@Override public Map.Entry<String, String>[] getAttributes() { return new Map.Entry[]{ new AbstractMap.SimpleEntry<>( "val", new BooleanDatatype().getString(getValue().getLoudness()) ), new AbstractMap.SimpleEntry<>( "channel", getValue().getChannel().name() ) }; }
private static Object parseToRealValue(Class<?> classType, Object value) throws InstantiationException, IllegalAccessException, IllegalArgumentException, InvocationTargetException, NoSuchMethodException { String type = classType.toString(); if (FieldType.BYTE.equals(type)) { return Byte.parseByte(value.toString()); } else if (FieldType.SHORT.equals(type)) { return Short.parseShort(value.toString()); } else if (FieldType.INT.equals(type)) { return Integer.parseInt(value.toString()); } else if (FieldType.LONG.equals(type)) { return Long.parseLong(value.toString()); } else if (FieldType.FLOAT.equals(type)) { return Float.parseFloat(value.toString()); } else if (FieldType.DOUBLE.equals(type)) { return Double.parseDouble(value.toString()); } else if (FieldType.BOOLEAN.equals(type)) { return new BooleanDatatype().valueOf(value.toString()); } else if (FieldType.CHAR.equals(type)) { return (Character) value; } else { Constructor<?> constructor = classType.getDeclaredConstructor(String.class); return constructor.newInstance(value.toString()); } }