Further improve upon Madus work with automatic editor.

This commit is contained in:
Olof Larsson 2016-04-14 13:02:06 +02:00
parent 1b73f9bea0
commit 712a1ab0f4
No known key found for this signature in database
GPG Key ID: BBEF14F97DA52474
18 changed files with 261 additions and 153 deletions

View File

@ -231,7 +231,7 @@ public class MassiveCore extends MassivePlugin
IntegrationVault.get() IntegrationVault.get()
); );
// Some commands rely on the MConf being present. // NOTE: Some commands rely on the MConf being loaded at construction.
this.activate( this.activate(
// Command // Command
CmdMassiveCore.get(), CmdMassiveCore.get(),

View File

@ -6,7 +6,7 @@ import java.util.Map;
import org.bukkit.permissions.Permissible; import org.bukkit.permissions.Permissible;
import com.massivecraft.massivecore.command.editor.EditorField; import com.massivecraft.massivecore.command.editor.annotation.EditorType;
import com.massivecraft.massivecore.store.Entity; import com.massivecraft.massivecore.store.Entity;
import com.massivecraft.massivecore.util.MUtil; import com.massivecraft.massivecore.util.MUtil;
import com.massivecraft.massivecore.util.PermUtil; import com.massivecraft.massivecore.util.PermUtil;
@ -113,7 +113,7 @@ public class MassiveCoreMConf extends Entity<MassiveCoreMConf>
public volatile long millisBetweenRemotePollWithoutPusher = TimeUnit.MILLIS_PER_SECOND * 10; public volatile long millisBetweenRemotePollWithoutPusher = TimeUnit.MILLIS_PER_SECOND * 10;
public volatile long millisBetweenRemotePollWithPusher = TimeUnit.MILLIS_PER_MINUTE * 1; public volatile long millisBetweenRemotePollWithPusher = TimeUnit.MILLIS_PER_MINUTE * 1;
@EditorField(singletonName = "iOn") @EditorType(fieldName = "iOn")
public boolean warnOnLocalAlter = false; public boolean warnOnLocalAlter = false;
} }

View File

@ -10,42 +10,42 @@ public enum MassiveCorePerm
// ENUM // ENUM
// -------------------------------------------- // // -------------------------------------------- //
BASECOMMAND("basecommand"), BASECOMMAND,
TEST("test"), TEST,
ID("id"), ID,
VERSION("version"), VERSION,
HEARSOUND("hearsound"), HEARSOUND,
STORE("store"), STORE,
STORE_STATS("store.stats"), STORE_STATS,
STORE_LISTCOLLS("store.listcolls"), STORE_LISTCOLLS,
STORE_COPYDB("store.copydb"), STORE_COPYDB,
USYS("usys"), USYS,
USYS_MULTIVERSE("usys.multiverse"), USYS_MULTIVERSE,
USYS_MULTIVERSE_LIST("usys.multiverse.list"), USYS_MULTIVERSE_LIST,
USYS_MULTIVERSE_SHOW("usys.multiverse.show"), USYS_MULTIVERSE_SHOW,
USYS_MULTIVERSE_NEW("usys.multiverse.new"), USYS_MULTIVERSE_NEW,
USYS_MULTIVERSE_DEL("usys.multiverse.del"), USYS_MULTIVERSE_DEL,
USYS_UNIVERSE("usys.universe"), USYS_UNIVERSE,
USYS_UNIVERSE_NEW("usys.universe.new"), USYS_UNIVERSE_NEW,
USYS_UNIVERSE_DEL("usys.universe.del"), USYS_UNIVERSE_DEL,
USYS_UNIVERSE_CLEAR("usys.universe.clear"), USYS_UNIVERSE_CLEAR,
USYS_WORLD("usys.world"), USYS_WORLD,
USYS_ASPECT("usys.aspect"), USYS_ASPECT,
USYS_ASPECT_LIST("usys.aspect.list"), USYS_ASPECT_LIST,
USYS_ASPECT_SHOW("usys.aspect.show"), USYS_ASPECT_SHOW,
USYS_ASPECT_USE("usys.aspect.use"), USYS_ASPECT_USE,
BUFFER("buffer"), BUFFER,
BUFFER_PRINT("buffer.print"), BUFFER_PRINT,
BUFFER_CLEAR("buffer.clear"), BUFFER_CLEAR,
BUFFER_SET("buffer.set"), BUFFER_SET,
BUFFER_ADD("buffer.add"), BUFFER_ADD,
BUFFER_WHITESPACE("buffer.whitespace"), BUFFER_WHITESPACE,
CMDURL("cmdurl"), CMDURL,
CONFIG("config"), CONFIG,
NOTPDELAY("notpdelay"), NOTPDELAY,
VARIABLE_BOOK("variable.book"), VARIABLE_BOOK,
VARIABLE_BUFFER("variable.buffer"), VARIABLE_BUFFER,
CLICK("click"), CLICK,
// END OF LIST // END OF LIST
; ;
@ -60,9 +60,9 @@ public enum MassiveCorePerm
// CONSTRUCT // CONSTRUCT
// -------------------------------------------- // // -------------------------------------------- //
MassiveCorePerm(final String permissionNode) MassiveCorePerm()
{ {
this.node = "massivecore."+permissionNode; this.node = "massivecore." + this.name().toLowerCase().replace('_', '.');
} }
// -------------------------------------------- // // -------------------------------------------- //

View File

@ -1,7 +1,8 @@
package com.massivecraft.massivecore.command.editor; package com.massivecraft.massivecore.command.editor;
import java.lang.reflect.Field; import java.lang.reflect.Field;
import java.lang.reflect.Modifier;
import com.massivecraft.massivecore.command.MassiveCommand;
public class CommandEditReflection<O, V> extends CommandEditAbstract<O, V> public class CommandEditReflection<O, V> extends CommandEditAbstract<O, V>
{ {
@ -12,29 +13,18 @@ public class CommandEditReflection<O, V> extends CommandEditAbstract<O, V>
public CommandEditReflection(EditSettings<O> settings, Property<O, V> property, Class<V> clazz) public CommandEditReflection(EditSettings<O> settings, Property<O, V> property, Class<V> clazz)
{ {
super(settings, property, null); super(settings, property, null);
// TODO: What about super classes?
// TODO: While we not often use super classes they could in theory also be meant to be editable.
// TODO: Something to consider coding in for the future.
for (Field field : clazz.getDeclaredFields()) for (Field field : clazz.getDeclaredFields())
{ {
if ( ! this.isOkay(field)) continue; if ( ! PropertyReflection.isVisible(field)) continue;
Property<O, ?> propertyReflection = PropertyReflection.get(field); Property<O, ?> fieldProperty = PropertyReflection.get(field);
this.addChild(propertyReflection.createEditCommand(settings)); MassiveCommand fieldCommand = fieldProperty.createEditCommand(settings);
this.addChild(fieldCommand);
} }
}
// -------------------------------------------- //
// OKAY
// -------------------------------------------- //
public boolean isOkay(Field field)
{
if ( ! this.isModifiersOkay(field.getModifiers())) return false;
return true;
}
public boolean isModifiersOkay(int modifiers)
{
if (Modifier.isStatic(modifiers)) return false;
if (Modifier.isVolatile(modifiers)) return false;
return true;
} }
} }

View File

@ -1,5 +1,6 @@
package com.massivecraft.massivecore.command.editor; package com.massivecraft.massivecore.command.editor;
import com.massivecraft.massivecore.command.requirement.RequirementHasPerm;
import com.massivecraft.massivecore.command.type.RegistryType; import com.massivecraft.massivecore.command.type.RegistryType;
import com.massivecraft.massivecore.command.type.Type; import com.massivecraft.massivecore.command.type.Type;
import com.massivecraft.massivecore.command.type.TypeSingleton; import com.massivecraft.massivecore.command.type.TypeSingleton;
@ -18,7 +19,7 @@ public class CommandEditSingleton<O> extends CommandEditReflection<O, O>
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
public CommandEditSingleton(O object, Type<O> typeObject, String permission) public CommandEditSingleton(O object, Type<O> typeObject, String permission)
{ {
super(EditSettingsSingleton.get(object, typeObject, permission), new PropertyThis<>(typeObject), (Class<O>) object.getClass()); super(createEditSettings(object, typeObject, permission), new PropertyThis<>(typeObject), (Class<O>) object.getClass());
String name = typeObject.getName(object); String name = typeObject.getName(object);
this.setAliases(name); this.setAliases(name);
this.setDesc("edit " + name); this.setDesc("edit " + name);
@ -28,6 +29,18 @@ public class CommandEditSingleton<O> extends CommandEditReflection<O, O>
// UTIL // UTIL
// -------------------------------------------- // // -------------------------------------------- //
private static <O> EditSettings<O> createEditSettings(O object, Type<O> typeObject, String permission)
{
EditSettings<O> ret = new EditSettings<>(typeObject);
PropertyUsed<O> usedProperty = new PropertyUsed<O>(ret, object);
ret.setUsedProperty(usedProperty);
ret.addPropertyRequirements(RequirementHasPerm.get(permission));
return ret;
}
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
private static <O> Type<O> getType(O object) private static <O> Type<O> getType(O object)
{ {
@ -39,6 +52,7 @@ public class CommandEditSingleton<O> extends CommandEditReflection<O, O>
{ {
RegistryType.register((Class<O>) object.getClass(), ret); RegistryType.register((Class<O>) object.getClass(), ret);
} }
return ret; return ret;
} }

View File

@ -45,13 +45,20 @@ public class EditSettings<O>
return new EditSettings<CommandSender>(TypeSender.get(), new PropertyThis<CommandSender>(TypeSender.get())); return new EditSettings<CommandSender>(TypeSender.get(), new PropertyThis<CommandSender>(TypeSender.get()));
} }
// The requirements to edit used object. // Requirements to edit the used object.
private List<Requirement> usedRequirements = new ArrayList<Requirement>(); private List<Requirement> usedRequirements = new ArrayList<Requirement>();
public List<Requirement> getUsedRequirements() { return this.usedRequirements; } public List<Requirement> getUsedRequirements() { return this.usedRequirements; }
public void setUsedRequirements(List<Requirement> requirements) { this.usedRequirements = requirements; } public void setUsedRequirements(List<Requirement> requirements) { this.usedRequirements = requirements; }
public void addUsedRequirements(Collection<Requirement> requirements) { this.usedRequirements.addAll(requirements); } public void addUsedRequirements(Collection<Requirement> requirements) { this.usedRequirements.addAll(requirements); }
public void addUsedRequirements(Requirement... requirements) { this.addUsedRequirements(Arrays.asList(requirements)); } public void addUsedRequirements(Requirement... requirements) { this.addUsedRequirements(Arrays.asList(requirements)); }
// Requirements to edit properties. Common stuff shared by all properties.
private List<Requirement> propertyRequirements = new ArrayList<Requirement>();
public List<Requirement> getPropertyRequirements() { return this.propertyRequirements; }
public void setPropertyRequirements(List<Requirement> requirements) { this.propertyRequirements = requirements; }
public void addPropertyRequirements(Collection<Requirement> requirements) { this.propertyRequirements.addAll(requirements); }
public void addPropertyRequirements(Requirement... requirements) { this.addPropertyRequirements(Arrays.asList(requirements)); }
// -------------------------------------------- // // -------------------------------------------- //
// INSTANCE & CONSTRUCT // INSTANCE & CONSTRUCT
// -------------------------------------------- // // -------------------------------------------- //

View File

@ -1,59 +0,0 @@
package com.massivecraft.massivecore.command.editor;
import org.bukkit.command.CommandSender;
import org.bukkit.permissions.Permission;
import com.massivecraft.massivecore.command.type.Type;
import com.massivecraft.massivecore.util.PermUtil;
public class EditSettingsSingleton<O> extends EditSettings<O>
{
// -------------------------------------------- //
// FIELDS
// -------------------------------------------- //
private final String permission;
public String getPermission() { return this.permission; }
// -------------------------------------------- //
// INSTANCE & CONSTRUCT
// -------------------------------------------- //
public static <O> EditSettingsSingleton<O> get(O object, Type<O> typeObject, String permission)
{
return new EditSettingsSingleton<O>(object, typeObject, permission);
}
public EditSettingsSingleton(final O object, Type<O> typeObject, String permission)
{
super(typeObject);
this.permission = permission;
PropertyUsed<O> usedProperty = new PropertyUsed<O>(this) {
@Override
public O getRaw(CommandSender sender)
{
return object;
}
@Override
public void setRaw(CommandSender sender, O used)
{
}
};
this.setUsedProperty(usedProperty);
}
// -------------------------------------------- //
// OVERRIDE
// -------------------------------------------- //
@Override
public Permission getPropertyPermission(Property<O, ?> property)
{
return PermUtil.get(false, permission);
}
}

View File

@ -161,7 +161,13 @@ public abstract class Property<O, V> implements Named
public CommandEditAbstract<O, V> createEditCommand(EditSettings<O> settings) public CommandEditAbstract<O, V> createEditCommand(EditSettings<O> settings)
{ {
CommandEditAbstract<O, V> ret = this.getValueType().createEditCommand(settings, this); CommandEditAbstract<O, V> ret = this.getValueType().createEditCommand(settings, this);
// Add general requirements.
ret.addRequirements(settings.getPropertyRequirements());
// Add specific requirements.
ret.addRequirements(this.getRequirements()); ret.addRequirements(this.getRequirements());
return ret; return ret;
} }

View File

@ -3,6 +3,10 @@ package com.massivecraft.massivecore.command.editor;
import java.lang.reflect.Field; import java.lang.reflect.Field;
import java.lang.reflect.Modifier; import java.lang.reflect.Modifier;
import com.massivecraft.massivecore.command.editor.annotation.EditorEditable;
import com.massivecraft.massivecore.command.editor.annotation.EditorInheritable;
import com.massivecraft.massivecore.command.editor.annotation.EditorNullable;
import com.massivecraft.massivecore.command.editor.annotation.EditorVisible;
import com.massivecraft.massivecore.command.type.RegistryType; import com.massivecraft.massivecore.command.type.RegistryType;
import com.massivecraft.massivecore.command.type.Type; import com.massivecraft.massivecore.command.type.Type;
import com.massivecraft.massivecore.util.ReflectionUtil; import com.massivecraft.massivecore.util.ReflectionUtil;
@ -35,26 +39,14 @@ public class PropertyReflection<O, V> extends Property<O, V>
public PropertyReflection(Type<O> typeObject, Type<V> typeValue, Field field) public PropertyReflection(Type<O> typeObject, Type<V> typeValue, Field field)
{ {
super(typeObject, typeValue); super(typeObject, typeValue);
ReflectionUtil.makeAccessible(field); ReflectionUtil.makeAccessible(field);
this.field = field;
this.setInheritable(isInheritable(field));
this.setEditable(isEditable(field)); this.setEditable(isEditable(field));
this.setNullable(isNullable(field)); this.setNullable(isNullable(field));
this.setName(field.getName()); this.setName(field.getName());
this.field = field;
}
private static boolean isEditable(Field field)
{
return ! Modifier.isFinal(field.getModifiers());
}
private static boolean isNullable(Field field)
{
if (field.getType().isPrimitive()) return false;
EditorField setting = field.getAnnotation(EditorField.class);
if (setting != null && ! setting.nullable()) return false;
return true;
} }
// -------------------------------------------- // // -------------------------------------------- //
@ -73,4 +65,71 @@ public class PropertyReflection<O, V> extends Property<O, V>
ReflectionUtil.setField(this.getField(), object, value); ReflectionUtil.setField(this.getField(), object, value);
} }
// -------------------------------------------- //
// PROPERTY SETTINGS CALCULATION
// -------------------------------------------- //
public static boolean isVisible(Field field)
{
// Create
boolean ret = true;
// Fill > Standard
int modifiers = field.getModifiers();
if (Modifier.isStatic(modifiers) || Modifier.isTransient(modifiers)) ret = false;
// Fill > Annotation
EditorVisible annotation = field.getAnnotation(EditorVisible.class);
if (annotation != null) ret = annotation.value();
// Return
return ret;
}
public static boolean isInheritable(Field field)
{
// Create
boolean ret = true;
// Fill > Annotation
EditorInheritable annotation = field.getAnnotation(EditorInheritable.class);
if (annotation != null) ret = annotation.value();
// Return
return ret;
}
public static boolean isEditable(Field field)
{
// Create
boolean ret = true;
// Fill > Standard
int modifiers = field.getModifiers();
if (Modifier.isFinal(modifiers)) ret = false;
// Fill > Annotation
EditorEditable annotation = field.getAnnotation(EditorEditable.class);
if (annotation != null) ret = annotation.value();
// Return
return ret;
}
public static boolean isNullable(Field field)
{
// Primitive
if (field.getType().isPrimitive()) return false;
// Create
boolean ret = true;
// Fill > Annotation
EditorNullable annotation = field.getAnnotation(EditorNullable.class);
if (annotation != null) ret = annotation.value();
// Return
return ret;
}
} }

View File

@ -32,7 +32,7 @@ public class PropertyThisSenderEntity<O extends SenderEntity<O>> extends Propert
@Override @Override
public O getRaw(CommandSender object) public O getRaw(CommandSender object)
{ {
return coll.get(object); return this.getColl().get(object);
} }
@Override @Override

View File

@ -4,16 +4,44 @@ import org.bukkit.command.CommandSender;
import com.massivecraft.massivecore.command.type.sender.TypeSender; import com.massivecraft.massivecore.command.type.sender.TypeSender;
public abstract class PropertyUsed<V> extends Property<CommandSender, V> public class PropertyUsed<V> extends Property<CommandSender, V>
{ {
// -------------------------------------------- // // -------------------------------------------- //
// CONSTRUCT // CONSTRUCT
// -------------------------------------------- // // -------------------------------------------- //
public PropertyUsed(EditSettings<V> settings) public PropertyUsed(EditSettings<V> settings, V used)
{ {
super(TypeSender.get(), settings.getObjectType(), "used " + settings.getObjectType().getName()); super(TypeSender.get(), settings.getObjectType(), "used " + settings.getObjectType().getName());
this.addRequirements(settings.getUsedRequirements()); this.addRequirements(settings.getUsedRequirements());
this.used = used;
}
public PropertyUsed(EditSettings<V> settings)
{
this(settings, null);
}
// -------------------------------------------- //
// OVERRIDE
// -------------------------------------------- //
// We provide a default implementation with "the used" stored internally.
// This makes sense for a few cases.
// Such as when we edit the same instance all the time, such as a configuration.
// Most of the time these methods will however be overridden.
private V used = null;
@Override
public V getRaw(CommandSender sender)
{
return this.used;
}
@Override
public void setRaw(CommandSender sender, V used)
{
this.used = used;
} }
} }

View File

@ -1,4 +1,4 @@
package com.massivecraft.massivecore.command.editor; package com.massivecraft.massivecore.command.editor.annotation;
import java.lang.annotation.ElementType; import java.lang.annotation.ElementType;
import java.lang.annotation.Retention; import java.lang.annotation.Retention;
@ -7,10 +7,7 @@ import java.lang.annotation.Target;
@Target(ElementType.FIELD) @Target(ElementType.FIELD)
@Retention(RetentionPolicy.RUNTIME) @Retention(RetentionPolicy.RUNTIME)
public @interface EditorField public @interface EditorEditable
{ {
boolean nullable() default true; boolean value();
Class<?> type() default void.class;
String singletonName() default "i";
} }

View File

@ -0,0 +1,13 @@
package com.massivecraft.massivecore.command.editor.annotation;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
@Target(ElementType.FIELD)
@Retention(RetentionPolicy.RUNTIME)
public @interface EditorInheritable
{
boolean value();
}

View File

@ -0,0 +1,13 @@
package com.massivecraft.massivecore.command.editor.annotation;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
@Target(ElementType.FIELD)
@Retention(RetentionPolicy.RUNTIME)
public @interface EditorNullable
{
boolean value();
}

View File

@ -0,0 +1,17 @@
package com.massivecraft.massivecore.command.editor.annotation;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
@Target(ElementType.FIELD)
@Retention(RetentionPolicy.RUNTIME)
public @interface EditorType
{
// This is the type class.
Class<?> value() default void.class;
// The name of the singleton instance field to use.
String fieldName() default "i";
}

View File

@ -0,0 +1,13 @@
package com.massivecraft.massivecore.command.editor.annotation;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
@Target(ElementType.FIELD)
@Retention(RetentionPolicy.RUNTIME)
public @interface EditorVisible
{
boolean value();
}

View File

@ -41,6 +41,9 @@ public class CmdMassiveCore extends MassiveCommand
public CmdMassiveCore() public CmdMassiveCore()
{ {
// Tweak
this.cmdMassiveCoreConfig.setAliases("config");
// Children // Children
this.addChild(this.cmdMassiveCoreUsys); this.addChild(this.cmdMassiveCoreUsys);
this.addChild(this.cmdMassiveCoreMStore); this.addChild(this.cmdMassiveCoreMStore);

View File

@ -37,7 +37,7 @@ import com.massivecraft.massivecore.SoundEffect;
import com.massivecraft.massivecore.collections.ExceptionSet; import com.massivecraft.massivecore.collections.ExceptionSet;
import com.massivecraft.massivecore.collections.MassiveMap; import com.massivecraft.massivecore.collections.MassiveMap;
import com.massivecraft.massivecore.collections.WorldExceptionSet; import com.massivecraft.massivecore.collections.WorldExceptionSet;
import com.massivecraft.massivecore.command.editor.EditorField; import com.massivecraft.massivecore.command.editor.annotation.EditorType;
import com.massivecraft.massivecore.command.type.combined.TypeEntry; import com.massivecraft.massivecore.command.type.combined.TypeEntry;
import com.massivecraft.massivecore.command.type.combined.TypePotionEffectWrap; import com.massivecraft.massivecore.command.type.combined.TypePotionEffectWrap;
import com.massivecraft.massivecore.command.type.combined.TypeSoundEffect; import com.massivecraft.massivecore.command.type.combined.TypeSoundEffect;
@ -93,12 +93,12 @@ public class RegistryType
public static Type<?> getType(Field field) public static Type<?> getType(Field field)
{ {
EditorField setting = field.getAnnotation(EditorField.class); EditorType annotation = field.getAnnotation(EditorType.class);
if (setting != null) if (annotation != null)
{ {
Class<?> clazz = setting.type(); Class<?> clazz = annotation.value();
if (clazz == void.class) clazz = getType(field.getGenericType()).getClass(); if (clazz == void.class) clazz = getType(field.getGenericType()).getClass();
return ReflectionUtil.getField(clazz, setting.singletonName(), null); return ReflectionUtil.getField(clazz, annotation.fieldName(), null);
} }
return getType(field.getGenericType()); return getType(field.getGenericType());
@ -112,32 +112,39 @@ public class RegistryType
if (type == null) throw new IllegalStateException(reflectType + " is not registered."); if (type == null) throw new IllegalStateException(reflectType + " is not registered.");
return type; return type;
} }
if (reflectType instanceof ParameterizedType) if (reflectType instanceof ParameterizedType)
{ {
ParameterizedType paramType = (ParameterizedType) reflectType; ParameterizedType paramType = (ParameterizedType) reflectType;
Class<?> parent = (Class<?>) paramType.getRawType(); Class<?> parent = (Class<?>) paramType.getRawType();
if (Map.class.isAssignableFrom(parent)) if (Map.class.isAssignableFrom(parent))
{ {
TypeEntry<?, ?> typeEntry = TypeEntry.get(getType(paramType.getActualTypeArguments()[0]), getType(paramType.getActualTypeArguments()[1])); TypeEntry<?, ?> typeEntry = TypeEntry.get(getType(paramType.getActualTypeArguments()[0]), getType(paramType.getActualTypeArguments()[1]));
return TypeMap.get(typeEntry); return TypeMap.get(typeEntry);
} }
if (List.class.isAssignableFrom(parent)) if (List.class.isAssignableFrom(parent))
{ {
return TypeList.get(getType(paramType.getActualTypeArguments()[0])); return TypeList.get(getType(paramType.getActualTypeArguments()[0]));
} }
if (Set.class.isAssignableFrom(parent)) if (Set.class.isAssignableFrom(parent))
{ {
return TypeSet.get(getType(paramType.getActualTypeArguments()[0])); return TypeSet.get(getType(paramType.getActualTypeArguments()[0]));
} }
if (Entry.class.isAssignableFrom(parent)) if (Entry.class.isAssignableFrom(parent))
{ {
return TypeEntry.get(getType(paramType.getActualTypeArguments()[0]), getType(paramType.getActualTypeArguments()[1])); return TypeEntry.get(getType(paramType.getActualTypeArguments()[0]), getType(paramType.getActualTypeArguments()[1]));
} }
if (ExceptionSet.class.isAssignableFrom(parent)) if (ExceptionSet.class.isAssignableFrom(parent))
{ {
return TypeExceptionSet.get(getType(paramType.getActualTypeArguments()[0])); return TypeExceptionSet.get(getType(paramType.getActualTypeArguments()[0]));
} }
} }
throw new IllegalArgumentException("Unknown type: " + reflectType); throw new IllegalArgumentException("Unknown type: " + reflectType);
} }