This question already has an answer here:
- Java, set field value with reflection 4 answers
in My code, I want to an object from Field reflection. How to do it? Problematic code is in if statement
public class PersonelKatilimRaporDto {
String personelAdiSoyadi;
PersonelKatilimDto dayOf1;
PersonelKatilimDto dayOf2;
}
Class personelKatilimRaporDto = PersonelKatilimRaporDto.class;
Field[] attributes= personelKatilimRaporDto.getDeclaredFields();
for (Field attribute:attributes)
{
if( attribute.getType()==PersonelKatilimDto.class)
{
// attribute=new PersonelKatilimDto(katilimDurumu,startHour,finishHour);
}
Aucun commentaire:
Enregistrer un commentaire