Ejemplo n.º 1
0
 private void verifyExternalClass(final Class clazz) {
   // don't recommended to instantiate the class doing clazz.newInstance().
   clazz.getDeclaredConstructors();
   clazz.getDeclaredFields();
   clazz.getDeclaredMethods();
   clazz.getDeclaredClasses();
   clazz.getDeclaredAnnotations();
 }
Ejemplo n.º 2
0
  public TypeSource getClassSource(final KieModuleMetaData metaData, final Class<?> clazz) {
    // Was the Type declared in DRL
    if (metaData.getTypeMetaInfo(clazz).isDeclaredType()) {
      return TypeSource.DECLARED;
    }

    // Was the Type defined inside the project or within a dependency
    String fullyQualifiedClassName = clazz.getName();
    int innerClassIdentifierIndex = fullyQualifiedClassName.indexOf("$");
    if (innerClassIdentifierIndex > 0) {
      fullyQualifiedClassName = fullyQualifiedClassName.substring(0, innerClassIdentifierIndex);
    }
    if (javaResources.contains(fullyQualifiedClassName)) {
      return TypeSource.JAVA_PROJECT;
    }
    return TypeSource.JAVA_DEPENDENCY;
  }