@Override public void add(String id, T object, String... constraints) { T coerced = object == null ? null : typeCoercer.coerce(object, expectedType); // https://issues.apache.org/jira/browse/TAP5-1565 // Order each added contribution after the previously added contribution // (in the same method) if no other constraint is supplied. if (constraints.length == 0 && priorId != null) { // Ugly: reassigning parameters is yuck. constraints = new String[]{"after:" + priorId}; } orderer.add(id, coerced, constraints); priorId = id; }
@Override public void add(String id, T object, String... constraints) { T coerced = object == null ? null : typeCoercer.coerce(object, expectedType); // https://issues.apache.org/jira/browse/TAP5-1565 // Order each added contribution after the previously added contribution // (in the same method) if no other constraint is supplied. if (constraints.length == 0 && priorId != null) { // Ugly: reassigning parameters is yuck. constraints = new String[]{"after:" + priorId}; } orderer.add(id, coerced, constraints); priorId = id; }
/** * Adds an object to be ordered. * * @param id unique, qualified id for the target * @param target the object to be ordered (or null as a placeholder) * @param constraints optional, variable constraints * @see #add(Orderable) */ public void add(String id, T target, String... constraints) { lock.check(); add(new Orderable<T>(id, target, constraints)); }
/** * Adds an object to be ordered. * * @param id unique, qualified id for the target * @param target the object to be ordered (or null as a placeholder) * @param constraints optional, variable constraints * @see #add(Orderable) */ public void add(String id, T target, String... constraints) { lock.check(); add(new Orderable<T>(id, target, constraints)); }
orderer.add("ServiceByMarker", (T) contribution);
orderer.add("ServiceByMarker", (T) contribution);
@Override public List<ServiceAdvisor> findAdvisorsForService(ServiceDef3 serviceDef) { lock.check(); assert serviceDef != null; Logger logger = getServiceLogger(serviceDef.getServiceId()); Orderer<ServiceAdvisor> orderer = new Orderer<ServiceAdvisor>(logger); for (Module module : moduleToServiceDefs.keySet()) { Set<AdvisorDef> advisorDefs = module.findMatchingServiceAdvisors(serviceDef); if (advisorDefs.isEmpty()) continue; ServiceResources resources = new ServiceResourcesImpl(this, module, serviceDef, proxyFactory, logger); for (AdvisorDef advisorDef : advisorDefs) { ServiceAdvisor advisor = advisorDef.createAdvisor(module, resources); orderer.add(advisorDef.getAdvisorId(), advisor, advisorDef.getConstraints()); } } return orderer.getOrdered(); }
try orderer.add(decoratorDef.getDecoratorId(), decorator, decoratorDef.getConstraints());
try orderer.add(decoratorDef.getDecoratorId(), decorator, decoratorDef.getConstraints());
public void addMixin(String mixinId, Instantiator instantiator, String... order) { if (mixinIdToComponentResources == null) { mixinIdToComponentResources = NamedSet.create(); components = CollectionFactory.newList(); } String mixinExtension = "$" + mixinId.toLowerCase(); InternalComponentResourcesImpl resources = new InternalComponentResourcesImpl(page, this, coreResources, elementResources, completeId + mixinExtension, nestedId + mixinExtension, instantiator, true); mixinIdToComponentResources.put(mixinId, resources); // note that since we're using explicit ordering now, // we don't add anything to components until we page load; instead, we add // to the orderers. if (order == null) order = InternalConstants.EMPTY_STRING_ARRAY; if (resources.getComponentModel().isMixinAfter()) { if (mixinAfterOrderer == null) mixinAfterOrderer = new Orderer<Component>(getLogger()); mixinAfterOrderer.add(mixinId, resources.getComponent(), order); } else { if (mixinBeforeOrderer == null) mixinBeforeOrderer = new Orderer<Component>(getLogger()); mixinBeforeOrderer.add(mixinId, resources.getComponent(), order); } }
@Override public List<ServiceAdvisor> findAdvisorsForService(ServiceDef3 serviceDef) { lock.check(); assert serviceDef != null; Logger logger = getServiceLogger(serviceDef.getServiceId()); Orderer<ServiceAdvisor> orderer = new Orderer<ServiceAdvisor>(logger); for (Module module : moduleToServiceDefs.keySet()) { Set<AdvisorDef> advisorDefs = module.findMatchingServiceAdvisors(serviceDef); if (advisorDefs.isEmpty()) continue; ServiceResources resources = new ServiceResourcesImpl(this, module, serviceDef, proxyFactory, logger); for (AdvisorDef advisorDef : advisorDefs) { ServiceAdvisor advisor = advisorDef.createAdvisor(module, resources); orderer.add(advisorDef.getAdvisorId(), advisor, advisorDef.getConstraints()); } } return orderer.getOrdered(); }