Java Code Examples for com.github.davidmoten.rx.jdbc.annotations.Column

The following examples show how to use com.github.davidmoten.rx.jdbc.annotations.Column. These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source Project: rxjava-jdbc   Source File: AutoMapCache.java    License: Apache License 2.0 6 votes vote down vote up
private static Map<String, Col> getMethodCols(Class<?> cls) {
    Map<String, Col> methodCols = new HashMap<String, Col>();
    for (Method method : cls.getMethods()) {
        String name = method.getName();
        Column column = method.getAnnotation(Column.class);
        if (column != null) {
            checkHasNoParameters(method);
            // TODO check method has a mappable return type
            String col = column.value();
            if (col.equals(Column.NOT_SPECIFIED))
                col = Util.camelCaseToUnderscore(name);
            methodCols.put(name, new NamedCol(col, method.getReturnType()));
        } else {
            Index index = method.getAnnotation(Index.class);
            if (index != null) {
                // TODO check method has a mappable return type
                checkHasNoParameters(method);
                methodCols.put(name, new IndexedCol(index.value(), method.getReturnType()));
            }
        }
    }
    return methodCols;
}
 
Example 2
Source Project: rxjava-jdbc   Source File: DynamicProxyTest.java    License: Apache License 2.0 6 votes vote down vote up
public Object invoke(Object proxy, Method m, Object[] args) throws Throwable {
    Column a = m.getAnnotation(Column.class);
    final String column;
    if (a == null || a.value().equals(Column.NOT_SPECIFIED))
        column = null;
    else
        column = a.value();
    String name = m.getName();
    if (name.equals("id")) {
        return 123;
    } else if (name.equals("name")) {
        return "fred " + m.getAnnotation(Index.class).value();
    } else if (name.equals("description")) {
        return "he's the business! " + column;
    } else if (name.equals("nonNullNumber"))
        return null;
    else
        throw new RuntimeException("unexpected");
}
 
Example 3
Source Project: rxjava-jdbc   Source File: DynamicProxyTest.java    License: Apache License 2.0 4 votes vote down vote up
@Column("table_id")
int id();
 
Example 4
Source Project: rxjava-jdbc   Source File: DynamicProxyTest.java    License: Apache License 2.0 4 votes vote down vote up
@Column("desc")
String description();
 
Example 5
Source Project: rxjava-jdbc   Source File: ColumnNotFoundTest.java    License: Apache License 2.0 4 votes vote down vote up
@Column("bingo")
Long hello();
 
Example 6
Source Project: rxjava-jdbc   Source File: DatabaseExampleTest.java    License: Apache License 2.0 4 votes vote down vote up
@Column
String name();
 
Example 7
Source Project: rxjava-jdbc   Source File: DatabaseExampleTest.java    License: Apache License 2.0 4 votes vote down vote up
@Column
int score();
 
Example 8
Source Project: rxjava-jdbc   Source File: DatabaseTestBase.java    License: Apache License 2.0 4 votes vote down vote up
@Column("score")
int score();
 
Example 9
Source Project: rxjava-jdbc   Source File: DatabaseTestBase.java    License: Apache License 2.0 4 votes vote down vote up
@Column
int addressId();
 
Example 10
Source Project: rxjava-jdbc   Source File: DatabaseTestBase.java    License: Apache License 2.0 4 votes vote down vote up
@Column
String fullAddress();
 
Example 11
Source Project: rxjava-jdbc   Source File: DatabaseTestBase.java    License: Apache License 2.0 4 votes vote down vote up
@Column("score")
int score();
 
Example 12
Source Project: rxjava-jdbc   Source File: DatabaseTestBase.java    License: Apache License 2.0 4 votes vote down vote up
@Column
int addressId(String suburb);
 
Example 13
Source Project: rxjava-jdbc   Source File: DatabaseTestBase.java    License: Apache License 2.0 4 votes vote down vote up
@Column
String fullAddress();
 
Example 14
Source Project: rxjava-jdbc   Source File: DatabaseTestBase.java    License: Apache License 2.0 4 votes vote down vote up
@Column
String name();
 
Example 15
Source Project: rxjava-jdbc   Source File: DatabaseTestBase.java    License: Apache License 2.0 4 votes vote down vote up
@Column
int score();
 
Example 16
Source Project: tutorials   Source File: Employee.java    License: MIT License 4 votes vote down vote up
@Column("id")
int id();
 
Example 17
Source Project: tutorials   Source File: Employee.java    License: MIT License 4 votes vote down vote up
@Column("name")
String name();