Rename package name from org.zhdev to net.zhira
This commit is contained in:
parent
cc7f16f941
commit
6ab7e89561
61 changed files with 314 additions and 192 deletions
|
|
@ -1,9 +1,12 @@
|
|||
<project>
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<parent>
|
||||
<artifactId>parent</artifactId>
|
||||
<groupId>org.zhdev.varioutil</groupId>
|
||||
<groupId>net.zhira.varioutil</groupId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
</parent>
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
package org.zhdev.varioutil;
|
||||
package net.zhira.varioutil;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
package org.zhdev.varioutil.language;
|
||||
package net.zhira.varioutil.language;
|
||||
|
||||
import org.zhdev.varioutil.util.StringUtils;
|
||||
import net.zhira.varioutil.util.StringUtils;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedHashMap;
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
package org.zhdev.varioutil.reflection;
|
||||
package net.zhira.varioutil.reflection;
|
||||
|
||||
import org.zhdev.varioutil.util.ReflectionUtils;
|
||||
import net.zhira.varioutil.util.ReflectionUtils;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
|
||||
|
|
@ -74,7 +74,7 @@ public class FieldSearcher {
|
|||
}
|
||||
|
||||
public Object get() {
|
||||
return ReflectionUtils.getFieldValue(search(), instance);
|
||||
return ReflectionUtils.getFieldValue(instance, search());
|
||||
}
|
||||
|
||||
public <T> T get(Class<T> type) {
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
package org.zhdev.varioutil.reflection;
|
||||
package net.zhira.varioutil.reflection;
|
||||
|
||||
import org.zhdev.varioutil.util.ReflectionUtils;
|
||||
import net.zhira.varioutil.util.ReflectionUtils;
|
||||
|
||||
import java.lang.reflect.Method;
|
||||
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package org.zhdev.varioutil.util;
|
||||
package net.zhira.varioutil.util;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.function.Function;
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package org.zhdev.varioutil.util;
|
||||
package net.zhira.varioutil.util;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package org.zhdev.varioutil.util;
|
||||
package net.zhira.varioutil.util;
|
||||
|
||||
import java.time.*;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package org.zhdev.varioutil.util;
|
||||
package net.zhira.varioutil.util;
|
||||
|
||||
public class EnumUtils {
|
||||
private static <T extends Enum<T>> T[] getValues(T eNum) {
|
||||
|
|
@ -1,7 +1,7 @@
|
|||
package org.zhdev.varioutil.util;
|
||||
package net.zhira.varioutil.util;
|
||||
|
||||
import org.zhdev.varioutil.reflection.FieldSearcher;
|
||||
import org.zhdev.varioutil.reflection.MethodSearcher;
|
||||
import net.zhira.varioutil.reflection.FieldSearcher;
|
||||
import net.zhira.varioutil.reflection.MethodSearcher;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
|
@ -61,7 +61,8 @@ public class ReflectionUtils {
|
|||
for (String typeName : typeNames) {
|
||||
try {
|
||||
return Class.forName(typeName);
|
||||
} catch (ClassNotFoundException ignored) {}
|
||||
} catch (ClassNotFoundException ignored) {
|
||||
}
|
||||
}
|
||||
|
||||
throw new NoClassDefFoundError(String.join(", ", typeNames));
|
||||
|
|
@ -81,11 +82,12 @@ public class ReflectionUtils {
|
|||
for (String typeName : typeNames) {
|
||||
try {
|
||||
return Class.forName(packageName + '.' + typeName);
|
||||
} catch (ClassNotFoundException ignored) {}
|
||||
} catch (ClassNotFoundException ignored) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
throw new NoClassDefFoundError(String.join(", ", typeNames) + " in " + String.join(", ", packageNames));
|
||||
throw new NoClassDefFoundError(String.join(", ", typeNames) + " in " + String.join(", ", packageNames));
|
||||
}
|
||||
|
||||
public static Method getMethod(Class<?> type, String methodName, Class<?>... parameterTypes) throws NoSuchMethodError {
|
||||
|
|
@ -103,7 +105,8 @@ public class ReflectionUtils {
|
|||
return checkMethodType(getMethod0(type, methodName, parameterTypes), returnType);
|
||||
} catch (IllegalStateException e) {
|
||||
exception = e;
|
||||
} catch (NoSuchMethodException ignored) { }
|
||||
} catch (NoSuchMethodException ignored) {
|
||||
}
|
||||
}
|
||||
|
||||
if (parameterTypes.length > 0) {
|
||||
|
|
@ -144,7 +147,8 @@ public class ReflectionUtils {
|
|||
return checkFieldType(getField0(type, fieldName), fieldType);
|
||||
} catch (IllegalStateException e) {
|
||||
exception = e;
|
||||
} catch (NoSuchFieldException ignored) {}
|
||||
} catch (NoSuchFieldException ignored) {
|
||||
}
|
||||
}
|
||||
|
||||
if (exception != null) {
|
||||
|
|
@ -154,7 +158,7 @@ public class ReflectionUtils {
|
|||
throw new NoSuchFieldError(String.join(", ", fieldNames) + " in " + type);
|
||||
}
|
||||
|
||||
public static Object getFieldValue(Field field, Object instance) throws IllegalStateException {
|
||||
public static Object getFieldValue(Object instance, Field field) throws IllegalStateException {
|
||||
try {
|
||||
return field.get(instance);
|
||||
} catch (IllegalAccessException e) {
|
||||
|
|
@ -162,7 +166,7 @@ public class ReflectionUtils {
|
|||
}
|
||||
}
|
||||
|
||||
public static void setFieldValue(Field field, Object instance, Object value) throws IllegalStateException {
|
||||
public static void setFieldValue(Object instance, Field field, Object value) throws IllegalStateException {
|
||||
try {
|
||||
field.set(instance, value);
|
||||
} catch (IllegalAccessException e) {
|
||||
|
|
@ -186,7 +190,8 @@ public class ReflectionUtils {
|
|||
if (packagePath.equals(packageName)) {
|
||||
try {
|
||||
consumer.accept(loader.loadClass(link));
|
||||
} catch (ClassNotFoundException ignored) {}
|
||||
} catch (ClassNotFoundException ignored) {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package org.zhdev.varioutil.util;
|
||||
package net.zhira.varioutil.util;
|
||||
|
||||
import java.io.*;
|
||||
import java.net.URL;
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
package org.zhdev.varioutil.util;
|
||||
package net.zhira.varioutil.util;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
Loading…
Add table
Add a link
Reference in a new issue