private String getParamName(AnnotationData annotationData) { if (annotationData == null) return null; final Object value = annotationData.getValues().get("value"); if (value == null) { return null; } return value.toString(); }
final String name = responseHeaderAnnotation.getValues().get("name").toString(); final String value = responseHeaderAnnotation.getValues().get("value").toString(); responseHeadersMap = new MultiMapImpl<>(); responseHeadersMap.add(name, value); responseHeadersMap = new MultiMapImpl<>(); final Object[] values = (Object[]) responseHeadersAnnotation.getValues().get("value"); AnnotationData annotationData = new AnnotationData((Annotation) object); final String name = annotationData.getValues().get("name").toString(); final String value = annotationData.getValues().get("value").toString(); responseHeadersMap.add(name, value);
public ConstructorAccessImpl( Constructor<T> method ) { this.constructor = method; this.constructor.setAccessible(true); this.annotationData = Annotations.getAnnotationDataForMethod(method); annotationMap = new ConcurrentHashMap<>( ); for (AnnotationData data : annotationData) { annotationMap.put( data.getName(), data ); annotationMap.put( data.getSimpleClassName(), data ); annotationMap.put( data.getFullClassName(), data ); } }
annotationMap.put ( data.getSimpleClassName (), data.getValues () ); annotationMap.put ( data.getFullClassName (), data.getValues () ); String[] props = (String [])jsonIgnoreProperties.getValues().get( "value" ); if (props!=null) { for (String prop : props) {
final Object defaultValue = getDefaultValue(annotationData, paramType, parameterType); switch (annotationData.getName()) { case "requestParam": param = new RequestParam(required, paramName, defaultValue, description);
/** * Create an annotation data list. * * @param annotations list of annotation. * @param allowedPackages allowed packages * @return list of annotation data */ public static List<AnnotationData> extractValidationAnnotationData( Annotation[] annotations, Set<String> allowedPackages ) { List<AnnotationData> annotationsList = new ArrayList<>(); for ( Annotation annotation : annotations ) { AnnotationData annotationData = new AnnotationData( annotation, allowedPackages ); if ( annotationData.isAllowed() ) { annotationsList.add( annotationData ); } } return annotationsList; }
public AnnotationData( Annotation annotation, Set<String> allowedAnnotations ) { this.annotationSimpleName = annotation.annotationType().getSimpleName (); this.annotationClassName = annotation.annotationType().getName (); this.annotationPackageName = annotationClassName.substring ( 0, annotationClassName.length () - annotationSimpleName.length () - 1 ); this.allowedAnnotations = allowedAnnotations; this.name = uncapitalize( annotationSimpleName ); this.values = doGetValues(annotation); }
public ConstructorAccessImpl( Constructor<T> method ) { this.constructor = method; this.constructor.setAccessible(true); this.annotationData = Annotations.getAnnotationDataForMethod(method); annotationMap = new ConcurrentHashMap<>( ); for (AnnotationData data : annotationData) { annotationMap.put( data.getName(), data ); annotationMap.put( data.getSimpleClassName(), data ); annotationMap.put( data.getFullClassName(), data ); } }
annotationMap.put ( data.getSimpleClassName (), data.getValues () ); annotationMap.put ( data.getFullClassName (), data.getValues () ); String[] props = (String [])jsonIgnoreProperties.getValues().get( "value" ); if (props!=null) { for (String prop : props) {
if (requestMapping != null && requestMapping.getName().equals("bridge")) { requestPaths.add("/" + methodAccess.name().toLowerCase());
/** * Create an annotation data list. * * @param annotations list of annotation. * @param allowedPackages allowed packages * @return list of annotation data */ public static List<AnnotationData> extractValidationAnnotationData( Annotation[] annotations, Set<String> allowedPackages ) { List<AnnotationData> annotationsList = new ArrayList<>(); for ( Annotation annotation : annotations ) { AnnotationData annotationData = new AnnotationData( annotation, allowedPackages ); if ( annotationData.isAllowed() ) { annotationsList.add( annotationData ); } } return annotationsList; }
public AnnotationData( Annotation annotation, Set<String> allowedAnnotations ) { this.annotationSimpleName = annotation.annotationType().getSimpleName (); this.annotationClassName = annotation.annotationType().getName (); this.annotationPackageName = annotationClassName.substring ( 0, annotationClassName.length () - annotationSimpleName.length () - 1 ); this.allowedAnnotations = allowedAnnotations; this.name = uncapitalize( annotationSimpleName ); this.values = doGetValues(annotation); }
private String getParamDescription(AnnotationData annotationData) { if (annotationData == null) return null; final Object value = annotationData.getValues().get("description"); if (value == null) { return null; } return value.toString(); }
final String name = responseHeaderAnnotation.getValues().get("name").toString(); final String value = responseHeaderAnnotation.getValues().get("value").toString(); responseHeadersMap = new MultiMapImpl<>(); final Object[] values = (Object[]) responseHeadersAnnotation.getValues().get("value"); AnnotationData annotationData = new AnnotationData((Annotation) object); final String name = annotationData.getValues().get("name").toString(); final String value = annotationData.getValues().get("value").toString(); responseHeadersMap.add(name, value); final Object noCache1 = getAnnotation.getValues().get("noCache"); if (Conversions.toBoolean(noCache1)) { if (responseHeadersMap.size() == 0) {
public static Map<String, AnnotationData> getAnnotationDataForClassAsMap( Class<?> clazz ) { final Map<Class<?>, Map<String, AnnotationData>> cache = context ().annotationDataCacheClassAsMap; Map<String, AnnotationData> map = cache.get(clazz); if (map == null) { final List<AnnotationData> list = getAnnotationDataForClass ( clazz ); if (list.size () == 0) { map = Collections.EMPTY_MAP; } else { map = new ConcurrentHashMap<> ( list.size () ); for (AnnotationData data : list) { map.put ( data.getFullClassName (), data ); map.put ( data.getSimpleClassName (), data); map.put ( data.getName (), data); } } cache.put ( clazz, map ); } return map; }
public static Collection<AnnotationData> getAnnotationDataForFieldAndProperty( Class<?> clazz, String propertyName, Set<String> allowedPackages ) { /* Extract the AnnotationData from the Java annotation. */ List<AnnotationData> propertyAnnotationDataList = getAnnotationDataForProperty( clazz, propertyName, false, allowedPackages ); /* Read the field annotation. */ List<AnnotationData> fieldAnnotationDataList = getAnnotationDataForField( clazz, propertyName, allowedPackages ); /* Combine the annotation from field and properties. Field validations take precedence over property validations. */ Map<String, AnnotationData> map = new HashMap<String, AnnotationData>( propertyAnnotationDataList.size() + fieldAnnotationDataList.size() ); /* Add the property annotation to the map. */ for ( AnnotationData annotationData : propertyAnnotationDataList ) { map.put( annotationData.getName(), annotationData ); } /* Add the field annotation to the map allowing them to override the property annotation. */ for ( AnnotationData annotationData : fieldAnnotationDataList ) { map.put( annotationData.getName(), annotationData ); } return map.values(); }
private Boolean getRequired(AnnotationData annotationData) { if (annotationData == null) return false; final Object value = annotationData.getValues().get("required"); if (value == null) { return false; } return value instanceof Boolean ? ((Boolean) value) : Boolean.valueOf(value.toString()); } }
final String name = responseHeaderAnnotation.getValues().get("name").toString(); final String value = responseHeaderAnnotation.getValues().get("value").toString(); responseHeadersMap = new MultiMapImpl<>(); responseHeadersMap.add(name, value); responseHeadersMap = new MultiMapImpl<>(); final Object[] values = (Object[]) responseHeadersAnnotation.getValues().get("value"); AnnotationData annotationData = new AnnotationData((Annotation) object); final String name = annotationData.getValues().get("name").toString(); final String value = annotationData.getValues().get("value").toString(); responseHeadersMap.add(name, value);
public static Map<String, AnnotationData> getAnnotationDataForClassAsMap( Class<?> clazz ) { final Map<Class<?>, Map<String, AnnotationData>> cache = context ().annotationDataCacheClassAsMap; Map<String, AnnotationData> map = cache.get(clazz); if (map == null) { final List<AnnotationData> list = getAnnotationDataForClass ( clazz ); if (list.size () == 0) { map = Collections.EMPTY_MAP; } else { map = new ConcurrentHashMap<> ( list.size () ); for (AnnotationData data : list) { map.put ( data.getFullClassName (), data ); map.put ( data.getSimpleClassName (), data); map.put ( data.getName (), data); } } cache.put ( clazz, map ); } return map; }
public static Collection<AnnotationData> getAnnotationDataForFieldAndProperty( Class<?> clazz, String propertyName, Set<String> allowedPackages ) { /* Extract the AnnotationData from the Java annotation. */ List<AnnotationData> propertyAnnotationDataList = getAnnotationDataForProperty( clazz, propertyName, false, allowedPackages ); /* Read the field annotation. */ List<AnnotationData> fieldAnnotationDataList = getAnnotationDataForField( clazz, propertyName, allowedPackages ); /* Combine the annotation from field and properties. Field validations take precedence over property validations. */ Map<String, AnnotationData> map = new HashMap<String, AnnotationData>( propertyAnnotationDataList.size() + fieldAnnotationDataList.size() ); /* Add the property annotation to the map. */ for ( AnnotationData annotationData : propertyAnnotationDataList ) { map.put( annotationData.getName(), annotationData ); } /* Add the field annotation to the map allowing them to override the property annotation. */ for ( AnnotationData annotationData : fieldAnnotationDataList ) { map.put( annotationData.getName(), annotationData ); } return map.values(); }