コード例 #1
0
ファイル: FileDescLoader.java プロジェクト: Unknow0/sync
 public static void load(Collection<FileDesc> files, Path root, int blocSize, Pattern pattern)
     throws IOException {
   root = root.toAbsolutePath().normalize();
   Visitor visitor = new Visitor(root, blocSize, pattern);
   Files.walkFileTree(root, visitor);
   for (Future<FileDesc> future : visitor.futures()) {
     try {
       files.add(future.get());
     } catch (Exception e) {
       log.error("", e);
     }
   }
 }
コード例 #2
0
  private boolean hasTypeDiscriminatorFieldOrMethod(final Class<?> persistentType) {
    Collection<?> hits =
        eachField(
            persistentType,
            new Predicate<Field>() {
              public boolean apply(Field input) {
                return hasAnnotation(input, TypeDiscriminator.class);
              }
            });
    if (!hits.isEmpty()) {
      return true;
    }

    hits =
        eachMethod(
            persistentType,
            new Predicate<Method>() {
              public boolean apply(Method input) {
                return hasAnnotation(input, TypeDiscriminator.class);
              }
            });
    return !hits.isEmpty();
  }