@Override protected String getName(Property annotation) { return annotation.name(); }
public PropertyInjectable(Property propertyAnnotation, ParamType paramType, Class<?> type, Type genericType, Annotation[] annotations, Member member) { super(paramType, type, genericType, annotations, member); this.name = getPropertyName(propertyAnnotation.name(), member); }
public PropertyInjectable(Property propertyAnnotation, ParamType paramType, Class<?> type, Type genericType, Annotation[] annotations, Member member) { super(paramType, type, genericType, annotations, member); this.name = getPropertyName(propertyAnnotation.name(), member); }
public void doWith(Field field) { Property annotation = (Property)field.getAnnotation(getPropertyAnnotationType()); if (annotation != null) { if (Modifier.isStatic(field.getModifiers())) { throw new IllegalStateException("Property annotation is not supported on static fields"); } /* if (Modifier.isPrivate(field.getModifiers())) { throw new IllegalStateException("Property annotation is not supported on private fields"); } */ ReflectionUtils.makeAccessible(field); Object propertyObj = null; String propName = annotation.name(); if ("".equals(propName)) { propertyObj = propertyValue.getPropertyObj(field.getType(), field.getName()); } else { propertyObj = propertyValue.getPropertyObj(field.getType(), propName); } if (propertyObj != null) ReflectionUtils.setField(field, bean, propertyObj); } } });
public void doWith(Method method) { Property annotation = (Property)method.getAnnotation(getPropertyAnnotationType()); if (annotation != null) { if (Modifier.isStatic(method.getModifiers())) { throw new IllegalStateException("Property annotation is not supported on static methods"); } /* if (Modifier.isPrivate(method.getModifiers())) { throw new IllegalStateException("Property annotation is not supported on private methods"); } */ if (method.getParameterTypes().length == 0) { throw new IllegalStateException("Property annotation requires at least one argument: " + method); } PropertyDescriptor pd = BeanUtils.findPropertyForMethod(method); if (pd != null) { String propName = annotation.name(); if ("".equals(propName)) { injectProperty(bean, pd, propertyValue.getPropertyObj(pd.getPropertyType(), pd.getName())); } else { injectProperty(bean, pd, propertyValue.getPropertyObj(pd.getPropertyType(), propName)); } } } } });
} else if (field.isAnnotationPresent(Property.class)) { Property prop = field.getAnnotation(Property.class); String name = prop.name() != null && !prop.name().equals("") ? prop.name() : field.getName(); Object value = getProperty(name, sc); setField(instance, field, value); } else if (method.isAnnotationPresent(Property.class)) { Property prop = method.getAnnotation(Property.class); String name = prop.name() != null && !prop.name().equals("") ? prop.name() : targetName; Object value = getProperty(name, sc); setMethod(instance, method, value);
} else if (field.isAnnotationPresent(Property.class)) { Property prop = field.getAnnotation(Property.class); String name = prop.name() != null && !prop.name().equals("") ? prop.name() : field.getName(); Object value = getProperty(name, sc); setField(instance, field, value); } else if (method.isAnnotationPresent(Property.class)) { Property prop = method.getAnnotation(Property.class); String name = prop.name() != null && !prop.name().equals("") ? prop.name() : targetName; Object value = getProperty(name, sc); setMethod(instance, method, value);
if (pannot instanceof Property) { Property prop = ((Property)(pannot)); String propname = prop.name(); props.put(propname ,ptype);
if (pannot instanceof org.oasisopen.sca.annotation.Property) { org.oasisopen.sca.annotation.Property prop = ((org.oasisopen.sca.annotation.Property) (pannot)); java.lang.String propname = prop.name(); props.put(propname, ptype);
if( pannot instanceof Property ) { Property propannot = (Property) pannot; String name = propannot.name(); initnames.add(name);
if( pannot instanceof Property ) { Property prop = (Property) pannot; String propname = prop.name(); props.put(propname,ptype);
public void visitField(org.oasisopen.sca.annotation.Property annotation, Field field, Class<?> implClass, InjectingComponentType componentType, IntrospectionContext context) { validate(annotation, field, componentType, context); String name = helper.getSiteName(field, annotation.name()); Type type = field.getGenericType(); FieldInjectionSite site = new FieldInjectionSite(field); TypeMapping typeMapping = context.getTypeMapping(implClass); boolean required = annotation.required(); Property property = createDefinition(name, required, type, typeMapping); processSource(field,field.getDeclaringClass(), property, context); componentType.add(property, site); }
public void visitConstructorParameter(org.oasisopen.sca.annotation.Property annotation, Constructor<?> constructor, int index, Class<?> implClass, InjectingComponentType componentType, IntrospectionContext context) { String name = helper.getSiteName(constructor, index, annotation.name()); Type type = helper.getGenericType(constructor, index); ConstructorInjectionSite site = new ConstructorInjectionSite(constructor, index); TypeMapping typeMapping = context.getTypeMapping(implClass); boolean required = annotation.required(); Property property = createDefinition(name, required, type, typeMapping); Class<?> paramType = constructor.getParameterTypes()[index]; Class<?> declaringClass = constructor.getDeclaringClass(); processSource(paramType, declaringClass, property, context); componentType.add(property, site); }
public void visitField(org.oasisopen.sca.annotation.Property annotation, Field field, Class<?> implClass, InjectingComponentType componentType, IntrospectionContext context) { validate(annotation, field, componentType, context); String name = helper.getSiteName(field, annotation.name()); Type type = field.getGenericType(); FieldInjectionSite site = new FieldInjectionSite(field); TypeMapping typeMapping = context.getTypeMapping(implClass); boolean required = annotation.required(); Property property = createDefinition(name, required, type, typeMapping); componentType.add(property, site); }
public void visitConstructorParameter(org.oasisopen.sca.annotation.Property annotation, Constructor<?> constructor, int index, Class<?> implClass, InjectingComponentType componentType, IntrospectionContext context) { String name = helper.getSiteName(constructor, index, annotation.name()); Type type = helper.getGenericType(constructor, index); ConstructorInjectionSite site = new ConstructorInjectionSite(constructor, index); TypeMapping typeMapping = context.getTypeMapping(implClass); boolean required = annotation.required(); Property property = createDefinition(name, required, type, typeMapping); componentType.add(property, site); }
public void visitMethod(org.oasisopen.sca.annotation.Property annotation, Method method, Class<?> implClass, InjectingComponentType componentType, IntrospectionContext context) { boolean result = validate(annotation, method, componentType, context); if (!result) { return; } String name = helper.getSiteName(method, annotation.name()); Type type = helper.getGenericType(method); MethodInjectionSite site = new MethodInjectionSite(method, 0); TypeMapping typeMapping = context.getTypeMapping(implClass); boolean required = annotation.required(); Property property = createDefinition(name, required, type, typeMapping); processSource(method, method.getDeclaringClass(), property, context); componentType.add(property, site); }
public void visitMethod(org.oasisopen.sca.annotation.Property annotation, Method method, Class<?> implClass, InjectingComponentType componentType, IntrospectionContext context) { boolean result = validate(annotation, method, componentType, context); if (!result) { return; } String name = helper.getSiteName(method, annotation.name()); Type type = helper.getGenericType(method); MethodInjectionSite site = new MethodInjectionSite(method, 0); TypeMapping typeMapping = context.getTypeMapping(implClass); boolean required = annotation.required(); Property property = createDefinition(name, required, type, typeMapping); componentType.add(property, site); }