com.sun.comm
Class Alias

java.lang.Object
  extended bycom.sun.comm.Alias

class Alias
extends java.lang.Object

This class is used to faciliate alias wildcarding. Given a String name, this method detects trailing digits. If they exist, the alias is assumed to be a wildcard alias. The base name is seperated from the digits. The matchesWildcard method can be used to compare the alias to a user specified name which is presumed to have no digits. It can thus be used to test match for both wildcarded and non-wildcarded aliases.

Since:
3.0.0
Author:
Paul Klissner

Field Summary
private  java.lang.String basename
           
private  java.lang.String original
           
private  java.lang.String unitNbr
           
 
Constructor Summary
Alias(java.lang.String name)
          Sole constructor.
 
Method Summary
 java.lang.String appendAliasUnitNbr(java.lang.String wild)
          Given a wildcard name, append the digits from the name provided to the constructor.
 java.lang.String getBasename()
          Get basename stripped of any trailing digits.
 java.lang.String getOriginal()
          Get original logical name provided to constructor.
 int getUnitNbr()
          Get the unit number portion of the name initially provided, if any.
 boolean matchesWildcard(java.lang.String name)
          Determine whether the name provided satisfies a wildcard match of the name provided.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

unitNbr

private java.lang.String unitNbr

basename

private java.lang.String basename

original

private java.lang.String original
Constructor Detail

Alias

public Alias(java.lang.String name)
Sole constructor.

Parameters:
name - A logical name to treat as an alias
Method Detail

getOriginal

public java.lang.String getOriginal()
Get original logical name provided to constructor.

Returns:
original name

getBasename

public java.lang.String getBasename()
Get basename stripped of any trailing digits. This is the wildcard matching portion of the logical name.

Returns:
basename

matchesWildcard

public boolean matchesWildcard(java.lang.String name)
Determine whether the name provided satisfies a wildcard match of the name provided.

Parameters:
name - Name to match to this object.
Returns:
true if match

getUnitNbr

public int getUnitNbr()
Get the unit number portion of the name initially provided, if any.

Returns:
unit number

appendAliasUnitNbr

public java.lang.String appendAliasUnitNbr(java.lang.String wild)
Given a wildcard name, append the digits from the name provided to the constructor.

Parameters:
wild - Name to have unit number appended to.
Returns:
reflected target name