1
mirror of https://github.com/CarmJos/EasyConfiguration.git synced 2026-06-04 18:48:20 +08:00

feat(temp): Add a "temporary source" for Testing/FastDev cases. (Use default config in codes first.)

This commit is contained in:
2025-06-25 07:10:04 +08:00
parent 0eda8d8a0f
commit ad6ab9eb36
6 changed files with 148 additions and 6 deletions
@@ -169,15 +169,16 @@ public abstract class ValueType<T> {
* @return The raw type of the generic type
* @throws IllegalStateException if the type is not a Class or ParameterizedType
*/
public Class<?> getRawType() {
@SuppressWarnings("unchecked")
public Class<T> getRawType() {
if (type instanceof Class<?>) {
return (Class<?>) type;
return (Class<T>) type;
}
if (type instanceof ParameterizedType) {
ParameterizedType pt = (ParameterizedType) type;
Type raw = pt.getRawType();
if (raw instanceof Class<?>) {
return (Class<?>) raw;
return (Class<T>) raw;
}
}
throw new IllegalStateException("Unsupported type: " + type);
@@ -9,7 +9,6 @@ import cc.carm.lib.configuration.source.meta.ConfigurationMetadata;
import cc.carm.lib.configuration.value.ConfigValue;
import cc.carm.lib.configuration.value.ValueManifest;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.NotNullByDefault;
import org.jetbrains.annotations.Nullable;
import java.util.function.BiConsumer;
@@ -17,7 +16,6 @@ import java.util.function.Consumer;
import java.util.function.Predicate;
import java.util.function.Supplier;
@NotNullByDefault
public abstract class AbstractConfigBuilder<
TYPE, UNIT, RESULT extends ConfigValue<TYPE, UNIT>, HOLDER extends ConfigurationHolder<?>,
SELF extends AbstractConfigBuilder<TYPE, UNIT, RESULT, HOLDER, SELF>