Use saner class naming

This commit is contained in:
Luck 2017-07-16 21:16:08 +01:00
parent b41dea9ee1
commit cadd7545c5
No known key found for this signature in database
GPG Key ID: EFA9B3EC5FD90F8B
18 changed files with 46 additions and 49 deletions

View File

@ -40,7 +40,7 @@ import org.spongepowered.api.text.Text;
import java.util.Map; import java.util.Map;
@RequiredArgsConstructor @RequiredArgsConstructor
public class PermissionDescription6Proxy implements PermissionDescription { public class PermissionDescriptionProxy implements PermissionDescription {
private final LPPermissionService service; private final LPPermissionService service;
private final LPPermissionDescription handle; private final LPPermissionDescription handle;
@ -63,7 +63,7 @@ public class PermissionDescription6Proxy implements PermissionDescription {
public Map<Subject, Boolean> getAssignedSubjects(String s) { public Map<Subject, Boolean> getAssignedSubjects(String s) {
return handle.getAssignedSubjects(s).entrySet().stream() return handle.getAssignedSubjects(s).entrySet().stream()
.collect(ImmutableCollectors.toImmutableMap( .collect(ImmutableCollectors.toImmutableMap(
e -> new Subject6Proxy(service, e.getKey().toReference()), e -> new SubjectProxy(service, e.getKey().toReference()),
Map.Entry::getValue Map.Entry::getValue
)); ));
} }

View File

@ -44,7 +44,7 @@ import java.util.Map;
import java.util.Optional; import java.util.Optional;
@RequiredArgsConstructor @RequiredArgsConstructor
public class PermissionService6Proxy implements PermissionService { public class PermissionServiceProxy implements PermissionService {
private final LPPermissionService handle; private final LPPermissionService handle;
@Override @Override
@ -83,7 +83,7 @@ public class PermissionService6Proxy implements PermissionService {
throw new IllegalArgumentException("Couldn't find a plugin container for " + o.getClass().getSimpleName()); throw new IllegalArgumentException("Couldn't find a plugin container for " + o.getClass().getSimpleName());
} }
return Optional.of(new SimpleDescription6Builder(handle, container.get())); return Optional.of(new SimpleDescriptionBuilder(handle, container.get()));
} }
@Override @Override

View File

@ -48,7 +48,7 @@ import java.util.Map;
@ToString(of = {"container", "roles", "id", "description"}) @ToString(of = {"container", "roles", "id", "description"})
@EqualsAndHashCode(of = {"container", "roles", "id", "description"}) @EqualsAndHashCode(of = {"container", "roles", "id", "description"})
@RequiredArgsConstructor @RequiredArgsConstructor
public final class SimpleDescription6Builder implements PermissionDescription.Builder { public final class SimpleDescriptionBuilder implements PermissionDescription.Builder {
private final LPPermissionService service; private final LPPermissionService service;
private final PluginContainer container; private final PluginContainer container;
private final Map<String, Tristate> roles = new HashMap<>(); private final Map<String, Tristate> roles = new HashMap<>();

View File

@ -43,7 +43,7 @@ import java.util.Set;
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
@RequiredArgsConstructor @RequiredArgsConstructor
public class SubjectCollection6Proxy implements SubjectCollection { public class SubjectCollectionProxy implements SubjectCollection {
private final LPPermissionService service; private final LPPermissionService service;
private final LPSubjectCollection handle; private final LPSubjectCollection handle;
@ -71,7 +71,7 @@ public class SubjectCollection6Proxy implements SubjectCollection {
// this behaviour should be replaced when CompletableFutures are added to Sponge // this behaviour should be replaced when CompletableFutures are added to Sponge
return (List) handle.getAllIdentifiers() return (List) handle.getAllIdentifiers()
.thenApply(ids -> ids.stream() .thenApply(ids -> ids.stream()
.map(s -> new Subject6Proxy(service, service.newSubjectReference(getIdentifier(), s))) .map(s -> new SubjectProxy(service, service.newSubjectReference(getIdentifier(), s)))
.collect(ImmutableCollectors.toImmutableList()) .collect(ImmutableCollectors.toImmutableList())
).join(); ).join();
} }
@ -82,7 +82,7 @@ public class SubjectCollection6Proxy implements SubjectCollection {
return (Map) handle.getAllWithPermission(s).thenApply(map -> { return (Map) handle.getAllWithPermission(s).thenApply(map -> {
return map.entrySet().stream() return map.entrySet().stream()
.collect(ImmutableCollectors.toImmutableMap( .collect(ImmutableCollectors.toImmutableMap(
e -> new Subject6Proxy(service, e.getKey()), e -> new SubjectProxy(service, e.getKey()),
Map.Entry::getValue Map.Entry::getValue
)); ));
}).join(); }).join();
@ -93,7 +93,7 @@ public class SubjectCollection6Proxy implements SubjectCollection {
return (Map) handle.getAllWithPermission(CompatibilityUtil.convertContexts(set), s) return (Map) handle.getAllWithPermission(CompatibilityUtil.convertContexts(set), s)
.thenApply(map -> map.entrySet().stream() .thenApply(map -> map.entrySet().stream()
.collect(ImmutableCollectors.toImmutableMap( .collect(ImmutableCollectors.toImmutableMap(
e -> new Subject6Proxy(service, e.getKey()), e -> new SubjectProxy(service, e.getKey()),
Map.Entry::getValue Map.Entry::getValue
)) ))
).join(); ).join();

View File

@ -44,12 +44,9 @@ import java.util.Map;
import java.util.Set; import java.util.Set;
import java.util.concurrent.CompletableFuture; import java.util.concurrent.CompletableFuture;
/**
* Proxies a LuckPerms Subject to implement {@link SubjectData}.
*/
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
@RequiredArgsConstructor @RequiredArgsConstructor
public class SubjectData6Proxy implements SubjectData { public class SubjectDataProxy implements SubjectData {
private final LPPermissionService service; private final LPPermissionService service;
private final SubjectReference ref; private final SubjectReference ref;
private final boolean enduring; private final boolean enduring;
@ -105,7 +102,7 @@ public class SubjectData6Proxy implements SubjectData {
.collect(ImmutableCollectors.toImmutableMap( .collect(ImmutableCollectors.toImmutableMap(
e -> CompatibilityUtil.convertContexts(e.getKey()), e -> CompatibilityUtil.convertContexts(e.getKey()),
e -> e.getValue().stream() e -> e.getValue().stream()
.map(s -> new Subject6Proxy(service, s)) .map(s -> new SubjectProxy(service, s))
.collect(ImmutableCollectors.toImmutableList()) .collect(ImmutableCollectors.toImmutableList())
) )
); );
@ -116,7 +113,7 @@ public class SubjectData6Proxy implements SubjectData {
public List<Subject> getParents(Set<Context> contexts) { public List<Subject> getParents(Set<Context> contexts) {
return (List) getHandle().thenApply(handle -> { return (List) getHandle().thenApply(handle -> {
return handle.getParents(CompatibilityUtil.convertContexts(contexts)).stream() return handle.getParents(CompatibilityUtil.convertContexts(contexts)).stream()
.map(s -> new Subject6Proxy(service, s)) .map(s -> new SubjectProxy(service, s))
.collect(ImmutableCollectors.toImmutableList()); .collect(ImmutableCollectors.toImmutableList());
}).join(); }).join();
} }

View File

@ -48,7 +48,7 @@ import java.util.concurrent.CompletableFuture;
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
@RequiredArgsConstructor @RequiredArgsConstructor
public class Subject6Proxy implements Subject { public class SubjectProxy implements Subject {
private final LPPermissionService service; private final LPPermissionService service;
private final SubjectReference ref; private final SubjectReference ref;
@ -68,12 +68,12 @@ public class Subject6Proxy implements Subject {
@Override @Override
public SubjectData getSubjectData() { public SubjectData getSubjectData() {
return new SubjectData6Proxy(service, ref, true); return new SubjectDataProxy(service, ref, true);
} }
@Override @Override
public SubjectData getTransientSubjectData() { public SubjectData getTransientSubjectData() {
return new SubjectData6Proxy(service, ref, false); return new SubjectDataProxy(service, ref, false);
} }
@Override @Override
@ -127,7 +127,7 @@ public class Subject6Proxy implements Subject {
public List<Subject> getParents() { public List<Subject> getParents() {
return (List) getHandle().thenApply(handle -> { return (List) getHandle().thenApply(handle -> {
return handle.getParents(ImmutableContextSet.empty()).stream() return handle.getParents(ImmutableContextSet.empty()).stream()
.map(s -> new Subject6Proxy(service, s)) .map(s -> new SubjectProxy(service, s))
.collect(ImmutableCollectors.toImmutableList()); .collect(ImmutableCollectors.toImmutableList());
}).join(); }).join();
} }
@ -136,7 +136,7 @@ public class Subject6Proxy implements Subject {
public List<Subject> getParents(Set<Context> contexts) { public List<Subject> getParents(Set<Context> contexts) {
return (List) getHandle().thenApply(handle -> { return (List) getHandle().thenApply(handle -> {
return handle.getParents(CompatibilityUtil.convertContexts(contexts)).stream() return handle.getParents(CompatibilityUtil.convertContexts(contexts)).stream()
.map(s -> new Subject6Proxy(service, s)) .map(s -> new SubjectProxy(service, s))
.collect(ImmutableCollectors.toImmutableList()); .collect(ImmutableCollectors.toImmutableList());
}).join(); }).join();
} }

View File

@ -42,7 +42,7 @@ import java.util.Optional;
import java.util.concurrent.CompletableFuture; import java.util.concurrent.CompletableFuture;
@RequiredArgsConstructor @RequiredArgsConstructor
public class PermissionDescription7Proxy implements PermissionDescription { public class PermissionDescriptionProxy implements PermissionDescription {
private final LPPermissionService service; private final LPPermissionService service;
private final LPPermissionDescription handle; private final LPPermissionDescription handle;
@ -65,7 +65,7 @@ public class PermissionDescription7Proxy implements PermissionDescription {
public Map<Subject, Boolean> getAssignedSubjects(String s) { public Map<Subject, Boolean> getAssignedSubjects(String s) {
return handle.getAssignedSubjects(s).entrySet().stream() return handle.getAssignedSubjects(s).entrySet().stream()
.collect(ImmutableCollectors.toImmutableMap( .collect(ImmutableCollectors.toImmutableMap(
e -> new Subject7Proxy(service, e.getKey().toReference()), e -> new SubjectProxy(service, e.getKey().toReference()),
Map.Entry::getValue Map.Entry::getValue
)); ));
} }

View File

@ -51,7 +51,7 @@ import java.util.concurrent.CompletableFuture;
import java.util.function.Predicate; import java.util.function.Predicate;
@RequiredArgsConstructor @RequiredArgsConstructor
public class PermissionService7Proxy implements PermissionService { public class PermissionServiceProxy implements PermissionService {
private final LPPermissionService handle; private final LPPermissionService handle;
@Override @Override
@ -115,7 +115,7 @@ public class PermissionService7Proxy implements PermissionService {
throw new IllegalArgumentException("Couldn't find a plugin container for " + o.getClass().getSimpleName()); throw new IllegalArgumentException("Couldn't find a plugin container for " + o.getClass().getSimpleName());
} }
return new SimpleDescription7Builder(handle, container.get()); return new SimpleDescriptionBuilder(handle, container.get());
} }
@Override @Override

View File

@ -48,7 +48,7 @@ import java.util.Map;
@ToString(of = {"container", "roles", "id", "description"}) @ToString(of = {"container", "roles", "id", "description"})
@EqualsAndHashCode(of = {"container", "roles", "id", "description"}) @EqualsAndHashCode(of = {"container", "roles", "id", "description"})
@RequiredArgsConstructor @RequiredArgsConstructor
public final class SimpleDescription7Builder implements PermissionDescription.Builder { public final class SimpleDescriptionBuilder implements PermissionDescription.Builder {
private final LPPermissionService service; private final LPPermissionService service;
private final PluginContainer container; private final PluginContainer container;
private final Map<String, Tristate> roles = new HashMap<>(); private final Map<String, Tristate> roles = new HashMap<>();

View File

@ -46,7 +46,7 @@ import java.util.function.Predicate;
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
@RequiredArgsConstructor @RequiredArgsConstructor
public class SubjectCollection7Proxy implements SubjectCollection { public class SubjectCollectionProxy implements SubjectCollection {
private final LPSubjectCollection handle; private final LPSubjectCollection handle;
@Override @Override

View File

@ -45,12 +45,9 @@ import java.util.concurrent.CompletableFuture;
import javax.annotation.Nullable; import javax.annotation.Nullable;
/**
* Proxies a LuckPerms Subject to implement {@link SubjectData}.
*/
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
@RequiredArgsConstructor @RequiredArgsConstructor
public class SubjectData7Proxy implements SubjectData { public class SubjectDataProxy implements SubjectData {
private final LPPermissionService service; private final LPPermissionService service;
private final SubjectReference ref; private final SubjectReference ref;
private final boolean enduring; private final boolean enduring;

View File

@ -47,7 +47,7 @@ import java.util.concurrent.CompletableFuture;
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
@RequiredArgsConstructor @RequiredArgsConstructor
public class Subject7Proxy implements Subject { public class SubjectProxy implements Subject {
private final LPPermissionService service; private final LPPermissionService service;
private final SubjectReference ref; private final SubjectReference ref;
@ -77,12 +77,12 @@ public class Subject7Proxy implements Subject {
@Override @Override
public SubjectData getSubjectData() { public SubjectData getSubjectData() {
return new SubjectData7Proxy(service, ref, true); return new SubjectDataProxy(service, ref, true);
} }
@Override @Override
public SubjectData getTransientSubjectData() { public SubjectData getTransientSubjectData() {
return new SubjectData7Proxy(service, ref, false); return new SubjectDataProxy(service, ref, false);
} }
@Override @Override

View File

@ -33,6 +33,9 @@ import java.util.Map;
import java.util.Optional; import java.util.Optional;
import java.util.concurrent.CompletableFuture; import java.util.concurrent.CompletableFuture;
/**
* LuckPerms model for the Sponge {@link PermissionDescription}
*/
public interface LPPermissionDescription { public interface LPPermissionDescription {
PermissionDescription sponge(); PermissionDescription sponge();

View File

@ -44,7 +44,7 @@ import java.util.Optional;
import java.util.function.Predicate; import java.util.function.Predicate;
/** /**
* LuckPerms model for the Sponge PermissionService * LuckPerms model for the Sponge {@link PermissionService}
*/ */
public interface LPPermissionService { public interface LPPermissionService {

View File

@ -36,7 +36,7 @@ import org.spongepowered.api.service.permission.Subject;
import java.util.Optional; import java.util.Optional;
/** /**
* LuckPerms model for the Sponge Subject * LuckPerms model for the Sponge {@link Subject}
*/ */
public interface LPSubject { public interface LPSubject {

View File

@ -39,7 +39,7 @@ import java.util.concurrent.CompletableFuture;
import java.util.function.Predicate; import java.util.function.Predicate;
/** /**
* LuckPerms model for the Sponge SubjectCollection * LuckPerms model for the Sponge {@link SubjectCollection}
*/ */
public interface LPSubjectCollection { public interface LPSubjectCollection {

View File

@ -34,7 +34,7 @@ import me.lucko.luckperms.api.context.ImmutableContextSet;
import java.util.concurrent.CompletableFuture; import java.util.concurrent.CompletableFuture;
/** /**
* LuckPerms model for the Sponge SubjectData * LuckPerms model for the Sponge {@link org.spongepowered.api.service.permission.SubjectData}
*/ */
public interface LPSubjectData { public interface LPSubjectData {

View File

@ -31,14 +31,6 @@ import me.lucko.luckperms.sponge.service.model.LPPermissionDescription;
import me.lucko.luckperms.sponge.service.model.LPPermissionService; import me.lucko.luckperms.sponge.service.model.LPPermissionService;
import me.lucko.luckperms.sponge.service.model.LPSubject; import me.lucko.luckperms.sponge.service.model.LPSubject;
import me.lucko.luckperms.sponge.service.model.LPSubjectCollection; import me.lucko.luckperms.sponge.service.model.LPSubjectCollection;
import me.lucko.luckperms.sponge.service.proxy.api6.PermissionDescription6Proxy;
import me.lucko.luckperms.sponge.service.proxy.api6.PermissionService6Proxy;
import me.lucko.luckperms.sponge.service.proxy.api6.Subject6Proxy;
import me.lucko.luckperms.sponge.service.proxy.api6.SubjectCollection6Proxy;
import me.lucko.luckperms.sponge.service.proxy.api7.PermissionDescription7Proxy;
import me.lucko.luckperms.sponge.service.proxy.api7.PermissionService7Proxy;
import me.lucko.luckperms.sponge.service.proxy.api7.Subject7Proxy;
import me.lucko.luckperms.sponge.service.proxy.api7.SubjectCollection7Proxy;
import org.spongepowered.api.service.permission.PermissionDescription; import org.spongepowered.api.service.permission.PermissionDescription;
import org.spongepowered.api.service.permission.PermissionService; import org.spongepowered.api.service.permission.PermissionService;
@ -61,19 +53,27 @@ public class ProxyFactory {
} }
public static PermissionService toSponge(LPPermissionService luckPerms) { public static PermissionService toSponge(LPPermissionService luckPerms) {
return IS_API_7 ? new PermissionService7Proxy(luckPerms) : new PermissionService6Proxy(luckPerms); return IS_API_7 ?
new me.lucko.luckperms.sponge.service.proxy.api7.PermissionServiceProxy(luckPerms) :
new me.lucko.luckperms.sponge.service.proxy.api6.PermissionServiceProxy(luckPerms);
} }
public static SubjectCollection toSponge(LPSubjectCollection luckPerms) { public static SubjectCollection toSponge(LPSubjectCollection luckPerms) {
return IS_API_7 ? new SubjectCollection7Proxy(luckPerms) : new SubjectCollection6Proxy(luckPerms.getService(), luckPerms); return IS_API_7 ?
new me.lucko.luckperms.sponge.service.proxy.api7.SubjectCollectionProxy(luckPerms) :
new me.lucko.luckperms.sponge.service.proxy.api6.SubjectCollectionProxy(luckPerms.getService(), luckPerms);
} }
public static Subject toSponge(LPSubject luckPerms) { public static Subject toSponge(LPSubject luckPerms) {
return IS_API_7 ? new Subject7Proxy(luckPerms.getService(), luckPerms.toReference()) : new Subject6Proxy(luckPerms.getService(), luckPerms.toReference()); return IS_API_7 ?
new me.lucko.luckperms.sponge.service.proxy.api7.SubjectProxy(luckPerms.getService(), luckPerms.toReference()) :
new me.lucko.luckperms.sponge.service.proxy.api6.SubjectProxy(luckPerms.getService(), luckPerms.toReference());
} }
public static PermissionDescription toSponge(LPPermissionDescription luckPerms) { public static PermissionDescription toSponge(LPPermissionDescription luckPerms) {
return IS_API_7 ? new PermissionDescription7Proxy(luckPerms.getService(), luckPerms) : new PermissionDescription6Proxy(luckPerms.getService(), luckPerms); return IS_API_7 ?
new me.lucko.luckperms.sponge.service.proxy.api7.PermissionDescriptionProxy(luckPerms.getService(), luckPerms) :
new me.lucko.luckperms.sponge.service.proxy.api6.PermissionDescriptionProxy(luckPerms.getService(), luckPerms);
} }
} }