Package org.crank.core

Examples of org.crank.core.AnnotationData


     
        boolean found = map.get( columnType ) != null;

        if (found) {
                /* If the column annotation data was found, see if the length flag was set. */
                AnnotationData ad =  map.get( columnType );
                Object object = ad.getValues().get("nullable");
                /* If the nullable flag was set, return its value. */
                if (object != null) {
                    Boolean bool = (Boolean) object;
                    return !bool.booleanValue();
                } else {
View Full Code Here


      boolean result = false;
     
        boolean found = map.get( columnType ) != null;

        if (found) {
                AnnotationData ad = map.get( columnType );
                Object object = ad.getValues().get("optional");
                /* If the optional flag was set, return its value. */
                if (object != null) {
                    Boolean bool = (Boolean) object;
                    return !bool.booleanValue();
                } else {
View Full Code Here

            boolean found = map.get( "column" ) != null;
            /* If you found an annotation called required, return true. */
            if (found) {
                    /* If the column annotation data was found, see if the length flag was set. */
                    AnnotationData ad = (AnnotationData) map.get( "column" );
                    Object object = ad.getValues().get("length");
                    /* If the nullable flag was set, return its value. */
                    if (object != null) {
                        Integer length = (Integer) object;
                        return length.intValue() > 80;
            } else {
View Full Code Here

            List<AnnotationData> extractValidationAnnotationData = AnnotationUtils.extractValidationAnnotationData((Annotation[]) values, allowedPackages);

            for (AnnotationData ad : extractValidationAnnotationData) {
                if (propertyName.equals(ad.getValues().get("name"))) {
                    if (ad.getValues().get("column") != null) {
                        ad = new AnnotationData((Annotation) ad.getValues().get("column"), allowedPackages);
                        Object object = ad.getValues().get("length");
                        if (object != null) {
                            found = true;
                            Integer length = (Integer) object;
                            return length.intValue();
                        }
                    }
                }
            }
        }

        map = getAnnotationDataAsMap( clazz, propertyName );
       
        found = map.get( "column" ) != null;
        /* If you found an annotation called required, return true. */
        if (found) {
                /*
         * If the column annotation data was found, see if the length
         * flag was set.
         */
                AnnotationData ad = (AnnotationData) map.get( "column" );
                Object object = ad.getValues().get("length");
                /* If the nullable flag was set, return its value. */
                if (object != null) {
                    Integer length = (Integer) object;
                    return length.intValue();
                }
View Full Code Here

        return isManyToOne(clazz, getParentProperty(propertyName));
    }

    public static boolean isManyToOneOptional(Class<?> clazz, String propertyName) {
        Map<String, AnnotationData> map = getAnnotationDataAsMap( clazz, propertyName );
        AnnotationData data = map.get( "manyToOne" );
        if (data != null) {
          Boolean optional = (Boolean) data.getValues().get("optional");
          if (optional == null) {
            return false;
          } else {
            return optional;
          }
View Full Code Here

   
    @SuppressWarnings("unchecked")
    public static String getPropertyEntityName(Class clazz, String propertyName) {
        PropertyDescriptor descriptor = getPropertyDescriptor( clazz, propertyName);

        AnnotationData data = (AnnotationData)MapUtils.convertListToMap( "name",
                AnnotationUtils.getAnnotationDataForClass( descriptor.getPropertyType(), allowedPackages )).get( "entity" );
        if (data != null) {
            String entityName = (String) data.getValues().get( "name");
            if (entityName != null && entityName.trim().length() > 0){
                return (String) data.getValues().get( "name");
            }
        }
        return descriptor.getPropertyType().getSimpleName();
    }
View Full Code Here

    }

  }

    public static boolean isEntity (Class<?> clazz) {
        AnnotationData data = (AnnotationData)MapUtils.convertListToMap( "name",
                AnnotationUtils.getAnnotationDataForClass( clazz, allowedPackages )).get( "entity" );
        return data != null;
    }
View Full Code Here

                AnnotationUtils.getAnnotationDataForClass( clazz, allowedPackages )).get( "entity" );
        return data != null;
    }

    public static boolean isEmbeddable (Class<?> clazz) {
        AnnotationData data = (AnnotationData)MapUtils.convertListToMap( "name",
                AnnotationUtils.getAnnotationDataForClass( clazz, allowedPackages )).get( "embeddable" );
        return data != null;
    }
View Full Code Here

                AnnotationUtils.getAnnotationDataForClass( clazz, allowedPackages )).get( "embeddable" );
        return data != null;
    }

    public static String getClassEntityName(Class<?> clazz) {
        AnnotationData data = (AnnotationData)MapUtils.convertListToMap( "name",
                AnnotationUtils.getAnnotationDataForClass( clazz, allowedPackages )).get( "entity" );
        if (data != null) {
            String entityName = (String) data.getValues().get( "name");
            if (entityName != null && entityName.trim().length() > 0){
                return (String) data.getValues().get( "name");
            }
        }
        return clazz.getSimpleName();
    }
View Full Code Here

        boolean found = map.get( "domainValidation" ) != null;
        boolean sameLevel = false;
        boolean noArgs = false;

        if (found) {
            AnnotationData ad = (AnnotationData) map.get( "domainValidation" );
            Object parentReference = ad.getValues().get("parentProperty");
            Object validator = null;

            if ((parentReference != null) && (!"".equals(parentReference))) {
                // If the parentProperty is specified, then find the parent class
             
                BeanWrapper wrapper = new BeanWrapperImpl(child);
                validator = wrapper.getPropertyValue( (String)parentReference );

            } else {
              // Otherwise, the validation method is assumed to be in the child
              validator = child;
              sameLevel = true;
            }
           
            noArgs = (Boolean) ad.getValues().get("global");
           
            // Make sure the method exists
          Method m = null;

          if (validator != null) {
              try {
               
                String methodName = (String)ad.getValues().get("method");

                if (noArgs) {
                    m = validator.getClass().getDeclaredMethod(methodName);
                } else if (sameLevel) {
                    Class[] parameters=new Class[1];
View Full Code Here

TOP

Related Classes of org.crank.core.AnnotationData

Copyright © 2018 www.massapicom. 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.