@Override public Object getValue(RuntimeContext runtimeContext) throws IOException { return ContextHelper.getProperty(name, runtimeContext.getAttribute(ServletContext.class)); }
@Override public Object getValue(RuntimeContext runtimeContext) throws IOException { return ContextHelper.getReference(referenceName, (Class<?>)getGenericType(), runtimeContext.getAttribute(ServletContext.class)); }
Reference ref = field.getAnnotation(Reference.class); String name = ref.name() != null && !ref.name().equals("") ? ref.name() : field.getName(); Object value = getReference(name, field.getType(), sc); setField(instance, field, 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 (field.isAnnotationPresent(ComponentName.class)) { RuntimeComponent rc = (RuntimeComponent)sc.getAttribute(COMPONENT_ATTR); setField(instance, field, rc.getName()); } else if (field.isAnnotationPresent(Context.class)) { setField(instance, field, getComponentContext(sc)); Reference ref = method.getAnnotation(Reference.class); String name = ref.name() != null && !ref.name().equals("") ? ref.name() : targetName; Object value = getReference(name, type, sc); setMethod(instance, method, 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 (method.isAnnotationPresent(ComponentName.class)) { RuntimeComponent rc = (RuntimeComponent)sc.getAttribute(COMPONENT_ATTR); setMethod(instance, method, rc.getName()); } else if (method.isAnnotationPresent(Context.class)) { setMethod(instance, method, getComponentContext(sc));
public static <T> T getReference(String name, Class<T> type, ServletContext sc) { ServiceReference<T> sr = getComponentContext(sc).getServiceReference(type, name); if (sr == null) { throw new ServiceRuntimeException("Reference '" + name + "' undefined"); } return sr.getService(); }
Reference ref = field.getAnnotation(Reference.class); String name = ref.name() != null && !ref.name().equals("") ? ref.name() : field.getName(); Object value = getReference(name, field.getType(), sc); setField(instance, field, 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 (field.isAnnotationPresent(ComponentName.class)) { RuntimeComponent rc = (RuntimeComponent)sc.getAttribute(COMPONENT_ATTR); setField(instance, field, rc.getName()); } else if (field.isAnnotationPresent(Context.class)) { setField(instance, field, getComponentContext(sc)); Reference ref = method.getAnnotation(Reference.class); String name = ref.name() != null && !ref.name().equals("") ? ref.name() : targetName; Object value = getReference(name, type, sc); setMethod(instance, method, 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 (method.isAnnotationPresent(ComponentName.class)) { RuntimeComponent rc = (RuntimeComponent)sc.getAttribute(COMPONENT_ATTR); setMethod(instance, method, rc.getName()); } else if (method.isAnnotationPresent(Context.class)) { setMethod(instance, method, getComponentContext(sc));
public static <T> T getReference(String name, Class<T> type, ServletContext sc) { ServiceReference<T> sr = getComponentContext(sc).getServiceReference(type, name); if (sr == null) { throw new ServiceRuntimeException("Reference '" + name + "' undefined"); } return sr.getService(); }
@Override public Object getValue(RuntimeContext runtimeContext) throws IOException { return ContextHelper.getReference(referenceName, (Class<?>)getGenericType(), runtimeContext.getAttribute(ServletContext.class)); }
@Override public Object getValue(RuntimeContext runtimeContext) throws IOException { return ContextHelper.getProperty(name, runtimeContext.getAttribute(ServletContext.class)); }
boolean allowFindByType) { Object bean = ContextHelper.getReference(name, type, ctx); if (bean == null) { throw new StripesRuntimeException("no reference defined:" + name);