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

The following examples show how to use com.github.davidmoten.rx.jdbc.annotations.Column. 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 File: DynamicProxyTest.java    From rxjava-jdbc with 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 #2
Source File: AutoMapCache.java    From rxjava-jdbc with 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 #3
Source File: DatabaseTestBase.java    From rxjava-jdbc with Apache License 2.0 4 votes vote down vote up
@Column
int addressId();
 
Example #4
Source File: Employee.java    From tutorials with MIT License 4 votes vote down vote up
@Column("name")
String name();
 
Example #5
Source File: Employee.java    From tutorials with MIT License 4 votes vote down vote up
@Column("id")
int id();
 
Example #6
Source File: DatabaseTestBase.java    From rxjava-jdbc with Apache License 2.0 4 votes vote down vote up
@Column
int score();
 
Example #7
Source File: DatabaseTestBase.java    From rxjava-jdbc with Apache License 2.0 4 votes vote down vote up
@Column
String name();
 
Example #8
Source File: DatabaseTestBase.java    From rxjava-jdbc with Apache License 2.0 4 votes vote down vote up
@Column
String fullAddress();
 
Example #9
Source File: DatabaseTestBase.java    From rxjava-jdbc with Apache License 2.0 4 votes vote down vote up
@Column
int addressId(String suburb);
 
Example #10
Source File: DatabaseTestBase.java    From rxjava-jdbc with Apache License 2.0 4 votes vote down vote up
@Column("score")
int score();
 
Example #11
Source File: DatabaseTestBase.java    From rxjava-jdbc with Apache License 2.0 4 votes vote down vote up
@Column
String fullAddress();
 
Example #12
Source File: DatabaseTestBase.java    From rxjava-jdbc with Apache License 2.0 4 votes vote down vote up
@Column("score")
int score();
 
Example #13
Source File: DatabaseExampleTest.java    From rxjava-jdbc with Apache License 2.0 4 votes vote down vote up
@Column
int score();
 
Example #14
Source File: DatabaseExampleTest.java    From rxjava-jdbc with Apache License 2.0 4 votes vote down vote up
@Column
String name();
 
Example #15
Source File: ColumnNotFoundTest.java    From rxjava-jdbc with Apache License 2.0 4 votes vote down vote up
@Column("bingo")
Long hello();
 
Example #16
Source File: DynamicProxyTest.java    From rxjava-jdbc with Apache License 2.0 4 votes vote down vote up
@Column("desc")
String description();
 
Example #17
Source File: DynamicProxyTest.java    From rxjava-jdbc with Apache License 2.0 4 votes vote down vote up
@Column("table_id")
int id();