org.codehaus.enunciate.contract.validation
Class DefaultValidator

java.lang.Object
  extended by org.codehaus.enunciate.contract.validation.BaseValidator
      extended by org.codehaus.enunciate.contract.validation.DefaultValidator
All Implemented Interfaces:
ConfigurableRules, Validator

public class DefaultValidator
extends BaseValidator
implements ConfigurableRules

Default validator.

Author:
Ryan Heaton

Constructor Summary
DefaultValidator()
           
 
Method Summary
 void disableRules(java.util.Set<java.lang.String> ruleIds)
          Disable the given set of rules.
protected  boolean isAssignable(com.sun.mirror.declaration.TypeDeclaration declaration1, com.sun.mirror.declaration.TypeDeclaration declaration2)
          Whether declaration1 is assignable to declaration2.
protected  boolean isConvertableToStringByJAXRS(com.sun.mirror.type.TypeMirror type)
          Whether the specified type is convertable from a String according to JAX-RS.
protected  boolean isString(com.sun.mirror.type.TypeMirror type)
          Whether the type is a string.
protected  boolean isSuppliableByJAXRS(com.sun.mirror.declaration.Declaration declaration)
          Whether the specified declaration is suppliable by JAX-RS.
protected  boolean isXmlTransient(com.sun.mirror.declaration.Declaration declaration)
          Whether a declaration is xml transient.
 ValidationResult validate(EnunciateFreemarkerModel model)
          Validate the model.
 ValidationResult validateAccessor(Accessor accessor)
           
 ValidationResult validateAttribute(Attribute attribute)
           
 ValidationResult validateComplexType(ComplexTypeDefinition complexType)
           
 ValidationResult validateElement(Element element)
           
 ValidationResult validateElementRef(ElementRef elementRef)
           
 ValidationResult validateEndpointImplementation(EndpointImplementation impl)
           
 ValidationResult validateEndpointInterface(EndpointInterface ei)
           
 ValidationResult validateEnumType(EnumTypeDefinition enumType)
           
 ValidationResult validatePackage(Schema schema)
           
 ValidationResult validateRootElement(RootElementDeclaration rootElementDeclaration)
           
 ValidationResult validateRootResources(java.util.List<RootResource> rootResources)
           
 ValidationResult validateSimpleType(SimpleTypeDefinition simpleType)
           
 ValidationResult validateTypeDefinition(TypeDefinition typeDef)
          Validation logic common to all type definitions.
 ValidationResult validateValue(Value value)
           
 ValidationResult validateWebMethod(WebMethod webMethod)
           
 ValidationResult validateXmlID(Accessor accessor)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DefaultValidator

public DefaultValidator()
Method Detail

disableRules

public void disableRules(java.util.Set<java.lang.String> ruleIds)
Description copied from interface: ConfigurableRules
Disable the given set of rules.

Specified by:
disableRules in interface ConfigurableRules
Parameters:
ruleIds - The ids of the rules to disable.

validate

public ValidationResult validate(EnunciateFreemarkerModel model)
Description copied from interface: Validator
Validate the model.

Specified by:
validate in interface Validator
Overrides:
validate in class BaseValidator
Parameters:
model - The model to validate.
Returns:
The validation result.

validateEndpointInterface

public ValidationResult validateEndpointInterface(EndpointInterface ei)
Overrides:
validateEndpointInterface in class BaseValidator
Returns:
An empty result.

validateEndpointImplementation

public ValidationResult validateEndpointImplementation(EndpointImplementation impl)

isAssignable

protected boolean isAssignable(com.sun.mirror.declaration.TypeDeclaration declaration1,
                               com.sun.mirror.declaration.TypeDeclaration declaration2)
Whether declaration1 is assignable to declaration2.

Parameters:
declaration1 - the first declaration.
declaration2 - the second declaration.
Returns:
Whether declaration1 is assignable to declaration2.

validateRootResources

public ValidationResult validateRootResources(java.util.List<RootResource> rootResources)
Overrides:
validateRootResources in class BaseValidator
Returns:
An empty result.

isConvertableToStringByJAXRS

protected boolean isConvertableToStringByJAXRS(com.sun.mirror.type.TypeMirror type)
Whether the specified type is convertable from a String according to JAX-RS.

Parameters:
type - The type.
Returns:
Whether it's convertable.

isString

protected boolean isString(com.sun.mirror.type.TypeMirror type)
Whether the type is a string.

Parameters:
type - The type.
Returns:
Whether the type is a string.

isSuppliableByJAXRS

protected boolean isSuppliableByJAXRS(com.sun.mirror.declaration.Declaration declaration)
Whether the specified declaration is suppliable by JAX-RS.

Parameters:
declaration - The declaration.
Returns:
Whether the specified declaration is suppliable by JAX-RS.

validateWebMethod

public ValidationResult validateWebMethod(WebMethod webMethod)

validateComplexType

public ValidationResult validateComplexType(ComplexTypeDefinition complexType)
Overrides:
validateComplexType in class BaseValidator
Returns:
An empty result.

validateSimpleType

public ValidationResult validateSimpleType(SimpleTypeDefinition simpleType)
Overrides:
validateSimpleType in class BaseValidator
Returns:
An empty result.

validateEnumType

public ValidationResult validateEnumType(EnumTypeDefinition enumType)
Overrides:
validateEnumType in class BaseValidator
Returns:
An empty result.

validateTypeDefinition

public ValidationResult validateTypeDefinition(TypeDefinition typeDef)
Validation logic common to all type definitions.

Parameters:
typeDef - The type definition to validate.
Returns:
The validation result.

validateRootElement

public ValidationResult validateRootElement(RootElementDeclaration rootElementDeclaration)
Overrides:
validateRootElement in class BaseValidator
Returns:
An empty result.

isXmlTransient

protected boolean isXmlTransient(com.sun.mirror.declaration.Declaration declaration)
Whether a declaration is xml transient.

Parameters:
declaration - The declaration on which to determine xml transience.
Returns:
Whether a declaration is xml transient.

validatePackage

public ValidationResult validatePackage(Schema schema)

validateAttribute

public ValidationResult validateAttribute(Attribute attribute)

validateElement

public ValidationResult validateElement(Element element)

validateValue

public ValidationResult validateValue(Value value)

validateElementRef

public ValidationResult validateElementRef(ElementRef elementRef)

validateAccessor

public ValidationResult validateAccessor(Accessor accessor)

validateXmlID

public ValidationResult validateXmlID(Accessor accessor)