List of usage examples for java.lang.reflect Field equals
public boolean equals(Object obj)
From source file:Main.java
private static Object getCursorValue(Cursor cursor, Field field, String columnName) { Class<?> fieldType = field.getType(); if (fieldType.equals(int.class) || field.equals(Integer.class)) { return cursor.getInt(cursor.getColumnIndex(columnName)); } else if (fieldType.equals(String.class)) { return cursor.getString(cursor.getColumnIndex(columnName)); } else if (fieldType.equals(long.class) || field.equals(Long.class)) { return cursor.getLong(cursor.getColumnIndex(columnName)); } else if (fieldType.equals(float.class) || field.equals(Float.class)) { return cursor.getFloat(cursor.getColumnIndex(columnName)); } else if (fieldType.equals(double.class) || field.equals(Double.class)) { return cursor.getDouble(cursor.getColumnIndex(columnName)); } else if (fieldType.equals(long.class) || field.equals(Long.class)) { return cursor.getLong(cursor.getColumnIndex(columnName)); } else if (fieldType.equals(Date.class)) { long time = cursor.getLong(cursor.getColumnIndex(columnName)); Date date = new Date(time); return date; }/* w w w. j av a 2 s . com*/ return cursor.getString(cursor.getColumnIndex(columnName)); }
From source file:adalid.core.AbstractPersistentEntity.java
void setDiscriminatorField() { Field field = getAnnotations().get(DiscriminatorColumn.class); if (field != null) { Class<?> type = getDataType(); String fieldName = field.getName(); if (field.equals(getDiscriminatorField(fieldName, type))) { _discriminatorFieldName = fieldName; _discriminatorField = field; }/*ww w . j a v a 2 s. co m*/ } }
From source file:adalid.core.AbstractPersistentEntity.java
/** * @param properties/*from w w w .j av a2 s .c o m*/ * @return the properties that are columns */ // @Override public List<Property> getMatchingColumnsList(List<Property> properties) { List<Property> list = new ArrayList<>(); if (properties == null || properties.isEmpty()) { return list; } List<Property> columns = getColumnsList(); if (columns == null || columns.isEmpty()) { return list; } Field columnDeclaringField; for (Property column : columns) { columnDeclaringField = column.getDeclaringField(); if (columnDeclaringField != null) { for (Property property : properties) { if (columnDeclaringField.equals(property.getDeclaringField())) { list.add(column); } } } } return list; }
From source file:adalid.core.AbstractEntity.java
void setParentField() { Field field = getAnnotations().get(ParentProperty.class); if (field != null) { String fieldName = field.getName(); if (field.equals(getParentField(fieldName, field.getDeclaringClass()))) { _parentFieldName = fieldName; _parentField = field;/*from w w w .j a va 2 s . co m*/ } } }
From source file:adalid.core.AbstractEntity.java
void setNumericKeyField() { Field field = getAnnotations().get(NumericKey.class); if (field != null) { Class<?> type = getDataType(); String fieldName = field.getName(); if (field.equals(getNumericKeyField(fieldName, type))) { _numericKeyFieldName = fieldName; _numericKeyField = field;/*from ww w. ja v a2 s. c o m*/ } } }
From source file:adalid.core.AbstractEntity.java
void setUrlField() { Field field = getAnnotations().get(UrlProperty.class); if (field != null) { Class<?> type = getDataType(); String fieldName = field.getName(); if (field.equals(getUrlField(fieldName, type))) { _urlFieldName = fieldName;/*from ww w .jav a2s . c o m*/ _urlField = field; } } }
From source file:adalid.core.AbstractEntity.java
void setCharacterKeyField() { Field field = getAnnotations().get(CharacterKey.class); if (field != null) { Class<?> type = getDataType(); String fieldName = field.getName(); if (field.equals(getCharacterKeyField(fieldName, type))) { _characterKeyFieldName = fieldName; _characterKeyField = field;//from ww w. j a va 2s . c o m } } }
From source file:adalid.core.AbstractEntity.java
void setNameField() { Field field = getAnnotations().get(NameProperty.class); if (field != null) { Class<?> type = getDataType(); String fieldName = field.getName(); if (field.equals(getNameField(fieldName, type))) { _nameFieldName = fieldName;/* w w w . j ava 2s . com*/ _nameField = field; } } }
From source file:adalid.core.AbstractEntity.java
void setOwnerField() { Field field = getAnnotations().get(OwnerProperty.class); if (field != null) { Class<?> type = getDataType(); String fieldName = field.getName(); if (field.equals(getOwnerField(fieldName, type))) { _ownerFieldName = fieldName; _ownerField = field;/*from w w w .j a va2s . co m*/ } } }
From source file:adalid.core.AbstractEntity.java
void setVersionField() { Field field = getAnnotations().get(VersionProperty.class); if (field != null) { Class<?> type = getDataType(); String fieldName = field.getName(); if (field.equals(getVersionField(fieldName, type))) { _versionFieldName = fieldName; _versionField = field;// ww w. jav a2 s . c o m } } }