1 18 19 package org.apache.activemq.filter; 20 21 import org.apache.activemq.command.ActiveMQDestination; 22 23 24 29 public class PrefixDestinationFilter extends DestinationFilter { 30 31 private String [] prefixes; 32 33 38 public PrefixDestinationFilter(String [] prefixes) { 39 this.prefixes = prefixes; 40 } 41 42 public boolean matches(ActiveMQDestination destination) { 43 String [] path = DestinationPath.getDestinationPaths(destination.getPhysicalName()); 44 int length = prefixes.length; 45 if (path.length >= length) { 46 for (int i = 0, size = length - 1; i < size; i++) { 47 if (!prefixes[i].equals(path[i])) { 48 return false; 49 } 50 } 51 return true; 52 } 53 return false; 54 } 55 56 public String getText() { 57 return DestinationPath.toString(prefixes); 58 } 59 60 public String toString() { 61 return super.toString() + "[destination: " + getText() + "]"; 62 } 63 64 public boolean isWildcard() { 65 return true; 66 } 67 } 68 | Popular Tags |