1 30 package com.genimen.djeneric.repository.exceptions; 31 32 import java.util.ArrayList ; 33 34 import com.genimen.djeneric.repository.DjObject; 35 36 public class PropertyRequiredException extends PersistenceException 37 { 38 private static final long serialVersionUID = 3257852086459970873L; 39 ArrayList _properties = null; 40 41 public PropertyRequiredException(String s, DjObject objectConcerned, ArrayList properties) 42 { 43 super(s, objectConcerned); 44 _properties = properties; 45 } 46 47 public String [] getMissingProperties() 48 { 49 if (_properties == null) return new String []{"[Unknown]"}; 50 51 return (String []) _properties.toArray(new String [0]); 52 } 53 54 public String getMessage() 55 { 56 String result = super.getMessage() + " (" + getObjectConcerned().getExtent().getObjectType() + "): "; 57 String [] props = getMissingProperties(); 58 59 for (int i = 0; i < props.length; i++) 60 { 61 if (i != 0) result += ", "; 62 result += props[i]; 63 } 64 return result; 65 } 66 } | Popular Tags |