Last active
December 27, 2015 16:29
-
-
Save dha-lo-jd/7355503 to your computer and use it in GitHub Desktop.
Integerとintに両対応(きっともっと良いやり方がある…)
This file contains hidden or 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
package org.lo.d.minecraft.littlemaid; | |
import java.lang.reflect.Method; | |
import java.util.Arrays; | |
import java.util.List; | |
import java.util.Set; | |
import com.google.common.collect.Sets; | |
public class IWantSpatJob { | |
private static final Set<List<Class<?>>> REQUIRES; | |
static { | |
Set<List<Class<?>>> set = Sets.newHashSet(); | |
set.add(Arrays.asList(new Class<?>[] { | |
String.class, IWantSpatJob.class, int.class, int.class | |
})); | |
set.add(Arrays.asList(new Class<?>[] { | |
String.class, IWantSpatJob.class, Integer.class, int.class | |
})); | |
set.add(Arrays.asList(new Class<?>[] { | |
String.class, IWantSpatJob.class, int.class, Integer.class | |
})); | |
set.add(Arrays.asList(new Class<?>[] { | |
String.class, IWantSpatJob.class, Integer.class, Integer.class | |
})); | |
REQUIRES = set; | |
} | |
public static void main(String[] args) { | |
for (Method method : IWantSpatJob.class.getMethods()) { | |
List<Class<?>> params = Arrays.asList(method.getParameterTypes()); | |
if (REQUIRES.contains(params)) { | |
System.out.println("matched."); | |
System.out.println(method.getName()); | |
} | |
} | |
} | |
public void dummy() { | |
} | |
public void method(String s, IWantSpatJob job, int i, int j) { | |
} | |
public void method2(String s, IWantSpatJob job, Integer i, Integer j) { | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment