本文整理匯總了Java中java.lang.reflect.Field.equals方法的典型用法代碼示例。如果您正苦於以下問題:Java Field.equals方法的具體用法?Java Field.equals怎麽用?Java Field.equals使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類java.lang.reflect.Field
的用法示例。
在下文中一共展示了Field.equals方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: dealSinpleEntity
import java.lang.reflect.Field; //導入方法依賴的package包/類
/**
* 處理單個實體
*
* @param entity 實體對象
* @param list SinpleField的列表
* @param signField 簽名字段
*/
private static void dealSinpleEntity(Object entity, List<FieldPaired> list, Field signField,
SignatureAlgorithmic algorithmic, String saltParameterPrefix, String charset) {
Field[] fields = ArrayUtils.addAll(entity.getClass().getSuperclass().getDeclaredFields(),
entity.getClass().getDeclaredFields());
for (Field field : fields) {
if (field.equals(signField)) {
continue;
}
field.setAccessible(true);
try {
if (field.isAnnotationPresent(XmlElement.class)) {
Object value = field.get(entity);
if (value == null) {
continue;
}
list.add(new FieldPaired(field.getAnnotation(XmlElement.class).name(), value));
} else if (field.isAnnotationPresent(ApiRequestEntity.class)) {
Object nextEntity = field.get(entity);
dealSinpleEntity(nextEntity, list, signField, algorithmic, saltParameterPrefix, charset);
}
} catch (IllegalAccessException e) {
e.printStackTrace();
}
}
}
示例2: matchInheritance
import java.lang.reflect.Field; //導入方法依賴的package包/類
public static boolean matchInheritance(final Field subclassField, final Field superclassField) {
if (Modifier.isStatic(superclassField.getModifiers()) || subclassField.equals(superclassField)) {
return false;
}
final Package subclassPackage = superclassField.getDeclaringClass().getPackage();
final Package superclassPackage = superclassField.getDeclaringClass().getPackage();
final int superFieldModifiers = superclassField.getModifiers();
return isAccessable(subclassPackage, superclassPackage, superFieldModifiers);
}
示例3: getAllColumnsExceptPrimaryKey
import java.lang.reflect.Field; //導入方法依賴的package包/類
/**
* 獲取pojo除主鍵外的所有字段名
* <p>
* 列名為下劃線風格
* </p>
*
* @param clazz pojo類-class對象
* @return columnNames
*/
public static List<String> getAllColumnsExceptPrimaryKey(Class<?> clazz) {
List<String> columns = new ArrayList<String>();
Field primaryField = getPrimaryFieldNotCareNull(clazz);
Field[] fields = clazz.getDeclaredFields();
for (Field field : fields) {
if (primaryField != null && !field.equals(primaryField)) {
columns.add(StringUtil.camelToUnderline(field.getName()));
}
}
return columns;
}
示例4: compare
import java.lang.reflect.Field; //導入方法依賴的package包/類
public int compare(Field o1, Field o2)
{
if (o1.equals(o2))
{
return 0;
}
return ClassTypeHelper.isPrintableClass(o1.getType()) ? -1 : 1;
}
示例5: BaseHbaseDao
import java.lang.reflect.Field; //導入方法依賴的package包/類
public BaseHbaseDao(Class<?> type) throws NoSuchFieldException, SecurityException{
this.type = type;
HbaseTable table = type.getAnnotation(HbaseTable.class);
tableName = table.name();
rowKeyField = type.getDeclaredField(table.rowKey());
//初始化
couple_field_mapping = new HashMap<HbaseColCouple,Field>();
fieldName_couple_mapping = new HashMap<String,HbaseColCouple>();
fieldName_field_mapping = new HashMap<String,Field>();
positiveField = new ArrayList<Field>();
lazy_fieldName_field_mapping = new HashMap<String,Field>();
Field[] fields = type.getDeclaredFields();
for(Field field:fields){
//maping條件
//1:不是主鍵
if(!field.equals(rowKeyField)){
//2.1:有HbaseColumn注釋
HbaseColumn annotation = field.getAnnotation(HbaseColumn.class);
if(annotation!=null){
HbaseColCouple col = new HbaseColCouple(annotation.family(),
annotation.qualifier());
couple_field_mapping.put(col, field);
fieldName_couple_mapping.put(field.getName(), col);
fieldName_field_mapping.put(field.getName(), field);
}
//2.2:有HbaseOneToMany注釋
HbaseOneToMany oneToMany = field.getAnnotation(HbaseOneToMany.class);
if(oneToMany!=null){
if(oneToMany.lazy()){ //不主動加載
lazy_fieldName_field_mapping.put(field.getName(),field);
}else{ //主動加載
fieldName_field_mapping.put(field.getName(),field);
positiveField.add(field);
}
}
//2.3:有HbaseOneToOne注釋
HbaseOneToOne oneToOne = field.getAnnotation(HbaseOneToOne.class);
if(oneToOne!=null){
if(oneToOne.lazy()){ //不主動加載
lazy_fieldName_field_mapping.put(field.getName(),field);
}else{ //主動加載
fieldName_field_mapping.put(field.getName(),field);
positiveField.add(field);
}
}
}
}
}