org.apache.openjpa.example.gallery.constraint
Class ImageContentValidator

java.lang.Object
  extended by org.apache.openjpa.example.gallery.constraint.ImageContentValidator
All Implemented Interfaces:
ConstraintValidator<ImageContent,byte[]>

public class ImageContentValidator
extends Object
implements ConstraintValidator<ImageContent,byte[]>

Simple check that file format is of a supported type


Constructor Summary
ImageContentValidator()
           
 
Method Summary
 void initialize(ImageContent constraint)
          Configure the constraint validator based on the image types it should support.
 boolean isValid(byte[] value, ConstraintValidatorContext context)
          Validate a specified value.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ImageContentValidator

public ImageContentValidator()
Method Detail

initialize

public void initialize(ImageContent constraint)
Configure the constraint validator based on the image types it should support.

Specified by:
initialize in interface ConstraintValidator<ImageContent,byte[]>
Parameters:
constraint - the constraint definition

isValid

public boolean isValid(byte[] value,
                       ConstraintValidatorContext context)
Validate a specified value.

Specified by:
isValid in interface ConstraintValidator<ImageContent,byte[]>


Copyright © 2006-2013 Apache Software Foundation. All Rights Reserved.