org.jboss.mx.util
Class ObjectNamePatternHelper

java.lang.Object
  extended byorg.jboss.mx.util.ObjectNamePatternHelper

public class ObjectNamePatternHelper
extends java.lang.Object

ObjectName pattern matching Helper.

Contains various routines for matching domains and properties.

Routines based on work done Trevor in the registry.


Nested Class Summary
static class ObjectNamePatternHelper.PropertyPattern (src)
          Encapsulation of property information
 
Constructor Summary
ObjectNamePatternHelper()
           
 
Method Summary
static boolean patternMatch(char[] test, int tpos, char[] pattern, int ppos)
          Compare where ? and * chars are significant.
static boolean patternMatch(ObjectName (src)  test, ObjectName (src)  pattern)
          Compare an object name against a pattern.
static boolean patternMatch(java.lang.String test, java.lang.String pattern)
          Compare strings where ? and * chars are significant.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ObjectNamePatternHelper

public ObjectNamePatternHelper()
Method Detail

patternMatch

public static boolean patternMatch(ObjectName (src)  test,
                                   ObjectName (src)  pattern)
Compare an object name against a pattern.

Parameters:
test - the string to test
pattern - the pattern to match

patternMatch

public static boolean patternMatch(java.lang.String test,
                                   java.lang.String pattern)
Compare strings where ? and * chars are significant.

Parameters:
test - the string to test
pattern - the pattern to match

patternMatch

public static boolean patternMatch(char[] test,
                                   int tpos,
                                   char[] pattern,
                                   int ppos)
Compare where ? and * chars are significant.

I arrived at this solution after quite a bit of trial and error - it's all a bit interwoven. Obviously I'm no good at parsers and there must be a clearer or more elegant way to do this. I'm suitably in awe of the perl regex hackers now.

Parameters:
test - the string to test
tpos - the start of the test string
pattern - the pattern to match
ppos - the start of the pattern string