@Override protected T doNewComponent(SatisfiedBOM satisfiedBOM) { // in case the system property has been nullified, we return an empty string as value, rather than null // which would break the component building return (T) Objects.firstNonNull(System.getProperty(name.getName()), ""); } };
public static List<String> toNameStrings(List<Name> names) { List<String> list = new ArrayList<String>(names.size()); for (Name name : names) { list.add(name.getName()); } return list; }
public RestxSpecLoader(Set<NamedComponent<GivenLoader>> givenLoaders, Set<NamedComponent<WhenHeaderLoader>> whenHeaderLoaders) { this.givenLoaders = givenLoaders; this.whenHeaderLoaders = whenHeaderLoaders; List<String> names = Lists.newArrayList(); for (NamedComponent<GivenLoader> givenLoader : givenLoaders) { names.add(givenLoader.getName().getName()); } this.names = Joiner.on(", ").join(names); }
private Set<Name> findSimilarNamesByNamedType(Class componentClass) { Set<Name> names = new LinkedHashSet<>(); for (Name<?> name : warehouse.listNames()) { if (name.getName().equals(componentClass.getName())) { names.add(name); } } return names; }
public RestxSpecLoader(Set<NamedComponent<GivenLoader>> givenLoaders, Set<NamedComponent<WhenHeaderLoader>> whenHeaderLoaders) { this.givenLoaders = givenLoaders; this.whenHeaderLoaders = whenHeaderLoaders; List<String> names = Lists.newArrayList(); for (NamedComponent<GivenLoader> givenLoader : givenLoaders) { names.add(givenLoader.getName().getName()); } this.names = Joiner.on(", ").join(names); }
@Override public boolean canBuild(Name<?> name) { return name.getClazz() == String.class && System.getProperty(name.getName()) != null; }
@Override public boolean canBuild(Name<?> name) { return name.getClazz() == String.class && keys.contains(name.getName()); }
for(Name name: nameTreeSet) { if(name.getName().equals("aristotle")) name.setName("new name"); }
private GivenLoader findLoader(Map given, String type) { for (NamedComponent<GivenLoader> givenLoader : givenLoaders) { if (givenLoader.getName().getName().equalsIgnoreCase(type)) { return givenLoader.getComponent(); } } throw new IllegalArgumentException("invalid given " + given + ": unrecognized type " + type + "." + " Was expecting one of [" + names + "] as either first field or 'type' property"); }
private GivenLoader findLoader(Map given, String type) { for (NamedComponent<GivenLoader> givenLoader : givenLoaders) { if (givenLoader.getName().getName().equalsIgnoreCase(type)) { return givenLoader.getComponent(); } } throw new IllegalArgumentException("invalid given " + given + ": unrecognized type " + type + "." + " Was expecting one of [" + names + "] as either first field or 'type' property"); }
@Override public String apply(Name<?> input) { return Factory.activationKey(input.getClazz(), input.getName()); } }));
@Override @SuppressWarnings("unchecked") protected T doNewComponent(SatisfiedBOM satisfiedBOM) { return (T) new StdJongoCollection(satisfiedBOM.getOne(jongoQuery).get().getComponent(), name.getName()); }
@Override @SuppressWarnings("unchecked") protected T doNewComponent(SatisfiedBOM satisfiedBOM) { return (T) new StdJongoCollection(satisfiedBOM.getOne(jongoQuery).get().getComponent(), name.getName()); }
private List<ImmutableMap<String, String>> buildApis() { Set<NamedComponent<RestxRouter>> routers = factory.queryByClass(RestxRouter.class).find(); List<ImmutableMap<String, String>> apis = Lists.newArrayList(); for (NamedComponent<RestxRouter> router : routers) { String routerApiPath = getRouterApiPath(router.getName().getName()); if (ApiDeclarationRoute.getRouterByName(factory, routerApiPath).isPresent()) { // we add the api only if we can find back the router from the name, otherwise it will trigger // 404 errors in API-DOCS apis.add(ImmutableMap.of( "path", "/@/api-docs/" + routerApiPath, "name", routerApiPath, "group", router.getComponent().getGroupName(), "description", "")); } } return apis; }
private List<ResourceDescription> buildApis(NamedComponent<RestxRouter> router) { return fillRelatedOperations(router.getName().getName(), describeAllRoutes(router.getComponent())); }
private Multimap<String, OperationReference> getOperationReferencesByPath() { Multimap<String, OperationReference> operationsByPath = ArrayListMultimap.create(); Set<NamedComponent<RestxRouter>> routers = factory.queryByClass(RestxRouter.class).find(); for (NamedComponent<RestxRouter> r : routers) { String routerApiPath = getRouterApiPath(r.getName().getName()); for (ResourceDescription resourceDescription : describeAllRoutes(r.getComponent())) { for (OperationDescription operation : resourceDescription.operations) { OperationReference ref = buildReferenceFor(routerApiPath, resourceDescription.path, operation); operationsByPath.put(resourceDescription.path, ref); } } } return operationsByPath; }
private Multimap<String, OperationReference> getOperationReferencesByPath() { Multimap<String, OperationReference> operationsByPath = ArrayListMultimap.create(); Set<NamedComponent<RestxRouter>> routers = factory.queryByClass(RestxRouter.class).find(); for (NamedComponent<RestxRouter> r : routers) { String routerApiPath = getRouterApiPath(r.getName().getName()); for (ResourceDescription resourceDescription : describeAllRoutes(r.getComponent())) { for (OperationDescription operation : resourceDescription.operations) { OperationReference ref = buildReferenceFor(routerApiPath, resourceDescription.path, operation); operationsByPath.put(resourceDescription.path, ref); } } } return operationsByPath; }
private List<ResourceDescription> buildApis(NamedComponent<RestxRouter> router) { return fillRelatedOperations(router.getName().getName(), describeAllRoutes(router.getComponent())); }