Java 类org.springframework.beans.annotation.AnnotationBeanUtils 实例源码

项目:lams    文件:AnnotationJmxAttributeSource.java   
@Override
public ManagedOperationParameter[] getManagedOperationParameters(Method method)
        throws InvalidMetadataException {

    ManagedOperationParameters params = AnnotationUtils.findAnnotation(method, ManagedOperationParameters.class);
    ManagedOperationParameter[] result = null;
    if (params == null) {
        result = new ManagedOperationParameter[0];
    }
    else {
        Annotation[] paramData = params.value();
        result = new ManagedOperationParameter[paramData.length];
        for (int i = 0; i < paramData.length; i++) {
            Annotation annotation = paramData[i];
            ManagedOperationParameter managedOperationParameter = new ManagedOperationParameter();
            AnnotationBeanUtils.copyPropertiesToBean(annotation, managedOperationParameter);
            result[i] = managedOperationParameter;
        }
    }
    return result;
}
项目:lams    文件:AnnotationJmxAttributeSource.java   
@Override
public ManagedNotification[] getManagedNotifications(Class<?> clazz) throws InvalidMetadataException {
    ManagedNotifications notificationsAnn = clazz.getAnnotation(ManagedNotifications.class);
    if(notificationsAnn == null) {
        return new ManagedNotification[0];
    }
    Annotation[] notifications = notificationsAnn.value();
    ManagedNotification[] result = new ManagedNotification[notifications.length];
    for (int i = 0; i < notifications.length; i++) {
        Annotation notification = notifications[i];
        ManagedNotification managedNotification = new ManagedNotification();
        AnnotationBeanUtils.copyPropertiesToBean(notification, managedNotification);
        result[i] = managedNotification;
    }
    return result;
}
项目:my-spring-cache-redis    文件:AnnotationJmxAttributeSource.java   
@Override
public ManagedOperationParameter[] getManagedOperationParameters(Method method)
        throws InvalidMetadataException {

    ManagedOperationParameters params = AnnotationUtils.findAnnotation(method, ManagedOperationParameters.class);
    ManagedOperationParameter[] result = null;
    if (params == null) {
        result = new ManagedOperationParameter[0];
    }
    else {
        Annotation[] paramData = params.value();
        result = new ManagedOperationParameter[paramData.length];
        for (int i = 0; i < paramData.length; i++) {
            Annotation annotation = paramData[i];
            ManagedOperationParameter managedOperationParameter = new ManagedOperationParameter();
            AnnotationBeanUtils.copyPropertiesToBean(annotation, managedOperationParameter);
            result[i] = managedOperationParameter;
        }
    }
    return result;
}
项目:my-spring-cache-redis    文件:AnnotationJmxAttributeSource.java   
@Override
public ManagedNotification[] getManagedNotifications(Class<?> clazz) throws InvalidMetadataException {
    ManagedNotifications notificationsAnn = clazz.getAnnotation(ManagedNotifications.class);
    if(notificationsAnn == null) {
        return new ManagedNotification[0];
    }
    Annotation[] notifications = notificationsAnn.value();
    ManagedNotification[] result = new ManagedNotification[notifications.length];
    for (int i = 0; i < notifications.length; i++) {
        Annotation notification = notifications[i];
        ManagedNotification managedNotification = new ManagedNotification();
        AnnotationBeanUtils.copyPropertiesToBean(notification, managedNotification);
        result[i] = managedNotification;
    }
    return result;
}
项目:class-guard    文件:AnnotationJmxAttributeSource.java   
public ManagedOperationParameter[] getManagedOperationParameters(Method method)
        throws InvalidMetadataException {

    ManagedOperationParameters params = AnnotationUtils.findAnnotation(method, ManagedOperationParameters.class);
    ManagedOperationParameter[] result = null;
    if (params == null) {
        result = new ManagedOperationParameter[0];
    }
    else {
        Annotation[] paramData = params.value();
        result = new ManagedOperationParameter[paramData.length];
        for (int i = 0; i < paramData.length; i++) {
            Annotation annotation = paramData[i];
            ManagedOperationParameter managedOperationParameter = new ManagedOperationParameter();
            AnnotationBeanUtils.copyPropertiesToBean(annotation, managedOperationParameter);
            result[i] = managedOperationParameter;
        }
    }
    return result;
}
项目:lams    文件:AnnotationJmxAttributeSource.java   
@Override
public ManagedAttribute getManagedAttribute(Method method) throws InvalidMetadataException {
    org.springframework.jmx.export.annotation.ManagedAttribute ann =
            AnnotationUtils.findAnnotation(method, org.springframework.jmx.export.annotation.ManagedAttribute.class);
    if (ann == null) {
        return null;
    }
    ManagedAttribute managedAttribute = new ManagedAttribute();
    AnnotationBeanUtils.copyPropertiesToBean(ann, managedAttribute, "defaultValue");
    if (ann.defaultValue().length() > 0) {
        managedAttribute.setDefaultValue(ann.defaultValue());
    }
    return managedAttribute;
}
项目:lams    文件:AnnotationJmxAttributeSource.java   
@Override
public ManagedMetric getManagedMetric(Method method) throws InvalidMetadataException {
    org.springframework.jmx.export.annotation.ManagedMetric ann =
            AnnotationUtils.findAnnotation(method, org.springframework.jmx.export.annotation.ManagedMetric.class);
    if (ann == null) {
        return null;
    }
    ManagedMetric managedMetric = new ManagedMetric();
    AnnotationBeanUtils.copyPropertiesToBean(ann, managedMetric);
    return managedMetric;
}
项目:lams    文件:AnnotationJmxAttributeSource.java   
@Override
public ManagedOperation getManagedOperation(Method method) throws InvalidMetadataException {
    Annotation ann = AnnotationUtils.findAnnotation(method, org.springframework.jmx.export.annotation.ManagedOperation.class);
    if (ann == null) {
        return null;
    }
    ManagedOperation op = new ManagedOperation();
    AnnotationBeanUtils.copyPropertiesToBean(ann, op);
    return op;
}
项目:spring4-understanding    文件:AnnotationJmxAttributeSource.java   
@Override
public org.springframework.jmx.export.metadata.ManagedResource getManagedResource(Class<?> beanClass) throws InvalidMetadataException {
    ManagedResource ann = AnnotationUtils.findAnnotation(beanClass, ManagedResource.class);
    if (ann == null) {
        return null;
    }
    org.springframework.jmx.export.metadata.ManagedResource managedResource = new org.springframework.jmx.export.metadata.ManagedResource();
    AnnotationBeanUtils.copyPropertiesToBean(ann, managedResource, this.embeddedValueResolver);
    return managedResource;
}
项目:spring4-understanding    文件:AnnotationJmxAttributeSource.java   
@Override
public org.springframework.jmx.export.metadata.ManagedAttribute getManagedAttribute(Method method) throws InvalidMetadataException {
    ManagedAttribute ann = AnnotationUtils.findAnnotation(method, ManagedAttribute.class);
    if (ann == null) {
        return null;
    }
    org.springframework.jmx.export.metadata.ManagedAttribute managedAttribute = new org.springframework.jmx.export.metadata.ManagedAttribute();
    AnnotationBeanUtils.copyPropertiesToBean(ann, managedAttribute, "defaultValue");
    if (ann.defaultValue().length() > 0) {
        managedAttribute.setDefaultValue(ann.defaultValue());
    }
    return managedAttribute;
}
项目:spring4-understanding    文件:AnnotationJmxAttributeSource.java   
private static <T> T copyPropertiesToBean(Annotation ann, Class<T> beanClass) {
    if (ann == null) {
        return null;
    }
    T bean = BeanUtils.instantiate(beanClass);
    AnnotationBeanUtils.copyPropertiesToBean(ann, bean);
    return bean;
}
项目:my-spring-cache-redis    文件:AnnotationJmxAttributeSource.java   
@Override
public ManagedAttribute getManagedAttribute(Method method) throws InvalidMetadataException {
    org.springframework.jmx.export.annotation.ManagedAttribute ann =
            AnnotationUtils.findAnnotation(method, org.springframework.jmx.export.annotation.ManagedAttribute.class);
    if (ann == null) {
        return null;
    }
    ManagedAttribute managedAttribute = new ManagedAttribute();
    AnnotationBeanUtils.copyPropertiesToBean(ann, managedAttribute, "defaultValue");
    if (ann.defaultValue().length() > 0) {
        managedAttribute.setDefaultValue(ann.defaultValue());
    }
    return managedAttribute;
}
项目:my-spring-cache-redis    文件:AnnotationJmxAttributeSource.java   
@Override
public ManagedMetric getManagedMetric(Method method) throws InvalidMetadataException {
    org.springframework.jmx.export.annotation.ManagedMetric ann =
            AnnotationUtils.findAnnotation(method, org.springframework.jmx.export.annotation.ManagedMetric.class);
    if (ann == null) {
        return null;
    }
    ManagedMetric managedMetric = new ManagedMetric();
    AnnotationBeanUtils.copyPropertiesToBean(ann, managedMetric);
    return managedMetric;
}
项目:my-spring-cache-redis    文件:AnnotationJmxAttributeSource.java   
@Override
public ManagedOperation getManagedOperation(Method method) throws InvalidMetadataException {
    Annotation ann = AnnotationUtils.findAnnotation(method, org.springframework.jmx.export.annotation.ManagedOperation.class);
    if (ann == null) {
        return null;
    }
    ManagedOperation op = new ManagedOperation();
    AnnotationBeanUtils.copyPropertiesToBean(ann, op);
    return op;
}
项目:spring    文件:AnnotationJmxAttributeSource.java   
@Override
public org.springframework.jmx.export.metadata.ManagedResource getManagedResource(Class<?> beanClass) throws InvalidMetadataException {
    ManagedResource ann = AnnotationUtils.findAnnotation(beanClass, ManagedResource.class);
    if (ann == null) {
        return null;
    }
    Class<?> declaringClass = AnnotationUtils.findAnnotationDeclaringClass(ManagedResource.class, beanClass);
    Class<?> target = (declaringClass != null && !declaringClass.isInterface() ? declaringClass : beanClass);
    if (!Modifier.isPublic(target.getModifiers())) {
        throw new InvalidMetadataException("@ManagedResource class '" + target.getName() + "' must be public");
    }
    org.springframework.jmx.export.metadata.ManagedResource managedResource = new org.springframework.jmx.export.metadata.ManagedResource();
    AnnotationBeanUtils.copyPropertiesToBean(ann, managedResource, this.embeddedValueResolver);
    return managedResource;
}
项目:spring    文件:AnnotationJmxAttributeSource.java   
@Override
public org.springframework.jmx.export.metadata.ManagedAttribute getManagedAttribute(Method method) throws InvalidMetadataException {
    ManagedAttribute ann = AnnotationUtils.findAnnotation(method, ManagedAttribute.class);
    if (ann == null) {
        return null;
    }
    org.springframework.jmx.export.metadata.ManagedAttribute managedAttribute = new org.springframework.jmx.export.metadata.ManagedAttribute();
    AnnotationBeanUtils.copyPropertiesToBean(ann, managedAttribute, "defaultValue");
    if (ann.defaultValue().length() > 0) {
        managedAttribute.setDefaultValue(ann.defaultValue());
    }
    return managedAttribute;
}
项目:spring    文件:AnnotationJmxAttributeSource.java   
private static <T> T copyPropertiesToBean(Annotation ann, Class<T> beanClass) {
    if (ann == null) {
        return null;
    }
    T bean = BeanUtils.instantiate(beanClass);
    AnnotationBeanUtils.copyPropertiesToBean(ann, bean);
    return bean;
}
项目:class-guard    文件:AnnotationJmxAttributeSource.java   
public ManagedAttribute getManagedAttribute(Method method) throws InvalidMetadataException {
    org.springframework.jmx.export.annotation.ManagedAttribute ann =
            AnnotationUtils.findAnnotation(method, org.springframework.jmx.export.annotation.ManagedAttribute.class);
    if (ann == null) {
        return null;
    }
    ManagedAttribute managedAttribute = new ManagedAttribute();
    AnnotationBeanUtils.copyPropertiesToBean(ann, managedAttribute, "defaultValue");
    if (ann.defaultValue().length() > 0) {
        managedAttribute.setDefaultValue(ann.defaultValue());
    }
    return managedAttribute;
}
项目:class-guard    文件:AnnotationJmxAttributeSource.java   
public ManagedMetric getManagedMetric(Method method) throws InvalidMetadataException {
    org.springframework.jmx.export.annotation.ManagedMetric ann =
            AnnotationUtils.findAnnotation(method, org.springframework.jmx.export.annotation.ManagedMetric.class);
    if (ann == null) {
        return null;
    }
    ManagedMetric managedMetric = new ManagedMetric();
    AnnotationBeanUtils.copyPropertiesToBean(ann, managedMetric);
    return managedMetric;
}
项目:class-guard    文件:AnnotationJmxAttributeSource.java   
public ManagedOperation getManagedOperation(Method method) throws InvalidMetadataException {
    Annotation ann = AnnotationUtils.findAnnotation(method, org.springframework.jmx.export.annotation.ManagedOperation.class);
    if (ann == null) {
        return null;
    }
    ManagedOperation op = new ManagedOperation();
    AnnotationBeanUtils.copyPropertiesToBean(ann, op);
    return op;
}
项目:class-guard    文件:AnnotationJmxAttributeSource.java   
public ManagedNotification[] getManagedNotifications(Class<?> clazz) throws InvalidMetadataException {
    ManagedNotifications notificationsAnn = clazz.getAnnotation(ManagedNotifications.class);
    if(notificationsAnn == null) {
        return new ManagedNotification[0];
    }
    Annotation[] notifications = notificationsAnn.value();
    ManagedNotification[] result = new ManagedNotification[notifications.length];
    for (int i = 0; i < notifications.length; i++) {
        Annotation notification = notifications[i];
        ManagedNotification managedNotification = new ManagedNotification();
        AnnotationBeanUtils.copyPropertiesToBean(notification, managedNotification);
        result[i] = managedNotification;
    }
    return result;
}