com.arsdigita.formbuilder.ui
Class ClassValidationListener

java.lang.Object
  extended bycom.arsdigita.formbuilder.ui.ClassValidationListener
All Implemented Interfaces:
EventListener, ParameterListener

public class ClassValidationListener
extends Object
implements ParameterListener

Validates that the parameter submitted is the fully qualified class name of a class that can be loaded. Can also be supplied with a class object and will then additionally check that the submitted class is assignable from the class we are verifying against (see Class.isAssignableFrom(Class), this is useful for checking that the submitted class implements a certain interface or extends a certain class). This validation listener requires that invoking toString() on the value object submitted will yield the fully qualified class name (you may for example use a StringParameter which is the default of most widgets).

Version:
$Id: //core-platform/dev/src/com/arsdigita/formbuilder/ui/ClassValidationListener.java#7 $
Author:
Peter Marklund

Field Summary
static String versionId
           
 
Constructor Summary
ClassValidationListener()
          With this constructor it will only be checked that the submitted class can be loaded.
ClassValidationListener(Class assignableClass)
          Use this constructor to check that the submitted class can be loaded and that it is assignable from the class that is supplied to this constructor.
 
Method Summary
 void validate(ParameterEvent parameterEvent)
          Performs a validation check on the data objects associated with a specific parameter.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

versionId

public static final String versionId
See Also:
Constant Field Values
Constructor Detail

ClassValidationListener

public ClassValidationListener()
With this constructor it will only be checked that the submitted class can be loaded.


ClassValidationListener

public ClassValidationListener(Class assignableClass)
Use this constructor to check that the submitted class can be loaded and that it is assignable from the class that is supplied to this constructor. For example, if you wanted to check that the user-supplied class name belongs to a class that is serializable you would supply the java.io.Serializable class to this constructor.

Method Detail

validate

public void validate(ParameterEvent parameterEvent)
Description copied from interface: ParameterListener
Performs a validation check on the data objects associated with a specific parameter. Validate should call ParameterData.addError() with a message regarding the nature of the error.

Specified by:
validate in interface ParameterListener


Copyright (c) 2004 Red Hat, Inc. Corporation. All Rights Reserved. Generated at July 20 2004:2337 UTC