Version 2.0 of sigIRC rewritten and remastered for Java. Includes "Modules" which can be enabled/disabled to modify functionality of the program.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
sigIRCv2/src/sig/utils/JavaUtils.java

48 lines
1.2 KiB

package sig.utils;
import java.lang.reflect.Field;
public class JavaUtils {
public JavaUtils clone() {
JavaUtils newpos = new JavaUtils();
for (Field f : this.getClass().getDeclaredFields()) {
if (ReflectUtils.isCloneable(f)) {
try {
f.set(newpos, f.get(this));
} catch (IllegalArgumentException e) {
e.printStackTrace();
} catch (IllegalAccessException e) {
e.printStackTrace();
}
}
}
return newpos;
}
public String toString() {
StringBuilder sb = new StringBuilder();
sb.append(this.getClass().getName()+"(");
boolean first=false;
for (Field f : this.getClass().getDeclaredFields()) {
if (!first) {
try {
sb.append(f.getName()+"="+f.get(this));
first=true;
} catch (IllegalArgumentException e) {
e.printStackTrace();
} catch (IllegalAccessException e) {
e.printStackTrace();
}
} else {
try {
sb.append(","+f.getName()+"="+f.get(this));
} catch (IllegalArgumentException e) {
e.printStackTrace();
} catch (IllegalAccessException e) {
e.printStackTrace();
}
}
}
sb.append(")");
return sb.toString();
}
}