private static <T> void setImplementation(Class<T> type, Class<? extends T> implementation) { checkArgument(type != implementation, "Don't register %s to itself!", type); checkArgument( !DEFAULTS.containsKey(type), "A default value was already registered for %s", type); checkArgument( implementations.put(type, implementation) == null, "Implementation for %s was already registered", type); }
final boolean allowsIdentity = annotations.getInstance(Placeholder.class).allowsIdentity(); final Class<? extends Matcher<? super ExpressionTree>> matchesClass = annotations.containsKey(Matches.class) ? UTemplater.getValue(annotations.getInstance(Matches.class)) : null; final Class<? extends Matcher<? super ExpressionTree>> notMatchesClass = annotations.containsKey(NotMatches.class) ? UTemplater.getValue(annotations.getInstance(NotMatches.class)) : null; final Predicate<Tree.Kind> allowedKinds = annotations.containsKey(OfKind.class) ? Predicates.<Tree.Kind>in(Arrays.asList(annotations.getInstance(OfKind.class).value())) : Predicates.<Tree.Kind>alwaysTrue();
@Override public <T extends IAEStack<T>, C extends IStorageChannel<T>> void registerStorageChannel( Class<C> channel, C factory ) { Preconditions.checkNotNull( channel ); Preconditions.checkNotNull( factory ); Preconditions.checkArgument( channel.isInstance( factory ) ); Preconditions.checkArgument( !this.channels.containsKey( channel ) ); this.channels.putInstance( channel, factory ); }
private List<Parameter> extractParametersFromAnnotation(Type type, ClassToInstanceMap<Annotation> annotations) { String defaultValue = ""; if (annotations.containsKey(DefaultValue.class)) { DefaultValue defaultValueAnnotation = annotations.getInstance(DefaultValue.class); defaultValue = defaultValueAnnotation.value(); } List<Parameter> parameters = new ArrayList<>(); if (annotations.containsKey(QueryParam.class)) { QueryParam param = annotations.getInstance(QueryParam.class); QueryParameter queryParameter = extractQueryParam(type, defaultValue, param); parameters.add(queryParameter); } else if (annotations.containsKey(PathParam.class)) { PathParam param = annotations.getInstance(PathParam.class); PathParameter pathParameter = extractPathParam(type, defaultValue, param); parameters.add(pathParameter); } else if (annotations.containsKey(HeaderParam.class)) { HeaderParam param = annotations.getInstance(HeaderParam.class); HeaderParameter headerParameter = extractHeaderParam(type, defaultValue, param); parameters.add(headerParameter); } else if (annotations.containsKey(CookieParam.class)) { CookieParam param = annotations.getInstance(CookieParam.class); CookieParameter cookieParameter = extractCookieParameter(type, defaultValue, param); parameters.add(cookieParameter); } else if (annotations.containsKey(FormParam.class)) { FormParam param = annotations.getInstance(FormParam.class); FormParameter formParameter = extractFormParameter(type, defaultValue, param); parameters.add(formParameter); } return parameters; }
private static <T> void setImplementation(Class<T> type, Class<? extends T> implementation) { checkArgument(type != implementation, "Don't register %s to itself!", type); checkArgument( !DEFAULTS.containsKey(type), "A default value was already registered for %s", type); checkArgument( implementations.put(type, implementation) == null, "Implementation for %s was already registered", type); }
private static <T> void setImplementation(Class<T> type, Class<? extends T> implementation) { checkArgument(type != implementation, "Don't register %s to itself!", type); checkArgument(!DEFAULTS.containsKey(type), "A default value was already registered for %s", type); checkArgument(implementations.put(type, implementation) == null, "Implementation for %s was already registered", type); }
@Override public <T extends CoprocessorProtocol> boolean registerProtocol( Class<T> protocol, T handler) { /* No stacking of protocol handlers is currently allowed. The * first to claim wins! */ if (protocolHandlers.containsKey(protocol)) { LOG.error("Protocol "+protocol.getName()+ " already registered, rejecting request from "+ handler ); return false; } protocolHandlers.putInstance(protocol, handler); protocolHandlerNames.put(protocol.getName(), protocol); if (LOG.isDebugEnabled()) { LOG.debug("Registered master protocol handler: protocol="+protocol.getName()); } return true; }
public void checkNonOptions() throws IOException { //Some non option should be provided to enable if (optionBeans.containsKey(CommonOptions.class) && getCommonOpts().getNonOptions().isEmpty()){ System.out.println("NodeStore details not provided"); systemExit(1); } }
public void checkNonOptions() throws IOException { //Some non option should be provided to enable if (optionBeans.containsKey(CommonOptions.class) && getCommonOpts().getNonOptions().isEmpty()){ System.out.println("NodeStore details not provided"); systemExit(1); } }
if (protocolHandlers.containsKey(protocol)) { LOG.error("Protocol "+protocol.getName()+ " already registered, rejecting request from "+
@Override public <T> T get(Class<T> type) { assertThat(classMap.containsKey(type) || map.containsKey(type)).isTrue(); if (classMap.containsKey(type)) { return classMap.getInstance(type); } return map.get(type).get(type); }
private void checkForHelp(OptionParser parser) throws IOException { if (optionBeans.containsKey(CommonOptions.class) && getCommonOpts().isHelpRequested()){ parser.printHelpOn(System.out); systemExit(0); } }
private void checkForHelp(OptionParser parser) throws IOException { if (optionBeans.containsKey(CommonOptions.class) && getCommonOpts().isHelpRequested()){ parser.printHelpOn(System.out); systemExit(0); } }
if (!protocolHandlers.containsKey(protocol)) { throw new HBaseRPC.UnknownProtocolException(protocol, "No matching handler for protocol ");
final boolean allowsIdentity = annotations.getInstance(Placeholder.class).allowsIdentity(); final Class<? extends Matcher<? super ExpressionTree>> matchesClass = annotations.containsKey(Matches.class) ? UTemplater.getValue(annotations.getInstance(Matches.class)) : null; final Class<? extends Matcher<? super ExpressionTree>> notMatchesClass = annotations.containsKey(NotMatches.class) ? UTemplater.getValue(annotations.getInstance(NotMatches.class)) : null; final Predicate<Tree.Kind> allowedKinds = annotations.containsKey(OfKind.class) ? Predicates.<Tree.Kind>in(Arrays.asList(annotations.getInstance(OfKind.class).value())) : Predicates.<Tree.Kind>alwaysTrue();
if (!protocolHandlers.containsKey(protocol)) { throw new HBaseRPC.UnknownProtocolException(protocol, "No matching handler for protocol "+protocol.getName()+
if (actions.containsKey(AddTagAction.class) && actions.containsKey(RemoveTagAction.class)) { TagActionData addTagData = actions.getInstance(AddTagAction.class).getValue(); TagActionData removeTagData = actions.getInstance(RemoveTagAction.class).getValue(); if (actions.containsKey(AppDefinedAction.class) && actions.size() > 1) { List<String> fieldNames = Lists.newArrayList(actions.getInstance(AppDefinedAction.class).getValue().fieldNames()); for (Class<? extends Action> key : actions.keySet()) {