spki
Class Tag

java.lang.Object
  |
  +--spki.BaseObj
        |
        +--spki.Tag

public class Tag
extends BaseObj

spki Tag class.

Formal definitions:

 <tag-star>:: "(*)" ;
 <tag-expr>:: <tag-star> | <s-expr> ;
 <tag>:: "(" "tag" <tag-expr>? ")" ;
 

Version:
$Id: Tag.java,v 1.10 2002/06/23 19:09:43 tep Exp $
Author:
Tep Narula <tep@win.trlabs.ca>

Field Summary
private static String __ME
          This class's full name.
private  boolean is_wildcard
          Is this a wildcard tag?
static String SEXP_NAME
          This class S-Expression type name, used by toSExpression() and other methods.
private  SList tag_expr
          This object's tag-expression, maybe null for empty tag.
static String TAG_STAR
          The universal wild-card tag-expression, which will intersect with any tag-expression.
 
Fields inherited from class spki.BaseObj
__ME, cache_sexp, cached_sexp, DEFAULT_HASH_ALG, locked, SEXP_NAME
 
Constructor Summary
Tag()
          Create an immutable empty Tag object with no tag-expression.
Tag(SExpression sexp)
          Create an immutable Tag object from an S-Expression.
Tag(SList tag_expr)
          Create an immutable Tag object with the given tag-expression.
 
Method Summary
 SList getTagExpr()
          Get the tag-expression, if available.
 boolean isEmptyTag()
          Is this an empty tag?
 boolean isWildcardTag()
          Is this a wildcard tag?
private  void setTagExpr(SList tag_expr)
          Store the tag-expression.
 SExpression toSExpression()
          Build an SExpression representing this object.
 
Methods inherited from class spki.BaseObj
disableSExpressionCaching, enableSExpressionCaching, extractHashAlgId, getCachedSExpression, isLocked, isSListOfType, lock, providerToSPKI, setCachedSExpression, spkiToProvider, toString
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, wait, wait, wait
 

Field Detail

__ME

private static final String __ME
This class's full name.

SEXP_NAME

public static final String SEXP_NAME
This class S-Expression type name, used by toSExpression() and other methods.
See Also:
toSExpression()

TAG_STAR

public static final String TAG_STAR
The universal wild-card tag-expression, which will intersect with any tag-expression.

is_wildcard

private boolean is_wildcard
Is this a wildcard tag?
See Also:
isWildcardTag()

tag_expr

private SList tag_expr
This object's tag-expression, maybe null for empty tag.
See Also:
getTagExpr(), setTagExpr(SList)
Constructor Detail

Tag

public Tag()
Create an immutable empty Tag object with no tag-expression.
See Also:
Tag(SExpression), Tag(SList)

Tag

public Tag(SExpression sexp)
    throws SPKIException,
           ParseException
Create an immutable Tag object from an S-Expression. IMPORTANT: Beware of argument type confusion between this constructor and Tag(SList) constructor. To be safe, explicitly cast the argument into SExpression when constructing a Tag object from an S-Expression-encoded authorization tag.
See Also:
Tag(SList), BaseObj.BaseObj(SExpression)

Tag

public Tag(SList tag_expr)
    throws SPKIException
Create an immutable Tag object with the given tag-expression. IMPORTANT: Beware of argument-type confusion between this constructor and the Tag(SExpression) constructor. To be safe, explicityly cast the argument into SList when constructing a Tag object from a tag-expression. Also, passing (SList) null as the argument is not the same as passing no argument, which will invoke the default constructor to create an empty tag.
Parameters:
tag_expr - the tag-expression to be stored, or null to create a wildcard tag.
Throws:
SPKIException - if something went wrong.
See Also:
Tag(SExpression), Tag()
Method Detail

toSExpression

public SExpression toSExpression()
                          throws SPKIException
Description copied from interface: SPKIObject
Build an SExpression representing this object.
Overrides:
toSExpression in class BaseObj
Tags copied from interface: SPKIObject
Returns:
SExpression object representing this object, or null.
Throws:
SPKIException - if something went wrong during conversion.

getTagExpr

public SList getTagExpr()
                 throws SPKIException
Get the tag-expression, if available.
Returns:
SList object containing tag-expression, or null.
Throws:
SPKIException - if something went wrong.

isWildcardTag

public boolean isWildcardTag()
Is this a wildcard tag?
Returns:
true if this is a wildcard tag, false otherwise.
See Also:
TAG_STAR

isEmptyTag

public boolean isEmptyTag()
Is this an empty tag?
Returns:
true if this is an empty tag, false otherwise.

setTagExpr

private void setTagExpr(SList tag_expr)
                 throws IllegalStateException,
                        SPKIException
Store the tag-expression.
Parameters:
tag_expr - the tag-expression to store.
Throws:
IllegalStateException - if the object is immutable.
SPKIException - if something went wrong.