示例#1
0
  private void createDeclaredViews(
      final Map<String, DesignDocument.View> views, final Class<?> klass) {
    eachAnnotation(
        klass,
        Views.class,
        new Predicate<Views>() {

          public boolean apply(Views input) {
            for (View v : input.value()) {
              addView(views, v, klass);
            }
            return true;
          }
        });

    ReflectionUtils.eachAnnotation(
        klass,
        View.class,
        new Predicate<View>() {

          public boolean apply(View input) {
            addView(views, input, klass);
            return true;
          }
        });
  }
示例#2
0
 private String resolveTypeDiscriminatorForBackReference(Member m) {
   Method me =
       ReflectionUtils.findMethod(
           m.getDeclaringClass(), "get" + firstCharToUpperCase(m.getName()));
   if (me != null) {
     return resolveTypeDiscriminator(resolveReturnType(me));
   }
   return "";
 }
  public SqlMapRepositoryFactory(SqlMapClient sqlMapClient) {
    Assert.notNull(sqlMapClient, "SqlMapClient must not be null!");

    this.sqlMapClient = (SqlMapClientImpl) sqlMapClient;
    this.sqlMapClientTemplate = new SqlMapClientTemplate(sqlMapClient);

    if (ExtendedSqlMapClient.class.isAssignableFrom(sqlMapClient.getClass())) {
      this.sqlMapExecutorDelegate = ((ExtendedSqlMapClient) sqlMapClient).getDelegate();
    } else if (hasSqlMapExecutorDelegate(sqlMapClient)) {
      Field field = findSqlMapExecutorDelegate(sqlMapClient);
      field.setAccessible(true);

      this.sqlMapExecutorDelegate =
          (SqlMapExecutorDelegate) ReflectionUtils.getField(field, sqlMapClient);
    } else {
      throw new IllegalArgumentException("not found SqlMapExecutorDelegate in SqlMapClient.");
    }
  }