private static int getPortRange(Protocol protocol) throws Exception { Field f = protocol.getClass().getDeclaredField("port_range") ; return ((Integer) Util.getField(f,protocol)).intValue(); } }
private static int getPortRange(Protocol protocol) throws Exception { Field f = protocol.getClass().getDeclaredField("port_range") ; return ((Integer) Util.getField(f,protocol)).intValue(); } }
private static int getPortRange(Protocol protocol) throws Exception { Field f = protocol.getClass().getDeclaredField("port_range") ; return ((Integer) Util.getField(f,protocol)).intValue(); } }
protected void applyConfig(Config config) { for(Map.Entry<String,Object> entry: config.values.entrySet()) { Field field=Util.getField(getClass(), entry.getKey()); Util.setField(field, this, entry.getValue()); } }
public static Object getValueFromProtocol(Protocol protocol, String field_name) throws IllegalAccessException { if(protocol == null || field_name == null) return null; Field field=Util.getField(protocol.getClass(), field_name); return field != null? getValueFromProtocol(protocol, field) : null; }
public void set(String field_name, Object value) { Field field=Util.getField(this.getClass(),field_name); if(field == null) System.err.println("Field " + field_name + " not found"); else { Util.setField(field, this, value); System.out.println(field.getName() + "=" + value); } }
private static void setBindAddress(Protocol protocol, InetAddress bind_addr) throws Exception { Field f=Util.getField(protocol.getClass(), "bind_addr"); Util.setField(f, protocol, bind_addr) ; }
public Protocol setValues(Map<String,Object> values) { if(values == null) return this; for(Map.Entry<String,Object> entry: values.entrySet()) { String attrname=entry.getKey(); Object value=entry.getValue(); Field field=Util.getField(getClass(), attrname); if(field != null) { Util.setField(field, this, value); } } return this; }
public Protocol setValues(Map<String,Object> values) { if(values == null) return this; for(Map.Entry<String,Object> entry: values.entrySet()) { String attrname=entry.getKey(); Object value=entry.getValue(); Field field=Util.getField(getClass(), attrname); if(field != null) { Util.setField(field, this, value); } } return this; }
public void set(String field_name, Object value) { Field field=Util.getField(this.getClass(),field_name); if(field == null) System.err.println("Field " + field_name + " not found"); else { Util.setField(field, this, value); System.out.println(field.getName() + "=" + value); } }
/** Copies state from main-channel to this fork-channel */ protected void copyFields() { for(Field field: copied_fields) { Object value=Util.getField(field,main_channel); Util.setField(field, this, value); } }
public static Object getValueFromProtocol(Protocol protocol, String field_name) throws IllegalAccessException { if(protocol == null || field_name == null) return null; Field field=Util.getField(protocol.getClass(), field_name); return field != null? getValueFromProtocol(protocol, field) : null; }
/** Copies state from main-channel to this fork-channel */ protected void copyFields() { for(Field field: copied_fields) { Object value=Util.getField(field,main_channel); Util.setField(field, this, value); } }
public void set(String field_name, Object value) { Field field=Util.getField(this.getClass(),field_name); if(field == null) System.err.println("Field " + field_name + " not found"); else { Util.setField(field, this, value); System.out.println(field.getName() + "=" + value); } }
private static void setBindAddress(Protocol protocol, InetAddress bind_addr) throws Exception { Field f=Util.getField(protocol.getClass(), "bind_addr"); Util.setField(f, protocol, bind_addr) ; }
private static void setBindAddress(Protocol protocol, InetAddress bind_addr) throws Exception { Field f=Util.getField(protocol.getClass(), "bind_addr"); Util.setField(f, protocol, bind_addr) ; }
public Config getConfig() { Config config=new Config(); for(Field field: Util.getAllDeclaredFields(UPerf.class)) { if(field.isAnnotationPresent(Property.class)) { config.add(field.getName(), Util.getField(field, this)); } } return config; }
public Config getConfig() { Config config=new Config(); for(Field field: Util.getAllDeclaredFields(UPerf.class)) { if(field.isAnnotationPresent(Property.class)) { config.add(field.getName(), Util.getField(field, this)); } } return config; }