Java EE 5 SDK

com.sun.appserv.web.cache.mapping
Class ConstraintField

java.lang.Object
  extended by com.sun.appserv.web.cache.mapping.Field
      extended by com.sun.appserv.web.cache.mapping.ConstraintField

public class ConstraintField
extends Field

ConstraintField class represents a single Field and constraints on its values; Field name and its scope are inherited from the Field class.


Field Summary
 
Fields inherited from class com.sun.appserv.web.cache.mapping.Field
name, scope
 
Constructor Summary
ConstraintField(String name, String scope)
          create a new cache field, given a string representation of the scope
 
Method Summary
 void addConstraint(ValueConstraint constraint)
          add a constraint for this field
 boolean applyConstraints(ServletContext context, HttpServletRequest request)
          apply the constraints on the value of the field in the given request.
 boolean getCacheOnMatch()
           
 boolean getCacheOnMatchFailure()
           
 void setCacheOnMatch(boolean cacheOnMatch)
          set whether to cache should the constraints check pass
 void setCacheOnMatchFailure(boolean cacheOnMatchFailure)
          set whether to cache should there be a failure forcing the constraint
 void setValueConstraints(ValueConstraint[] vcs)
          add an array of constraints for this field
 
Methods inherited from class com.sun.appserv.web.cache.mapping.Field
getName, getScope, getValue, setName, setScope
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ConstraintField

public ConstraintField(String name,
                       String scope)
                throws IllegalArgumentException
create a new cache field, given a string representation of the scope

Parameters:
name - name of this field
scope - scope of this field
Throws:
IllegalArgumentException
Method Detail

setCacheOnMatch

public void setCacheOnMatch(boolean cacheOnMatch)
set whether to cache should the constraints check pass

Parameters:
cacheOnMatch - should the constraint check pass, should we cache?

getCacheOnMatch

public boolean getCacheOnMatch()
Returns:
cache-on-match setting

setCacheOnMatchFailure

public void setCacheOnMatchFailure(boolean cacheOnMatchFailure)
set whether to cache should there be a failure forcing the constraint

Parameters:
cacheOnMatchFailure - should there be a constraint check failure, enable cache?

getCacheOnMatchFailure

public boolean getCacheOnMatchFailure()
Returns:
cache-on-match-failure setting

addConstraint

public void addConstraint(ValueConstraint constraint)
add a constraint for this field

Parameters:
constraint - one constraint associated with this field

setValueConstraints

public void setValueConstraints(ValueConstraint[] vcs)
add an array of constraints for this field

Parameters:
vcs - constraints associated with this field

applyConstraints

public boolean applyConstraints(ServletContext context,
                                HttpServletRequest request)
apply the constraints on the value of the field in the given request. return a true if all the constraints pass; false when the field is not found or the field value doesn't pass the caching constraints.


Java EE 5 SDK

Submit a bug or feature

Copyright 2006 Sun Microsystems, Inc. All rights reserved.