Package ch.nerdin.generators.testdata.inspector

Source Code of ch.nerdin.generators.testdata.inspector.JpaInspector

package ch.nerdin.generators.testdata.inspector;

import java.lang.annotation.Annotation;
import javax.persistence.Column;
import javax.persistence.Lob;
import ch.nerdin.generators.testdata.framework.FieldProperty;

/**
*
*/
public class JpaInspector extends AbstractInspector {

    @Override
    void createFieldProperties(String fieldName, Annotation annotation) {
        FieldProperty property = fieldContext.getFieldProperty(fieldName);
        Class<? extends Annotation> annotationType = annotation.annotationType();

        if (annotationType.equals(Column.class)) {
            Column column = (Column) annotation;
            property.setMaxLength(column.length());
            property.setMinLength(column.length());
        }
       
        if (annotationType.equals(Lob.class)) {
            property.setLob(true);
        }
    }
}
TOP

Related Classes of ch.nerdin.generators.testdata.inspector.JpaInspector

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.