method2testcases
stringlengths
118
6.63k
### Question: MrpAlgorithmStrategyTS implements MrpAlgorithmStrategy { public Map<Long, BigDecimal> perform(final OperationProductComponentWithQuantityContainer productComponentWithQuantities, final Set<OperationProductComponentHolder> nonComponents, final MrpAlgorithm mrpAlgorithm, final String operationProductCompone...
### Question: OrderRealizationTimeServiceImpl implements OrderRealizationTimeService { @Override @Transactional public int estimateOperationTimeConsumption(final EntityTreeNode operationComponent, final BigDecimal plannedQuantity, final boolean includeTpz, final boolean includeAdditionalTime, final Entity productionLin...
### Question: OrderRealizationTimeServiceImpl implements OrderRealizationTimeService { @Override @Transactional public int estimateMaxOperationTimeConsumptionForWorkstation(final EntityTreeNode operationComponent, final BigDecimal plannedQuantity, final boolean includeTpz, final boolean includeAdditionalTime, final Ent...
### Question: MultitransferListeners { public void fillUnitsInADL(final ViewDefinitionState view, final ComponentState componentState, final String[] args) { fillUnitsInADL(view, PRODUCTS); } @Transactional void createMultitransfer(final ViewDefinitionState view, final ComponentState state, final String[] args); boole...
### Question: MultitransferListeners { @Transactional public void createMultitransfer(final ViewDefinitionState view, final ComponentState state, final String[] args) { if (!isMultitransferFormValid(view)) { return; } FormComponent multitransferForm = (FormComponent) view.getComponentByReference(L_FORM); FieldComponent...
### Question: MatchingChangeoverNormsDetailsHooks { public void setFieldsVisible(final ViewDefinitionState view) { FormComponent form = (FormComponent) view.getComponentByReference(L_FORM); ComponentState matchingNorm = view.getComponentByReference("matchingNorm"); ComponentState matchingNormNotFound = view.getComponen...
### Question: MultitransferListeners { public void getFromTemplates(final ViewDefinitionState view, final ComponentState state, final String[] args) { getFromTemplates(view); } @Transactional void createMultitransfer(final ViewDefinitionState view, final ComponentState state, final String[] args); boolean checkIfTrans...
### Question: MultitransferViewHooks { public void makeFieldsRequired(final ViewDefinitionState view) { for (String componentRef : COMPONENTS) { FieldComponent component = (FieldComponent) view.getComponentByReference(componentRef); component.setRequired(true); component.requestComponentUpdateState(); } } void makeFie...
### Question: MessagesUtil { public static String joinArgs(final String[] splittedArgs) { if (ArrayUtils.isEmpty(splittedArgs)) { return null; } return StringUtils.join(splittedArgs, ARGS_SEPARATOR); } private MessagesUtil(); static String joinArgs(final String[] splittedArgs); static String[] splitArgs(final String j...
### Question: MessagesUtil { public static String[] splitArgs(final String joinedArgs) { if (StringUtils.isBlank(joinedArgs)) { return ArrayUtils.EMPTY_STRING_ARRAY; } return joinedArgs.split(ARGS_SEPARATOR); } private MessagesUtil(); static String joinArgs(final String[] splittedArgs); static String[] splitArgs(final...
### Question: MessagesUtil { public static boolean hasFailureMessages(final List<Entity> messages) { return hasMessagesOfType(messages, StateMessageType.FAILURE); } private MessagesUtil(); static String joinArgs(final String[] splittedArgs); static String[] splitArgs(final String joinedArgs); static boolean hasFailure...
### Question: MessagesUtil { public static boolean isAutoClosed(final Entity message) { return message.getField(AUTO_CLOSE) == null || message.getBooleanField(AUTO_CLOSE); } private MessagesUtil(); static String joinArgs(final String[] splittedArgs); static String[] splitArgs(final String joinedArgs); static boolean h...
### Question: StateChangeViewClientValidationUtil { public void addValidationErrorMessages(final ComponentState component, final StateChangeContext stateChangeContext) { addValidationErrorMessages(component, stateChangeContext.getOwner(), stateChangeContext); } void addValidationErrorMessages(final ComponentState comp...
### Question: AbstractStateChangeDescriber implements StateChangeEntityDescriber { @Override public void checkFields() { DataDefinition dataDefinition = getDataDefinition(); List<String> fieldNames = Lists.newArrayList(getOwnerFieldName(), getSourceStateFieldName(), getTargetStateFieldName(), getStatusFieldName(), getM...
### Question: MatchingChangeoverNormsDetailsHooks { public void fillOrCleanFields(final ViewDefinitionState view) { FormComponent form = (FormComponent) view.getComponentByReference(L_FORM); if (form.getEntityId() == null) { listeners.clearField(view); listeners.changeStateEditButton(view, false); } else { Entity chang...
### Question: Sha1Digest implements MessageDigest { public String calculate(final InputStream inputStream) throws IOException { logger.trace("Calculating message digest"); return DigestUtils.sha1Hex(inputStream); } String calculate(final InputStream inputStream); String calculate(final File file); String calculate(Str...
### Question: WorkerDataUtils { public static <T extends MaestroWorker> BinaryRateWriter writer(final File reportFolder, final T worker) throws IOException { assert worker != null : "Invalid worker type"; if (worker instanceof MaestroSenderWorker) { return new BinaryRateWriter(new File(reportFolder, "sender.dat"), File...
### Question: JmsOptions { public JmsOptions(final String url) { try { final URI uri = new URI(url); final URLQuery urlQuery = new URLQuery(uri); protocol = JMSProtocol.valueOf(urlQuery.getString("protocol", JMSProtocol.AMQP.name())); path = uri.getPath(); type = urlQuery.getString("type", "queue"); configuredLimitDest...
### Question: JMSClient implements Client { public static String setupLimitDestinations(final String destinationName, final int limitDestinations, final int clientNumber) { String ret = destinationName; if (limitDestinations >= 1) { logger.debug("Client requested a client-specific limit to the number of destinations: {...
### Question: StringUtils { public static String capitalize(final String string) { if (string != null && string.length() >= 2) { return string.substring(0, 1).toUpperCase() + string.substring(1); } else { return string; } } private StringUtils(); static String capitalize(final String string); }### Answer: @Test publi...
### Question: BinaryRateWriter implements RateWriter { @Override public void close() { try { flush(); fileChannel.close(); } catch (IOException e) { Logger logger = LoggerFactory.getLogger(BinaryRateWriter.class); logger.error(e.getMessage(), e); } } BinaryRateWriter(final File reportFile, final FileHeader fileHeader);...
### Question: BinaryRateWriter implements RateWriter { private void write() throws IOException { byteBuffer.flip(); while (byteBuffer.hasRemaining()) { fileChannel.write(byteBuffer); } byteBuffer.flip(); byteBuffer.clear(); } BinaryRateWriter(final File reportFile, final FileHeader fileHeader); @Override File reportFil...
### Question: BinaryRateUpdater implements AutoCloseable { public static void joinFile(final BinaryRateUpdater binaryRateUpdater, final File reportFile1) throws IOException { try (BinaryRateReader reader = new BinaryRateReader(reportFile1)) { if (!binaryRateUpdater.isOverlay()) { FileHeader header = binaryRateUpdater.g...
### Question: PropertyUtils { public static void loadProperties(final File testProperties, Map<String, Object> context) { if (testProperties.exists()) { Properties prop = new Properties(); try (FileInputStream in = new FileInputStream(testProperties)) { prop.load(in); prop.forEach((key, value) -> addToContext(context, ...
### Question: Sha1Digest implements MessageDigest { public boolean verify(String source) throws IOException { try (InputStream stream = new FileInputStream(source + "." + HASH_NAME)) { final String digest = IOUtils.toString(stream, Charset.defaultCharset()).trim(); return verify(source, digest); } } String calculate(f...
### Question: DurationDrain extends DurationCount { @Override public boolean canContinue(TestProgress progress) { long count = progress.messageCount(); return !staleChecker.isStale(count); } DurationDrain(); @Override boolean canContinue(TestProgress progress); static final String DURATION_DRAIN_FORMAT; }### Answer: @T...
### Question: DurationTime implements TestDuration { @Override public boolean canContinue(final TestProgress snapshot) { final long currentDuration = snapshot.elapsedTime(outputTimeUnit); return currentDuration < expectedDuration; } DurationTime(final String timeSpec); @Override boolean canContinue(final TestProgress s...
### Question: DurationTime implements TestDuration { @Override public long getNumericDuration() { return expectedDuration; } DurationTime(final String timeSpec); @Override boolean canContinue(final TestProgress snapshot); @Override long getNumericDuration(); @Override TestDuration getWarmUpDuration(); @Override TestDur...
### Question: DurationTime implements TestDuration { public String toString() { return timeSpec; } DurationTime(final String timeSpec); @Override boolean canContinue(final TestProgress snapshot); @Override long getNumericDuration(); @Override TestDuration getWarmUpDuration(); @Override TestDuration getCoolDownDuration(...
### Question: DurationCount implements TestDuration { @Override public boolean canContinue(final TestProgress progress) { return progress.messageCount() < count; } DurationCount(final String durationSpec); DurationCount(long count); @Override boolean canContinue(final TestProgress progress); @Override long getNumeric...
### Question: WorkerUtils { public static long getExchangeInterval(final long rate) { return rate > 0 ? (1_000_000_000L / rate) : 0; } private WorkerUtils(); static long getExchangeInterval(final long rate); static long waitNanoInterval(final long expectedFireTime, final long intervalInNanos); }### Answer: @Test publ...
### Question: Sha1Digest implements MessageDigest { public void save(String source) throws IOException { final String digest = calculate(source); final File file = new File(source + "." + HASH_NAME); if (file.exists()) { if (!file.delete()) { throw new IOException("Unable to delete an existent file: " + file.getPath())...
### Question: URLUtils { public static String rewritePath(final String inputUrl, final String string) { try { URI url = new URI(inputUrl); final String userInfo = url.getUserInfo(); final String host = url.getHost(); if (host == null) { throw new MaestroException("Invalid URI: null host"); } URI ret; if (host.equals(us...
### Question: ContentStrategyFactory { public static ContentStrategy parse(final String sizeSpec) { ContentStrategy ret; if (sizeSpec.startsWith("~")) { ret = new VariableSizeContent(sizeSpec); } else { ret = new FixedSizeContent(sizeSpec); } return ret; } private ContentStrategyFactory(); static ContentStrategy parse...
### Question: VariableSizeContent implements ContentStrategy { @Override public ByteBuffer prepareContent() { final int currentLimit = ThreadLocalRandom.current().nextInt(this.lowerLimitInclusive, this.upperLimitExclusive); buffer.clear(); buffer.limit(currentLimit); return buffer; } VariableSizeContent(int size); Va...
### Question: FixedSizeContent implements ContentStrategy { @Override public ByteBuffer prepareContent() { return buffer; } FixedSizeContent(int size); FixedSizeContent(final String sizeSpec); @Override ByteBuffer prepareContent(); }### Answer: @Test public void testPepareContent() { FixedSizeContent content = new F...
### Question: MessageSize { public static String variable(long value) { return "~" + Long.toString(value); } private MessageSize(); static String variable(long value); static String fixed(long value); static boolean isVariable(final String sizeSpec); static int toSizeFromSpec(final String sizeSpec); }### Answer: @Tes...
### Question: WorkerStateInfoUtil { public static boolean isCleanExit(WorkerStateInfo wsi) { if (wsi.getExitStatus() == WorkerStateInfo.WorkerExitStatus.WORKER_EXIT_SUCCESS) { return true; } return wsi.getExitStatus() == WorkerStateInfo.WorkerExitStatus.WORKER_EXIT_STOPPED; } private WorkerStateInfoUtil(); static bool...
### Question: MessageSize { public static String fixed(long value) { return Long.toString(value); } private MessageSize(); static String variable(long value); static String fixed(long value); static boolean isVariable(final String sizeSpec); static int toSizeFromSpec(final String sizeSpec); }### Answer: @Test public ...
### Question: MessageSize { public static boolean isVariable(final String sizeSpec) { return sizeSpec.startsWith("~"); } private MessageSize(); static String variable(long value); static String fixed(long value); static boolean isVariable(final String sizeSpec); static int toSizeFromSpec(final String sizeSpec); }### ...
### Question: MessageSize { public static int toSizeFromSpec(final String sizeSpec) { if (isVariable(sizeSpec)) { return Integer.parseInt(sizeSpec.replace("~", "")); } return Integer.parseInt(sizeSpec); } private MessageSize(); static String variable(long value); static String fixed(long value); static boolean isVaria...
### Question: LangUtils { public static <T extends Closeable> void closeQuietly(T object) { if (object != null) { try { object.close(); } catch (IOException ignored) { } } } private LangUtils(); static void closeQuietly(T object); }### Answer: @Test public void closeQuietly() { LangUtils.closeQuietly(null); MockClose...
### Question: URLQuery { public boolean getBoolean(final String name, boolean defaultValue) { String value = getString(name, null); if (value == null) { return defaultValue; } if (value.equalsIgnoreCase("true")) { return true; } else { if (value.equalsIgnoreCase("false")) { return false; } } return defaultValue; } URLQ...
### Question: URLQuery { public Long getLong(final String name, final Long defaultValue) { String value = getString(name, null); if (value == null) { return defaultValue; } return Long.parseLong(value); } URLQuery(final String uri); URLQuery(URI uri); String getString(final String name, final String defaultValue); boo...
### Question: ReportDao extends AbstractDao { public void insert(final Report report) { runEmptyInsert( "insert into report(test_id, test_number, test_name, test_script, test_host, test_host_role, " + "test_result, test_result_message, location, aggregated, test_description, test_comments, " + "valid, retired, retired_...
### Question: ReportDao extends AbstractDao { public List<Report> fetchAll() throws DataNotFoundException { return runQueryMany("select * from report", new BeanPropertyRowMapper<>(Report.class)); } ReportDao(); ReportDao(TemplateBuilder tp); void insert(final Report report); int update(final Report report); List<Repor...
### Question: ReportDao extends AbstractDao { public List<Report> fetch() throws DataNotFoundException { return runQueryMany("select * from report where aggregated = false and valid = true order by report_id desc", new BeanPropertyRowMapper<>(Report.class)); } ReportDao(); ReportDao(TemplateBuilder tp); void insert(fi...
### Question: ReportDao extends AbstractDao { public List<ReportAggregationInfo> aggregationInfo() throws DataNotFoundException { return runQueryMany("SELECT test_id,test_number,sum(aggregated) AS aggregations FROM report " + "GROUP BY test_id,test_number ORDER BY test_id desc", new BeanPropertyRowMapper<>(ReportAggreg...
### Question: InterconnectInfoConverter { public List<Map<String, Object>> parseReceivedMessage(Map<?, ?> map) { List<Map<String, Object>> recordList = new ArrayList<>(); if (map == null || map.isEmpty()) { logger.warn("The received attribute map is empty or null"); return recordList; } Object tmpAttributeNames = map.g...
### Question: WPSInitializer implements GeoServerInitializer { public void initialize(final GeoServer geoServer) throws Exception { initWPS(geoServer.getService(WPSInfo.class), geoServer); geoServer.addListener(new ConfigurationListenerAdapter() { @Override public void handlePostGlobalChange(GeoServerInfo global) { ini...
### Question: WPSXStreamLoader extends XStreamServiceLoader<WPSInfo> { protected WPSInfo createServiceFromScratch(GeoServer gs) { WPSInfoImpl wps = new WPSInfoImpl(); wps.setName("WPS"); wps.setGeoServer( gs ); wps.getVersions().add( new Version( "1.0.0") ); wps.setMaxAsynchronousProcesses(Runtime.getRuntime().availabl...
### Question: WPSResourceManager implements DispatcherCallback, ApplicationListener<ApplicationEvent> { public void addResource(WPSResource resource) { String processId = getExecutionId(null); ExecutionResources resources = resourceCache.get(processId); if (resources == null) { throw new IllegalStateException("...
### Question: PostController { @GetMapping("/{id}") public Mono<Post> get(@PathVariable("id") String id) { return this.posts.findById(id); } PostController(PostRepository posts); @GetMapping("") Flux<Post> all(); @PostMapping("") Mono<Post> create(@RequestBody Post post); @GetMapping("/{id}") Mono<Post> get(@PathVariab...
### Question: PostController { @GetMapping(value = "/{id}") public Mono<Post> get(@PathVariable(value = "id") Long id) { return this.posts.findById(id); } PostController(PostRepository posts); @GetMapping(value = "") Flux<Post> all(); @GetMapping(value = "/{id}") Mono<Post> get(@PathVariable(value = "id") Long id); @Po...
### Question: PostRepository { Flux<Post> findAll() { return Flux.fromIterable(data.values()); } PostRepository(); }### Answer: @Test public void testGetAllPosts() { StepVerifier.create(posts.findAll()) .consumeNextWith(p -> assertTrue(p.getTitle().equals("post one"))) .consumeNextWith(p -> assertTrue(p.getTitle().eq...
### Question: VRaptor implements Filter { @Override public void doFilter(ServletRequest req, ServletResponse res, FilterChain chain) throws IOException, ServletException { validateServletEnvironment(req, res); final HttpServletRequest baseRequest = (HttpServletRequest) req; final HttpServletResponse baseResponse = (Htt...
### Question: DefaultParametersControl implements ParametersControl { @Override public void fillIntoRequest(String uri, MutableRequest request) { Matcher m = pattern.matcher(uri); m.matches(); for (int i = 1; i <= m.groupCount(); i++) { String name = parameters.get(i - 1); try { request.setParameter(name, URLDecoder.de...
### Question: DefaultFormatResolver implements FormatResolver { @Override public String getAcceptFormat() { String format = request.getParameter("_format"); if (format != null) { return format; } format = request.getHeader("Accept"); return acceptHeaderToFormat.getFormat(format) ; } protected DefaultFormatResolver(); ...
### Question: JavassistProxifier implements Proxifier { @Override public <T> T proxify(Class<T> type, MethodInvocation<? super T> handler) { final ProxyFactory factory = new ProxyFactory(); factory.setFilter(IGNORE_BRIDGE_AND_OBJECT_METHODS); Class<?> rawType = extractRawType(type); if (type.isInterface()) { factory.se...
### Question: DefaultParametersControl implements ParametersControl { @Override public boolean matches(String uri) { return pattern.matcher(uri).matches(); } DefaultParametersControl(String originalPattern, Map<String, String> parameterPatterns, Converters converters, Evaluator evaluator, EncodingHandler encodingHandle...
### Question: CDIProxies { public static boolean isCDIProxy(Class<?> type) { return ProxyObject.class.isAssignableFrom(type); } private CDIProxies(); static boolean isCDIProxy(Class<?> type); static Class<?> extractRawTypeIfPossible(Class<T> type); @SuppressWarnings({ "unchecked", "rawtypes" }) static T unproxifyIfPos...
### Question: CDIProxies { @SuppressWarnings({ "unchecked", "rawtypes" }) public static <T> T unproxifyIfPossible(T source) { if (source instanceof TargetInstanceProxy) { TargetInstanceProxy<T> target = (TargetInstanceProxy) source; return target.getTargetInstance(); } return source; } private CDIProxies(); static boo...
### Question: UploadedFileConverter implements Converter<UploadedFile> { @Override public UploadedFile convert(String value, Class<? extends UploadedFile> type) { Object upload = request.getAttribute(value); return type.cast(upload); } protected UploadedFileConverter(); @Inject UploadedFileConverter(HttpServletReques...
### Question: CommonsUploadMultipartObserver { public void upload(@Observes ControllerFound event, MutableRequest request, MultipartConfig config, Validator validator) { if (!ServletFileUpload.isMultipartContent(request)) { return; } logger.info("Request contains multipart data. Try to parse with commons-upload."); fin...
### Question: RequestHandlerObserver { public void handle(@Observes VRaptorRequestStarted event) { MutableResponse response = event.getResponse(); MutableRequest request = event.getRequest(); try { ControllerMethod method = translator.translate(request); controllerFoundEvent.fire(new ControllerFound(method)); intercept...
### Question: OutjectResult { public void outject(@Observes MethodExecuted event, Result result, MethodInfo methodInfo) { Type returnType = event.getMethodReturnType(); if (!returnType.equals(Void.TYPE)) { String name = extractor.nameFor(returnType); Object value = methodInfo.getResult(); logger.debug("outjecting {}={}...
### Question: ForwardToDefaultView { public void forward(@Observes RequestSucceded event) { if (result.used() || event.getResponse().isCommitted()) { logger.debug("Request already dispatched and commited somewhere else, not forwarding."); return; } logger.debug("forwarding to the dafault page for this logic"); result.u...
### Question: DownloadObserver { public void download(@Observes MethodExecuted event, Result result) throws IOException { Object methodResult = event.getMethodInfo().getResult(); Download download = resolveDownload(methodResult); if (download != null && !result.used()) { logger.debug("Sending a file to the client"); re...
### Question: DownloadObserver { public Download resolveDownload(Object result) throws IOException { if (result instanceof InputStream) { return new InputStreamDownload((InputStream) result, null, null); } if (result instanceof byte[]) { return new ByteArrayDownload((byte[]) result, null, null); } if (result instanceof...
### Question: ByteArrayDownload implements Download { @Override public void write(HttpServletResponse response) throws IOException { download.write(response); } ByteArrayDownload(byte[] buff, String contentType, String fileName); ByteArrayDownload(byte[] buff, String contentType, String fileName, boolean doDownload); ...
### Question: InputStreamDownload implements Download { @Override public void write(HttpServletResponse response) throws IOException { writeDetails(response); OutputStream out = response.getOutputStream(); ByteStreams.copy(stream, out); stream.close(); } InputStreamDownload(InputStream input, String contentType, String...
### Question: FileDownload implements Download { @Override public void write(HttpServletResponse response) throws IOException { try (InputStream stream = new FileInputStream(file)) { Download download = new InputStreamDownload(stream, contentType, fileName, doDownload, file.length()); download.write(response); } } File...
### Question: ZipDownload implements Download { @Override public void write(HttpServletResponse response) throws IOException { response.setHeader("Content-disposition", "attachment; filename=" + filename); response.setHeader("Content-type", "application/zip"); CheckedOutputStream stream = new CheckedOutputStream(respon...
### Question: EnvironmentPropertyProducer { @Produces @Property public String get(InjectionPoint ip) { Annotated annotated = ip.getAnnotated(); Property property = annotated.getAnnotation(Property.class); String key = property.value(); if (isNullOrEmpty(key)) { key = ip.getMember().getName(); } String defaultValue = pr...
### Question: DefaultEnvironment implements Environment { @Override public URL getResource(String name) { URL resource = getClass().getResource("/" + getEnvironmentType().getName() + name); if (resource != null) { LOG.debug("Loading resource {} from environment {}", name, getEnvironmentType().getName()); return resourc...
### Question: DefaultEnvironment implements Environment { @Override public String get(String key) { if (!has(key)) { throw new NoSuchElementException(String.format("Key %s not found in environment %s", key, getName())); } String systemProperty = System.getProperty(key); if (!isNullOrEmpty(systemProperty)) { return syst...
### Question: DefaultEnvironment implements Environment { @Override public boolean supports(String feature) { if (has(feature)) { return Boolean.parseBoolean(get(feature).trim()); } return false; } protected DefaultEnvironment(); @Inject DefaultEnvironment(ServletContext context); DefaultEnvironment(EnvironmentType ...
### Question: DefaultEnvironment implements Environment { @Override public String getName() { return getEnvironmentType().getName(); } protected DefaultEnvironment(); @Inject DefaultEnvironment(ServletContext context); DefaultEnvironment(EnvironmentType environmentType); @Override boolean supports(String feature); @...
### Question: DefaultRepresentationResult implements RepresentationResult { @Override public <T> Serializer from(T object) { return from(object, null); } protected DefaultRepresentationResult(); @Inject DefaultRepresentationResult(FormatResolver formatResolver, Result result, @Any Instance<Serialization> serializatio...
### Question: DeserializesHandler { @SuppressWarnings("unchecked") public void handle(@Observes @DeserializesQualifier BeanClass beanClass) { Class<?> originalType = beanClass.getType(); checkArgument(Deserializer.class.isAssignableFrom(originalType), "%s must implement Deserializer", beanClass); deserializers.register...
### Question: DefaultDeserializers implements Deserializers { @Override public Deserializer deserializerFor(String contentType, Container container) { if (deserializers.containsKey(contentType)) { return container.instanceFor(deserializers.get(contentType)); } return subpathDeserializerFor(contentType, container); } @...
### Question: DefaultDeserializers implements Deserializers { @Override public void register(Class<? extends Deserializer> type) { Deserializes deserializes = type.getAnnotation(Deserializes.class); checkArgument(deserializes != null, "You must annotate your deserializers with @Deserializes"); for (String contentType :...
### Question: HTMLSerialization implements Serialization { @Override public <T> Serializer from(T object, String alias) { result.include(alias, object); result.use(page()).defaultView(); return new IgnoringSerializer(); } protected HTMLSerialization(); @Inject HTMLSerialization(Result result, TypeNameExtractor extrac...
### Question: FlashInterceptor implements Interceptor { @Override public boolean accepts(ControllerMethod method) { return true; } protected FlashInterceptor(); @Inject FlashInterceptor(HttpSession session, Result result, MutableResponse response); @Override boolean accepts(ControllerMethod method); @Override void in...
### Question: FlashInterceptor implements Interceptor { @Override public void intercept(InterceptorStack stack, ControllerMethod method, Object controllerInstance) throws InterceptionException { Map<String, Object> parameters = (Map<String, Object>) session.getAttribute(FLASH_INCLUDED_PARAMETERS); if (parameters != nul...
### Question: CustomAndInternalAcceptsValidationRule implements ValidationRule { @Override public void validate(Class<?> originalType, List<Method> methods) { Method accepts = invoker.findMethod(methods, Accepts.class, originalType); List<Annotation> constraints = getCustomAcceptsAnnotations(originalType); checkState(a...
### Question: NoInterceptMethodsValidationRule implements ValidationRule { @Override public void validate(Class<?> originalType, List<Method> methods) { boolean hasAfterMethod = hasAnnotatedMethod(AfterCall.class, originalType, methods); boolean hasAroundMethod = hasAnnotatedMethod(AroundCall.class, originalType, metho...
### Question: CustomAcceptsVerifier { @SuppressWarnings({ "rawtypes", "unchecked" }) public boolean isValid(Object interceptor, ControllerMethod controllerMethod, ControllerInstance controllerInstance, List<Annotation> constraints) { for (Annotation annotation : constraints) { AcceptsConstraint constraint = annotation....
### Question: DefaultTypeNameExtractor implements TypeNameExtractor { @Override public String nameFor(Type generic) { if (generic instanceof ParameterizedType) { return nameFor((ParameterizedType) generic); } if (generic instanceof WildcardType) { return nameFor((WildcardType) generic); } if (generic instanceof TypeVar...
### Question: AcceptsNeedReturnBooleanValidationRule implements ValidationRule { @Override public void validate(Class<?> originalType, List<Method> methods) { Method accepts = invoker.findMethod(methods, Accepts.class, originalType); if (accepts != null && !isBooleanReturn(accepts.getReturnType())) { throw new Intercep...
### Question: StepInvoker { public Method findMethod(List<Method> interceptorMethods, Class<? extends Annotation> step, Class<?> interceptorClass) { FluentIterable<Method> possibleMethods = FluentIterable.from(interceptorMethods).filter(hasStepAnnotation(step)); if (possibleMethods.size() > 1 && possibleMethods.allMatc...
### Question: NoStackParamValidationRule implements ValidationRule { @Override public void validate(Class<?> originalType, List<Method> methods) { Method aroundCall = invoker.findMethod(methods, AroundCall.class, originalType); Method afterCall = invoker.findMethod(methods, AfterCall.class, originalType); Method before...
### Question: DefaultTypeFinder implements TypeFinder { @Override public Map<String, Class<?>> getParameterTypes(Method method, String[] parameterPaths) { Map<String,Class<?>> types = new HashMap<>(); Parameter[] parametersFor = provider.parametersFor(method); for (String path : parameterPaths) { for (Parameter paramet...
### Question: DefaultControllerInstance implements ControllerInstance { @Override public BeanClass getBeanClass(){ Class<?> controllerClass = extractRawTypeIfPossible(controller.getClass()); return new DefaultBeanClass(controllerClass); } DefaultControllerInstance(Object instance); @Override Object getController(); @Ov...
### Question: DefaultMethodNotAllowedHandler implements MethodNotAllowedHandler { @Override public void deny(MutableRequest request, MutableResponse response, Set<HttpMethod> allowedMethods) { response.addHeader("Allow", Joiner.on(", ").join(allowedMethods)); try { if (!"OPTIONS".equalsIgnoreCase(request.getMethod())) ...
### Question: DefaultLogicResult implements LogicResult { @Override public <T> T forwardTo(final Class<T> type) { return proxifier.proxify(type, new MethodInvocation<T>() { @Override public Object intercept(T proxy, Method method, Object[] args, SuperMethod superMethod) { try { logger.debug("Executing {}", method); Con...
### Question: FixedMethodStrategy implements Route { @Override public ControllerMethod controllerMethod(MutableRequest request, String uri) { parameters.fillIntoRequest(uri, request); return this.controllerMethod; } FixedMethodStrategy(String originalUri, ControllerMethod method, Set<HttpMethod> methods, ParametersC...
### Question: DefaultLogicResult implements LogicResult { @Override public <T> T redirectTo(final Class<T> type) { logger.debug("redirecting to class {}", type.getSimpleName()); return proxifier.proxify(type, new MethodInvocation<T>() { @Override public Object intercept(T proxy, Method method, Object[] args, SuperMetho...
### Question: DefaultAcceptHeaderToFormat implements AcceptHeaderToFormat { @Override public String getFormat(final String acceptHeader) { if (acceptHeader == null || acceptHeader.trim().equals("")) { return DEFAULT_FORMAT; } if (acceptHeader.contains(DEFAULT_FORMAT)) { return DEFAULT_FORMAT; } return acceptToFormatCac...
### Question: DefaultStatus implements Status { @Override public void header(String key, String value) { response.addHeader(key, value); } protected DefaultStatus(); @Inject DefaultStatus(HttpServletResponse response, Result result, Configuration config, Proxifier proxifier, Router router); @Override void notFound...