Java

Field static 유무

자바초보자 2015. 10. 30. 15:48
728x90
			Field[] fields = obj.getClass().getDeclaredFields();
			String fieldName = "";
			for(Field fl : fields){
				fieldName = fl.getName();
				
				//static이 아니고 Transient 사용 안한 필드만
				if( !Modifier.isStatic(fl.getModifiers()) && 
						fl.getAnnotation(Transient.class) == null && 
						!bcols.contains(fieldName) ){
					cols.add(fieldName);
				}
			}
728x90