congrats Icon
New! Announcing Tabnine Chat Beta
Learn More
Tabnine Logo
Generic.<init>
Code IndexAdd Tabnine to your IDE (free)

How to use
com.wizzardo.tools.reflection.Generic
constructor

Best Java code snippets using com.wizzardo.tools.reflection.Generic.<init> (Showing top 20 results out of 315)

origin: com.wizzardo.tools/tools-reflection

public static <T> Generic<T, Fields, Generic> of(Class<T> clazz) {
  return new Generic<T, Fields, Generic>(clazz);
}
origin: com.wizzardo.tools/tools-reflection

protected G create(Class<T> c, Class... generics) {
  return (G) new Generic(c, generics);
}
origin: com.wizzardo.tools/tools-reflection

protected G create(Type c, Map<String, G> types) {
  return (G) new Generic(c, types);
}
origin: com.wizzardo.tools/tools-reflection

protected G create(Type c) {
  return (G) new Generic(c);
}
origin: com.wizzardo.tools/tools-reflection

protected G create(Type c, Map<String, G> types, Map<Type, Generic<T, F, G>> cyclicDependencies) {
  return (G) new Generic(c, types, cyclicDependencies);
}
origin: wizzardo/tools

public static <T> Generic<T, Fields, Generic> of(Class<T> clazz) {
  return new Generic<T, Fields, Generic>(clazz);
}
origin: wizzardo/tools

protected G create(Type c) {
  return (G) new Generic(c);
}
origin: wizzardo/tools

protected G create(Class<T> c, Class... generics) {
  return (G) new Generic(c, generics);
}
origin: wizzardo/tools

protected G create(Type c, Map<String, G> types) {
  return (G) new Generic(c, types);
}
origin: wizzardo/tools

protected G create(Type c, Map<String, G> types, Map<Type, Generic<T, F, G>> cyclicDependencies) {
  return (G) new Generic(c, types, cyclicDependencies);
}
origin: wizzardo/tools

  protected G createGeneric(Field field, Map<String, G> types) {
    return (G) new Generic(field.getGenericType(), types);
  }
}
origin: com.wizzardo.tools/tools-reflection

  protected G createGeneric(Field field, Map<String, G> types) {
    return (G) new Generic(field.getGenericType(), types);
  }
}
origin: com.wizzardo.tools/tools-reflection

protected void fillMethods(List<GenericMethod> methods, Generic generic) {
  Method[] declaredMethods = generic.clazz.getDeclaredMethods();
  for (Method method : declaredMethods) {
    Generic returnType = new Generic(method.getGenericReturnType(), generic.types);
    Type[] genericParameterTypes = method.getGenericParameterTypes();
    List<Generic> args = new ArrayList<Generic>(genericParameterTypes.length);
    for (Type genericParameterType : genericParameterTypes) {
      args.add(new Generic(genericParameterType, generic.types));
    }
    methods.add(new GenericMethod(method, returnType, Collections.unmodifiableList(args)));
  }
  for (Generic g : generic.interfaces) {
    fillMethods(methods, g);
  }
  if (generic.parent != null)
    fillMethods(methods, generic.parent);
}
origin: wizzardo/tools

@Test
public void nullTest() throws NoSuchFieldException {
  Assert.assertEquals(0, new Generic(Object.class, (Generic[]) null).typeParameters.length);
  Assert.assertEquals(0, new Generic(Object.class, (Class[]) null).typeParameters.length);
}
origin: wizzardo/tools

@Test
public void arrayTest() throws NoSuchFieldException {
  Generic generic = new Generic(ArrayHolder.class.getDeclaredField("array").getGenericType());
  Assert.assertEquals(Array.class, generic.clazz);
  Assert.assertEquals(null, generic.parent);
  Assert.assertEquals(1, generic.typeParameters.length);
  Assert.assertEquals(int.class, generic.typeParameters[0].clazz);
  generic = new Generic(ArrayHolder.class.getDeclaredField("list").getGenericType());
  Assert.assertEquals(List.class, generic.clazz);
  Assert.assertEquals(null, generic.parent);
  Assert.assertEquals(1, generic.typeParameters.length);
  generic = generic.typeParameters[0];
  Assert.assertEquals(Array.class, generic.clazz);
  Assert.assertEquals(null, generic.parent);
  Assert.assertEquals(1, generic.typeParameters.length);
  Assert.assertEquals(int.class, generic.typeParameters[0].clazz);
}
origin: wizzardo/tools

@Test
public void secondTest() throws NoSuchFieldException {
  Generic generic = new Generic(Child.class.getDeclaredField("map").getGenericType());
  Assert.assertEquals(Map.class, generic.clazz);
  Assert.assertEquals(2, generic.typeParameters.length);
  Assert.assertEquals(Integer.class, generic.typeParameters[0].clazz);
  Assert.assertEquals(ListWrapper.class, generic.typeParameters[1].clazz);
  Assert.assertEquals(String.class, generic.typeParameters[1].typeParameters[0].clazz);
  Assert.assertEquals(Wrapper.class, generic.typeParameters[1].parent.clazz);
  Assert.assertEquals(List.class, generic.typeParameters[1].parent.typeParameters[0].clazz);
  Assert.assertEquals(String.class, generic.typeParameters[1].parent.typeParameters[0].typeParameters[0].clazz);
}
origin: wizzardo/tools

@Test
public void thirdTest() throws NoSuchFieldException {
  Generic generic = new Generic(KeyValueStrings.class);
  Assert.assertEquals(KeyValueStrings.class, generic.clazz);
  Assert.assertEquals(KeyValueWrapper.class, generic.parent.clazz);
  Assert.assertEquals(KeyValue.class, generic.parent.parent.clazz);
  Assert.assertEquals(Object.class, generic.parent.parent.parent.clazz);
  Assert.assertEquals(null, generic.parent.parent.parent.parent);
  Generic type = generic.getGenericType(KeyValue.class.getDeclaredField("key"));
  Assert.assertEquals(String.class, type.clazz);
}
origin: wizzardo/tools

@Test
public void firstTest() throws NoSuchFieldException {
  Generic generic = new Generic(AnotherWrapper.class);
  Assert.assertEquals(AnotherWrapper.class.getSimpleName(), generic.toString());
  Assert.assertEquals(AnotherWrapper.class, generic.clazz);
  Assert.assertEquals(ListWrapper.class, generic.parent.clazz);
  Assert.assertEquals(Wrapper.class, generic.parent.parent.clazz);
  Assert.assertEquals(Object.class, generic.parent.parent.parent.clazz);
  Assert.assertEquals(null, generic.parent.parent.parent.parent);
  Generic type = generic.getGenericType(Wrapper.class.getDeclaredField("value"));
  Assert.assertEquals(List.class, type.clazz);
  Assert.assertEquals(Wrapper.class, type.typeParameters[0].clazz);
  Assert.assertEquals(String.class, type.typeParameters[0].typeParameters[0].clazz);
}
origin: wizzardo/tools

@Test
public void fieldsTest() throws NoSuchFieldException {
  Generic generic = new Generic(ArrayHolder.class);
  Fields map = generic.getFields();
  Assert.assertEquals(2, map.size());
  Assert.assertTrue(map.containsKey("array"));
  Assert.assertTrue(map.containsKey("list"));
  Assert.assertTrue(map == generic.getFields());
}
origin: wizzardo/tools

@Test
public void interfacesTest_2() {
  Generic generic = new Generic(ChildInterface.class);
  Assert.assertEquals(ChildInterface.class, generic.clazz);
  Assert.assertEquals(1, generic.interfaces.length);
  Generic parent = generic.interfaces[0];
  Assert.assertEquals(ParentInterface.class, parent.clazz);
  Assert.assertEquals(String.class, parent.type(0).clazz);
  Assert.assertEquals(1, parent.interfaces.length);
  Generic supr = parent.interfaces[0];
  Assert.assertEquals(SuperInterface.class, supr.clazz);
  Assert.assertEquals(String.class, supr.type(0).clazz);
}
com.wizzardo.tools.reflectionGeneric<init>

Popular methods of Generic

  • type
  • of
  • typesCount
  • create
  • createArray
  • fillMethods
  • getGenericType
  • getTypes
  • initInterfaces
  • types
  • getFields
  • init
  • getFields,
  • init,
  • methods,
  • parent,
  • toString

Popular in Java

  • Making http post requests using okhttp
  • onCreateOptionsMenu (Activity)
  • scheduleAtFixedRate (Timer)
  • setContentView (Activity)
  • Menu (java.awt)
  • FileOutputStream (java.io)
    An output stream that writes bytes to a file. If the output file exists, it can be replaced or appen
  • Calendar (java.util)
    Calendar is an abstract base class for converting between a Date object and a set of integer fields
  • ThreadPoolExecutor (java.util.concurrent)
    An ExecutorService that executes each submitted task using one of possibly several pooled threads, n
  • IOUtils (org.apache.commons.io)
    General IO stream manipulation utilities. This class provides static utility methods for input/outpu
  • Logger (org.apache.log4j)
    This is the central class in the log4j package. Most logging operations, except configuration, are d
  • Top Vim plugins
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now