Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions src/main/java/module-info.java
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
module org.spongepowered.plugin.metadata {
exports org.spongepowered.plugin.metadata;
exports org.spongepowered.plugin.metadata.builtin;
exports org.spongepowered.plugin.metadata.builtin.model;
exports org.spongepowered.plugin.metadata.model;
exports org.spongepowered.plugin.metadata.util;
exports org.spongepowered.plugin.metadata.builtin;
exports org.spongepowered.plugin.metadata.builtin.adapter;
exports org.spongepowered.plugin.metadata.builtin.adapter.model;
exports org.spongepowered.plugin.metadata.builtin.adapter.version;

requires transitive com.google.gson;
requires static transitive org.checkerframework.checker.qual;
requires static transitive maven.artifact; // Generated module name, may change?
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,13 @@ public final class Constants {
* <li>Must be between 2 and 64 characters in length</li>
* <li>Must start with a lower case letter (a-z)</li>
* <li>May only contain a mix of lower case letters (a-z),
* numbers (0-9), dashes (-), and underscores (_)</li>
* numbers (0-9) and underscores (_)</li>
* </ul>
*/
public static final Pattern VALID_ID_PATTERN = Pattern.compile("^[a-z][a-z0-9-_]{1,63}$");
public static final Pattern VALID_ID_PATTERN = Pattern.compile("^[a-z][a-z0-9_]{1,63}$");

public static final String INVALID_ID_REQUIREMENTS_MESSAGE = "IDs can be between 2 and 64 characters long and must start with a lower case"
+ " letter, followed by any mix of lower case letters (a-z), numbers (0-9), dashes (-) and underscores (_).";
+ " letter, followed by any mix of lower case letters (a-z), numbers (0-9) and underscores (_).";

private Constants() {
}
Expand Down
94 changes: 0 additions & 94 deletions src/main/java/org/spongepowered/plugin/metadata/Container.java

This file was deleted.

93 changes: 0 additions & 93 deletions src/main/java/org/spongepowered/plugin/metadata/Inheritable.java

This file was deleted.

95 changes: 79 additions & 16 deletions src/main/java/org/spongepowered/plugin/metadata/PluginMetadata.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,20 +24,25 @@
*/
package org.spongepowered.plugin.metadata;

import org.apache.maven.artifact.versioning.ArtifactVersion;
import org.spongepowered.plugin.metadata.model.PluginBranding;
import org.spongepowered.plugin.metadata.model.PluginContributor;
import org.spongepowered.plugin.metadata.model.PluginDependency;
import org.spongepowered.plugin.metadata.model.PluginEntrypoints;
import org.spongepowered.plugin.metadata.model.PluginLinks;
import org.spongepowered.plugin.metadata.model.PluginLoaderSpecification;

import java.util.Collection;
import java.util.List;
import java.util.Map;
import java.util.Optional;

/**
* Represents specific, unique metadata to a plugin.
* Represents the metadata of a plugin.
*
* @see Inheritable Inheritable, for metadata that might be shared between multiple plugin metadata
* @see org.spongepowered.plugin.metadata.builtin.StandardPluginMetadata StandardPluginMetadata, for a generic implementation
*/
public interface PluginMetadata extends Inheritable {

/**
* @return The {@link Container container}.
*/
Container container();
public interface PluginMetadata {

/**
* Gets the {@link String id}.
Expand All @@ -48,21 +53,26 @@ public interface PluginMetadata extends Inheritable {
* <li>Must be between 2 and 64 characters in length</li>
* <li>Must start with a lower case letter (a-z)</li>
* <li>May only contain a mix of lower case letters (a-z),
* numbers (0-9), dashes (-), and underscores (_)</li>
* numbers (0-9) and underscores (_)</li>
* </ul>
* @return The id
*/
String id();

/**
* Gets the {@link String entrypoint}.
* <p>
* Consult the vendor for how this field is used. As an example, this could be
* the name of a module or a fully realized path to a discrete class.
*
* @return The entrypoint
* @return The {@link PluginEntrypoints entrypoints}
*/
String entrypoint();
PluginEntrypoints entrypoints();

/**
* @return The {@link ArtifactVersion version}.
*/
ArtifactVersion version();

/**
* @return The {@link PluginLoaderSpecification loader}.
*/
PluginLoaderSpecification loader();

/**
* @return The {@link String name} or {@link Optional#empty()} otherwise.
Expand All @@ -73,4 +83,57 @@ public interface PluginMetadata extends Inheritable {
* @return The {@link String description} or {@link Optional#empty()} otherwise.
*/
Optional<String> description();

/**
* Gets the {@link String license} of the data within this container.
* <p>
* Notable examples include MIT or All Rights Reserved.
*
* @return The license
*/
Optional<String> license();

/**
* @return The {@link PluginBranding branding}.
*/
PluginBranding branding();

/**
* @return The {@link PluginLinks links} to various web resources.
*/
PluginLinks links();

/**
* @return The {@link PluginContributor contributors} as an unmodifiable {@link List}.
*/
List<PluginContributor> contributors();

/**
* Gets the {@link PluginDependency plugin dependency} by {@link String id}.
* <p>
* This maps to {@link PluginDependency#id()}.
* @param id The id
* @return The dependency or {@link Optional#empty()} otherwise.
*/
Optional<PluginDependency> dependency(String id);

/**
* @return The {@link PluginDependency dependencies} as an unmodifiable {@link Collection}.
*/
Collection<PluginDependency> dependencies();

/**
* Gets the {@link T property} by {@link String key}.
*
* @param key The key
* @param <T> The type
* @return The property or {@link Optional#empty()} otherwise.
*/
<T> Optional<T> property(String key);

/**
* @return The properties as an unmodifiable {@link Map}.
*/
Map<String, Object> properties();

}
Loading
Loading