-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 90947ab
Showing
56 changed files
with
7,136 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
### IntelliJ IDEA ### | ||
out/ | ||
!**/src/main/**/out/ | ||
!**/src/test/**/out/ | ||
|
||
### Eclipse ### | ||
.apt_generated | ||
.classpath | ||
.factorypath | ||
.project | ||
.settings | ||
.springBeans | ||
.sts4-cache | ||
bin/ | ||
!**/src/main/**/bin/ | ||
!**/src/test/**/bin/ | ||
|
||
### NetBeans ### | ||
/nbproject/private/ | ||
/nbbuild/ | ||
/dist/ | ||
/nbdist/ | ||
/.nb-gradle/ | ||
|
||
### VS Code ### | ||
.vscode/ | ||
|
||
### Mac OS ### | ||
.DS_Store |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<module type="JAVA_MODULE" version="4"> | ||
<component name="NewModuleRootManager" inherit-compiler-output="true"> | ||
<exclude-output /> | ||
<content url="file://$MODULE_DIR$"> | ||
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" /> | ||
</content> | ||
<orderEntry type="inheritedJdk" /> | ||
<orderEntry type="sourceFolder" forTests="false" /> | ||
<orderEntry type="library" name="libs" level="project" /> | ||
</component> | ||
</module> |
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
Class-Path: guava-17.0.jar config-1.3.1.jar checker-3.1.0.jar fastutil-8 | ||
.3.0.jar annotations-18.0.0.jar | ||
Implementation-Title: Configurate | ||
Implementation-Version: 0.1 | ||
Implementation-Vendor: cn.c9 | ||
Specification-Title: Configurate API | ||
Specification-Version: 0.1 | ||
Specification-Vendor: cn.c9 | ||
Build-Date: 2024-01-30 | ||
Created-By: 1.8.0_291 (Oracle Corporation) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,116 @@ | ||
/* | ||
* Configurate | ||
* Copyright (C) zml and Configurate contributors | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package ninja.leaping.configurate; | ||
|
||
import org.checkerframework.checker.nullness.qual.NonNull; | ||
import org.checkerframework.checker.nullness.qual.Nullable; | ||
|
||
import java.util.Iterator; | ||
|
||
/** | ||
* The value in a {@link ConfigurationNode}. | ||
*/ | ||
abstract class ConfigValue { | ||
|
||
/** | ||
* The node this value "belongs" to. | ||
*/ | ||
@NonNull | ||
protected final SimpleConfigurationNode holder; | ||
|
||
protected ConfigValue(@NonNull SimpleConfigurationNode holder) { | ||
this.holder = holder; | ||
} | ||
|
||
abstract ValueType getType(); | ||
|
||
/** | ||
* Gets the value encapsulated by this instance | ||
* | ||
* @return The value | ||
*/ | ||
@Nullable | ||
abstract Object getValue(); | ||
|
||
/** | ||
* Sets the value encapsulated by this instance | ||
* | ||
* @param value The value | ||
*/ | ||
abstract void setValue(@Nullable Object value); | ||
|
||
/** | ||
* Put a child value, or null to remove value at that key | ||
* | ||
* @param key The key | ||
* @param value The node to put at key | ||
* @return Existing node at key, if present | ||
*/ | ||
@Nullable | ||
abstract SimpleConfigurationNode putChild(@NonNull Object key, @Nullable SimpleConfigurationNode value); | ||
|
||
/** | ||
* Put a child value, if one isn't already present at that key | ||
* | ||
* @param key The key | ||
* @param value The node to put at key | ||
* @return Existing node at key, if present | ||
*/ | ||
@Nullable | ||
abstract SimpleConfigurationNode putChildIfAbsent(@NonNull Object key, @Nullable SimpleConfigurationNode value); | ||
|
||
/** | ||
* Gets the currently present child for the given key. Returns null if no child is present | ||
* | ||
* @param key The key to get child at | ||
* @return The child if any | ||
*/ | ||
@Nullable | ||
abstract SimpleConfigurationNode getChild(@Nullable Object key); | ||
|
||
/** | ||
* Returns an iterable over all child nodes | ||
* | ||
* @return An iterator | ||
*/ | ||
@NonNull | ||
abstract Iterable<SimpleConfigurationNode> iterateChildren(); | ||
|
||
/** | ||
* Creates a copy of this node | ||
* | ||
* @return A copy | ||
*/ | ||
@NonNull | ||
abstract ConfigValue copy(@NonNull SimpleConfigurationNode holder); | ||
|
||
/** | ||
* Clears the set value (or any attached child values) from this value | ||
*/ | ||
void clear() { | ||
for (Iterator<SimpleConfigurationNode> it = iterateChildren().iterator(); it.hasNext(); ) { | ||
SimpleConfigurationNode node = it.next(); | ||
node.attached = false; | ||
it.remove(); | ||
if (node.getParentEnsureAttached().equals(holder)) { | ||
node.clear(); | ||
} | ||
} | ||
} | ||
|
||
} |
Oops, something went wrong.