@Override public Object resolve(Injectee injectee, ServiceHandle<?> root) { Type requiredType = injectee.getRequiredType(); boolean isHk2Factory = ReflectionHelper.isSubClassOf(requiredType, Factory.class); Injectee newInjectee; if (isHk2Factory) { newInjectee = getFactoryInjectee(injectee, ReflectionHelper.getTypeArgument(requiredType, 0)); } else { newInjectee = foreignRequestScopedInjecteeCache.apply(new CacheKey(injectee)); } ActiveDescriptor<?> ad = descriptorCache.apply(new CacheKey(newInjectee)); if (ad != null) { final ServiceHandle handle = serviceLocator.getServiceHandle(ad, newInjectee); if (isHk2Factory) { return asFactory(handle); } else { return handle.getService(); } } return null; }
@Override public Object resolve(Injectee injectee, ServiceHandle<?> root) { Type requiredType = injectee.getRequiredType(); boolean isHk2Factory = ReflectionHelper.isSubClassOf(requiredType, Factory.class); Injectee newInjectee; if (isHk2Factory) { newInjectee = getFactoryInjectee(injectee, ReflectionHelper.getTypeArgument(requiredType, 0)); } else { newInjectee = foreignRequestScopedInjecteeCache.apply(new CacheKey(injectee)); } ActiveDescriptor<?> ad = descriptorCache.apply(new CacheKey(newInjectee)); if (ad != null) { final ServiceHandle handle = serviceLocator.getServiceHandle(ad, newInjectee); if (isHk2Factory) { return asFactory(handle); } else { return handle.getService(); } } return null; }
@Override public Object resolve(Injectee injectee, ServiceHandle root) { InjecteeImpl injecteeWrapper = new InjecteeImpl(); injecteeWrapper.setRequiredType(injectee.getRequiredType()); injecteeWrapper.setParent(injectee.getParent()); injecteeWrapper.setRequiredQualifiers(injectee.getRequiredQualifiers()); injecteeWrapper.setOptional(injectee.isOptional()); injecteeWrapper.setPosition(injectee.getPosition()); injecteeWrapper.setFactory(ReflectionHelper.isSubClassOf(injectee.getRequiredType(), Factory.class)); injecteeWrapper.setInjecteeDescriptor(new ForeignDescriptorImpl(injectee.getInjecteeDescriptor())); Object instance = jerseyResolver.resolve(injecteeWrapper); if (injecteeWrapper.isFactory()) { return asFactory(instance); } else { return instance; } }
@Override public Object resolve(Injectee injectee, ServiceHandle root) { InjecteeImpl injecteeWrapper = new InjecteeImpl(); injecteeWrapper.setRequiredType(injectee.getRequiredType()); injecteeWrapper.setParent(injectee.getParent()); injecteeWrapper.setRequiredQualifiers(injectee.getRequiredQualifiers()); injecteeWrapper.setOptional(injectee.isOptional()); injecteeWrapper.setPosition(injectee.getPosition()); injecteeWrapper.setFactory(ReflectionHelper.isSubClassOf(injectee.getRequiredType(), Factory.class)); injecteeWrapper.setInjecteeDescriptor(new ForeignDescriptorImpl(injectee.getInjecteeDescriptor())); Object instance = jerseyResolver.resolve(injecteeWrapper); if (injecteeWrapper.isFactory()) { return asFactory(instance); } else { return instance; } }
Type type = injectee.getRequiredType(); if (value instanceof String) { if (ReflectionHelper.isSubClassOf(type, Integer.class)) { return Ints.tryParse((String) value); } else if (ReflectionHelper.isSubClassOf(type, int.class)) { Integer v = Ints.tryParse((String) value); return v == null ? -1 : v; } else if (ReflectionHelper.isSubClassOf(type, Long.class)) { return Longs.tryParse((String) value); } else if (ReflectionHelper.isSubClassOf(type, long.class)) { Long v = Longs.tryParse((String) value); return v == null ? -1 : v; } else if (ReflectionHelper.isSubClassOf(type, Double.class)) { return Doubles.tryParse((String) value); } else if (ReflectionHelper.isSubClassOf(type, double.class)) { Double v = Doubles.tryParse((String) value); return v == null ? -1 : v; } else if (ReflectionHelper.isSubClassOf(type, Float.class)) { return Floats.tryParse((String) value); } else if (ReflectionHelper.isSubClassOf(type, float.class)) { Float v = Floats.tryParse((String) value); return v == null ? -1 : v; } else if (ReflectionHelper.isSubClassOf(type, Boolean.class) || ReflectionHelper.isSubClassOf(type, boolean.class)) { return Boolean.parseBoolean((String) value);
boolean isHk2Factory = ReflectionHelper.isSubClassOf(genericType, Factory.class);
boolean isHk2Factory = ReflectionHelper.isSubClassOf(genericType, Factory.class);
boolean isHk2Factory = ReflectionHelper.isSubClassOf(genericType, Factory.class);
@Override public Object resolve(Injectee injectee, ServiceHandle<?> root) { Type requiredType = injectee.getRequiredType(); boolean isHk2Factory = ReflectionHelper.isSubClassOf(requiredType, Factory.class); Injectee newInjectee; if (isHk2Factory) { newInjectee = getFactoryInjectee(injectee, ReflectionHelper.getTypeArgument(requiredType, 0)); } else { newInjectee = foreignRequestScopedInjecteeCache.compute(injectee); } ActiveDescriptor<?> ad = descriptorCache.compute(newInjectee); if (ad != null) { final ServiceHandle handle = serviceLocator.getServiceHandle(ad, newInjectee); if (isHk2Factory) { return asFactory(handle); } else { return handle.getService(); } } return null; }
@Override public Object resolve(Injectee injectee, ServiceHandle<?> root) { Type requiredType = injectee.getRequiredType(); boolean isHk2Factory = ReflectionHelper.isSubClassOf(requiredType, Factory.class); Injectee newInjectee; if (isHk2Factory) { newInjectee = getFactoryInjectee(injectee, ReflectionHelper.getTypeArgument(requiredType, 0)); } else { newInjectee = foreignRequestScopedInjecteeCache.compute(injectee); } ActiveDescriptor<?> ad = descriptorCache.compute(newInjectee); if (ad != null) { final ServiceHandle handle = serviceLocator.getServiceHandle(ad, newInjectee); if (isHk2Factory) { return asFactory(handle); } else { return handle.getService(); } } return null; }
@Override public Object resolve(Injectee injectee, ServiceHandle<?> root) { Type requiredType = injectee.getRequiredType(); boolean isHk2Factory = ReflectionHelper.isSubClassOf(requiredType, Factory.class); Injectee newInjectee; if (isHk2Factory) { newInjectee = getFactoryInjectee(injectee, ReflectionHelper.getTypeArgument(requiredType, 0)); } else { newInjectee = foreignRequestScopedInjecteeCache.compute(injectee); } ActiveDescriptor<?> ad = descriptorCache.compute(newInjectee); if (ad != null) { final ServiceHandle handle = serviceLocator.getServiceHandle(ad, newInjectee); if (isHk2Factory) { return asFactory(handle); } else { return handle.getService(); } } return null; }
@Override public Object resolve(Injectee injectee, ServiceHandle<?> root) { Type requiredType = injectee.getRequiredType(); boolean isHk2Factory = ReflectionHelper.isSubClassOf(requiredType, Factory.class); Injectee newInjectee; if (isHk2Factory) { newInjectee = getFactoryInjectee(injectee, ReflectionHelper.getTypeArgument(requiredType, 0)); } else { newInjectee = foreignRequestScopedInjecteeCache.apply(new CacheKey(injectee)); } ActiveDescriptor<?> ad = descriptorCache.apply(new CacheKey(newInjectee)); if (ad != null) { final ServiceHandle handle = serviceLocator.getServiceHandle(ad, newInjectee); if (isHk2Factory) { return asFactory(handle); } else { return handle.getService(); } } return null; }
@Override public Object resolve(Injectee injectee, ServiceHandle<?> root) { Type requiredType = injectee.getRequiredType(); boolean isHk2Factory = ReflectionHelper.isSubClassOf(requiredType, Factory.class); Injectee newInjectee; if (isHk2Factory) { newInjectee = getFactoryInjectee(injectee, ReflectionHelper.getTypeArgument(requiredType, 0)); } else { newInjectee = foreignRequestScopedInjecteeCache.apply(new CacheKey(injectee)); } ActiveDescriptor<?> ad = descriptorCache.apply(new CacheKey(newInjectee)); if (ad != null) { final ServiceHandle handle = serviceLocator.getServiceHandle(ad, newInjectee); if (isHk2Factory) { return asFactory(handle); } else { return handle.getService(); } } return null; }
@Override public Object resolve(Injectee injectee, ServiceHandle root) { InjecteeImpl injecteeWrapper = new InjecteeImpl(); injecteeWrapper.setRequiredType(injectee.getRequiredType()); injecteeWrapper.setParent(injectee.getParent()); injecteeWrapper.setRequiredQualifiers(injectee.getRequiredQualifiers()); injecteeWrapper.setOptional(injectee.isOptional()); injecteeWrapper.setPosition(injectee.getPosition()); injecteeWrapper.setFactory(ReflectionHelper.isSubClassOf(injectee.getRequiredType(), Factory.class)); injecteeWrapper.setInjecteeDescriptor(new ForeignDescriptorImpl(injectee.getInjecteeDescriptor())); Object instance = jerseyResolver.resolve(injecteeWrapper); if (injecteeWrapper.isFactory()) { return asFactory(instance); } else { return instance; } }
@Override public Object resolve(Injectee injectee, ServiceHandle root) { InjecteeImpl injecteeWrapper = new InjecteeImpl(); injecteeWrapper.setRequiredType(injectee.getRequiredType()); injecteeWrapper.setParent(injectee.getParent()); injecteeWrapper.setRequiredQualifiers(injectee.getRequiredQualifiers()); injecteeWrapper.setOptional(injectee.isOptional()); injecteeWrapper.setPosition(injectee.getPosition()); injecteeWrapper.setFactory(ReflectionHelper.isSubClassOf(injectee.getRequiredType(), Factory.class)); injecteeWrapper.setInjecteeDescriptor(new ForeignDescriptorImpl(injectee.getInjecteeDescriptor())); Object instance = jerseyResolver.resolve(injecteeWrapper); if (injecteeWrapper.isFactory()) { return asFactory(instance); } else { return instance; } }