/** * Get all matching DNS entries from the table. * * @param name * @param type * @param recordClass * @return list of entries */ public Collection<? extends DNSEntry> getDNSEntryList(String name, DNSRecordType type, DNSRecordClass recordClass) { Collection<? extends DNSEntry> entryList = this._getDNSEntryList(name); if (entryList != null) { synchronized (entryList) { entryList = new ArrayList<DNSEntry>(entryList); for (Iterator<? extends DNSEntry> i = entryList.iterator(); i.hasNext();) { DNSEntry testDNSEntry = i.next(); if (!testDNSEntry.matchRecordType(type) || (!testDNSEntry.matchRecordClass(recordClass))) { i.remove(); } } } } else { entryList = Collections.emptyList(); } return entryList; }
/** * Get a matching DNS entry from the table. * * @param name * @param type * @param recordClass * @return DNSEntry */ public DNSEntry getDNSEntry(String name, DNSRecordType type, DNSRecordClass recordClass) { DNSEntry result = null; Collection<? extends DNSEntry> entryList = this._getDNSEntryList(name); if (entryList != null) { synchronized (entryList) { for (DNSEntry testDNSEntry : entryList) { if (testDNSEntry.matchRecordType(type) && testDNSEntry.matchRecordClass(recordClass)) { result = testDNSEntry; break; } } } } return result; }
/** * Check if two entries have exactly the same name, type, and class. * * @param entry * @return <code>true</code> if the two entries have are for the same record, <code>false</code> otherwise */ public boolean isSameEntry(DNSEntry entry) { return this.getKey().equals(entry.getKey()) && this.matchRecordType(entry.getRecordType()) && this.matchRecordClass(entry.getRecordClass()); }