congrats Icon
New! Announcing Tabnine Chat Beta
Learn More
Tabnine Logo
TypeResolver
Code IndexAdd Tabnine to your IDE (free)

How to use
TypeResolver
in
org.jboss.arquillian.graphene.spi

Best Java code snippets using org.jboss.arquillian.graphene.spi.TypeResolver (Showing top 15 results out of 315)

origin: org.jboss.arquillian.extension/arquillian-angularjs-graphene-api

protected By instantiate(Class<? extends By> type, String lookup) {
  try {
    Class<? extends By> clazz = TypeResolver.resolveType(type);
    Constructor<? extends By> constructor = clazz.getConstructor(String.class);
    return constructor.newInstance(lookup);
  } catch (Exception e) {
    throw new IllegalStateException("Cannot instantiate " + type, e);
  }
}
origin: org.jboss.arquillian.graphene/graphene-webdriver-spi

/**
 * Instantiates a class by given implementation name
 *
 * @param className
 * @return
 */
@SuppressWarnings("unchecked")
public static <T> T instantiate(String className) {
  return (T) instantiate(resolveType(className));
}
origin: arquillian/arquillian-graphene

private ExecutionResolver createResolver(JavaScript annotation) {
  try {
    return TypeResolver.instantiate(annotation.executionResolver());
  } catch (Exception e) {
    throw new IllegalStateException("resolver " + annotation.executionResolver() + " can't be instantied", e);
  }
}
origin: org.jboss.arquillian.graphene/graphene-webdriver-api

private ExecutionResolver createResolver(JavaScript annotation) {
  try {
    return TypeResolver.instantiate(annotation.executionResolver());
  } catch (Exception e) {
    throw new IllegalStateException("resolver " + annotation.executionResolver() + " can't be instantied", e);
  }
}
origin: org.jboss.arquillian.graphene/graphene-webdriver-api

private static By instantiate(String selector) {
  try {
    Class<? extends By> clazz = (Class<? extends By>) TypeResolver.resolveType(ByJQuery.class);
    Constructor<? extends By> constructor = clazz.getConstructor(String.class);
    return constructor.newInstance(selector);
  } catch (Exception e) {
    e.printStackTrace();
    throw new IllegalStateException("Cannot instantiate ByJQuery", e);
  }
}
origin: arquillian/arquillian-graphene

/**
 * Instantiates a class by given implementation name
 *
 * @param className
 * @return
 */
@SuppressWarnings("unchecked")
public static <T> T instantiate(String className) {
  return (T) instantiate(resolveType(className));
}
origin: arquillian/arquillian-graphene

private static By instantiate(String selector) {
  try {
    Class<? extends By> clazz = (Class<? extends By>) TypeResolver.resolveType(ByJQuery.class);
    Constructor<? extends By> constructor = clazz.getConstructor(String.class);
    return constructor.newInstance(selector);
  } catch (Exception e) {
    e.printStackTrace();
    throw new IllegalStateException("Cannot instantiate ByJQuery", e);
  }
}
origin: arquillian/arquillian-graphene

/**
 * Resolves type based on given className, while it reflects annotation {@link ImplementedBy} in order to determine final
 * implementation of given type.
 *
 * @param typeName the name of the type
 * @return the implementation class for given type
 */
@SuppressWarnings("unchecked")
public static <T> Class<? extends T> resolveType(String typeName) {
  try {
    Class<?> clazz = Class.forName(typeName);
    return (Class<? extends T>) resolveType(clazz);
  } catch (ClassNotFoundException e) {
    throw new IllegalStateException(
        String.format(
            "Cannot find class %s. Make sure you have respective implementation (e.g. graphene-webdriver-impl.jar) included on the classpath.",
            typeName), e);
  }
}
origin: org.jboss.arquillian.graphene/graphene-webdriver-spi

/**
 * Resolves type based on given className, while it reflects annotation {@link ImplementedBy} in order to determine final
 * implementation of given type.
 *
 * @param typeName the name of the type
 * @return the implementation class for given type
 */
@SuppressWarnings("unchecked")
public static <T> Class<? extends T> resolveType(String typeName) {
  try {
    Class<?> clazz = Class.forName(typeName);
    return (Class<? extends T>) resolveType(clazz);
  } catch (ClassNotFoundException e) {
    throw new IllegalStateException(
        String.format(
            "Cannot find class %s. Make sure you have respective implementation (e.g. graphene-webdriver-impl.jar) included on the classpath.",
            typeName), e);
  }
}
origin: org.jboss.arquillian.graphene/graphene-webdriver-spi

/**
 * Instantiates class by given type, while it reflects annotation {@link ImplementedBy} in order to determine final
 * implementation of given type.
 *
 * @param type the type of the instantiated instance, which can be either final implementation type or type annotated by
 *        {@link ImplementedBy} in order to determine final implementation of given type.
 * @return instance of given type
 */
public static <T> T instantiate(Class<T> type) {
  try {
    Class<? extends T> resolvedType = resolveType(type);
    return SecurityActions.newInstance(resolvedType.getName(), new Class<?>[] {}, new Object[] {}, type);
  } catch (Exception e) {
    throw new IllegalStateException(String.format("Cannot instantiate an instance of class '%s': %s", type.getName(),
        e.getMessage()), e);
  }
}
origin: arquillian/arquillian-graphene

/**
 * Instantiates class by given type, while it reflects annotation {@link ImplementedBy} in order to determine final
 * implementation of given type.
 *
 * @param type the type of the instantiated instance, which can be either final implementation type or type annotated by
 *        {@link ImplementedBy} in order to determine final implementation of given type.
 * @return instance of given type
 */
public static <T> T instantiate(Class<T> type) {
  try {
    Class<? extends T> resolvedType = resolveType(type);
    return SecurityActions.newInstance(resolvedType.getName(), new Class<?>[] {}, new Object[] {}, type);
  } catch (Exception e) {
    throw new IllegalStateException(String.format("Cannot instantiate an instance of class '%s': %s", type.getName(),
        e.getMessage()), e);
  }
}
origin: org.jboss.arquillian.graphene/graphene-webdriver-spi

/**
 * Resolves implementation type based on given type, while it reflects annotation {@link ImplementedBy} in order to
 * determine final implementation of given type.
 *
 * @param type the type to be resolved
 * @return the implementation class for given type
 */
@SuppressWarnings("unchecked")
public static <T> Class<? extends T> resolveType(Class<T> type) {
  ImplementedBy implementedBy = type.getAnnotation(ImplementedBy.class);
  if (implementedBy != null) {
    if (implementedBy.value() != ImplementedBy.class) {
      return (Class<? extends T>) resolveType(implementedBy.value());
    } else if (!"".equals(implementedBy.className())) {
      return (Class<? extends T>) resolveType(implementedBy.className());
    } else {
      throw new IllegalStateException(
          String.format(
              "Cannot instantiate an instance of '%s' as its %s is incomplete - it doesn't specify implementation class",
              type.getName(), implementedBy));
    }
  } else {
    return type;
  }
}
origin: arquillian/arquillian-graphene

/**
 * Resolves implementation type based on given type, while it reflects annotation {@link ImplementedBy} in order to
 * determine final implementation of given type.
 *
 * @param type the type to be resolved
 * @return the implementation class for given type
 */
@SuppressWarnings("unchecked")
public static <T> Class<? extends T> resolveType(Class<T> type) {
  ImplementedBy implementedBy = type.getAnnotation(ImplementedBy.class);
  if (implementedBy != null) {
    if (implementedBy.value() != ImplementedBy.class) {
      return (Class<? extends T>) resolveType(implementedBy.value());
    } else if (!"".equals(implementedBy.className())) {
      return (Class<? extends T>) resolveType(implementedBy.className());
    } else {
      throw new IllegalStateException(
          String.format(
              "Cannot instantiate an instance of '%s' as its %s is incomplete - it doesn't specify implementation class",
              type.getName(), implementedBy));
    }
  } else {
    return type;
  }
}
origin: org.jboss.arquillian.graphene/graphene-webdriver-impl

InstantiationException, IllegalAccessException, IllegalArgumentException, InvocationTargetException {
Class<? extends T> clazz = TypeResolver.resolveType(type);
Class<?> outerClass = clazz.getDeclaringClass();
origin: arquillian/arquillian-graphene

InstantiationException, IllegalAccessException, IllegalArgumentException, InvocationTargetException {
Class<? extends T> clazz = TypeResolver.resolveType(type);
Class<?> outerClass = clazz.getDeclaringClass();
org.jboss.arquillian.graphene.spiTypeResolver

Javadoc

Instantiates given class while it reflects annotation ImplementedBy in order to determine final implementation of given type.

Most used methods

  • resolveType
    Resolves type based on given className, while it reflects annotation ImplementedBy in order to deter
  • instantiate
    Instantiates a class by given implementation name

Popular in Java

  • Reactive rest calls using spring rest template
  • setScale (BigDecimal)
  • notifyDataSetChanged (ArrayAdapter)
  • scheduleAtFixedRate (Timer)
  • EOFException (java.io)
    Thrown when a program encounters the end of a file or stream during an input operation.
  • KeyStore (java.security)
    KeyStore is responsible for maintaining cryptographic keys and their owners. The type of the syste
  • MessageFormat (java.text)
    Produces concatenated messages in language-neutral way. New code should probably use java.util.Forma
  • Properties (java.util)
    A Properties object is a Hashtable where the keys and values must be Strings. Each property can have
  • JarFile (java.util.jar)
    JarFile is used to read jar entries and their associated data from jar files.
  • JTable (javax.swing)
  • From CI to AI: The AI layer in your organization
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