Example usage for javax.persistence InheritanceType toString

List of usage examples for javax.persistence InheritanceType toString

Introduction

In this page you can find the example usage for javax.persistence InheritanceType toString.

Prototype

public String toString() 

Source Link

Document

Returns a string representation of the object.

Usage

From source file:org.castor.cpa.jpa.processors.classprocessors.JPAInheritanceProcessor.java

/**
 * {@inheritDoc}/* w ww  . ja va2s.c  o  m*/
 * 
 * @see org.castor.core.annotationprocessing.TargetAwareAnnotationProcessor#
 *      processAnnotation(BaseNature, Annotation, AnnotatedElement)
 */
public <I extends BaseNature, A extends Annotation> boolean processAnnotation(final I info, final A annotation,
        final AnnotatedElement target) throws AnnotationTargetException {

    if ((info instanceof JPAClassNature) && (annotation instanceof Inheritance) && (target instanceof Class<?>)
            && (target.isAnnotationPresent(Inheritance.class))) {
        LOG.debug("Processing class annotation " + annotation.toString());

        JPAClassNature jpaClassNature = (JPAClassNature) info;
        Inheritance inheritance = (Inheritance) annotation;
        InheritanceType strategy = inheritance.strategy();

        if (strategy != InheritanceType.JOINED) {
            throw new AnnotationTargetException("InheritanceType not supported: " + strategy.toString());
        }

        jpaClassNature.setInheritanceStrategy(strategy);
        return true;
    }

    return false;
}