This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.HashMap; | |
import java.util.Map; | |
/** | |
* @author kabram. | |
* | |
*/ | |
public class CubicBezierCurve { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import javax.inject.Inject; | |
import org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor; | |
public class DependencyInjector { | |
@Inject | |
private AutowiredAnnotationBeanPostProcessor aaProcessor; | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class DSLExecutor { | |
/** | |
* @param filename Groovy file to execute. | |
* @param handler Handler that provides implementations for methos and properties the script references. | |
* @return A map of variables returned. The keys are the names of the variables. | |
*/ | |
static Map<String, Object> execute(String filename, Object handler) { | |
ResourceLoader loader = new DefaultResourceLoader(); | |
String scriptSource = loader.getResource(filename).getInputStream().getText() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
configurations.all { | |
resolutionStrategy { | |
// fail eagerly on version conflict (includes transitive dependencies) | |
// e.g. multiple different versions of the same dependency (group and name are equal) | |
failOnVersionConflict() | |
// force certain versions of dependencies (including transitive) | |
// *append new forced modules: | |
force 'asm:asm-all:3.3.1', 'commons-io:commons-io:1.4' | |
// *replace existing forced modules with new ones: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class JettyBootstrap { | |
private static Logger logger = LoggerFactory.getLogger(JettyBootstrap.class); | |
private String bindAddress; | |
private int port; | |
public void start() { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Copyright 2006 Sun Microsystems, Inc. All Rights Reserved. | |
* | |
* Redistribution and use in source and binary forms, with or without | |
* modification, are permitted provided that the following conditions | |
* are met: | |
* | |
* - Redistributions of source code must retain the above copyright | |
* notice, this list of conditions and the following disclaimer. | |
* |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public BufferedImage createImageFromSVG(String svg) { | |
Reader reader = new BufferedReader(new StringReader(svg)); | |
TranscoderInput svgImage = new TranscoderInput(reader); | |
BufferedImageTranscoder transcoder = new BufferedImageTranscoder(); | |
transcoder.addTranscodingHint(PNGTranscoder.KEY_WIDTH, (float) component.getWidth()); | |
transcoder.addTranscodingHint(PNGTranscoder.KEY_HEIGHT, (float) component.getHeight()); | |
try { | |
transcoder.transcode(svgImage, null); | |
} catch (TranscoderException e) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ClassPathScanningCandidateComponentProvider provider = new ClassPathScanningCandidateComponentProvider(false); | |
// Filter to include only classes that have a particular annotation. | |
provider.addIncludeFilter(new AnnotationTypeFilter(MyAnnotation.class)); | |
// Find classes in the given package (or subpackages) | |
Set<BeanDefinition> beans = provider.findCandidateComponents("com.xyz.abc"); | |
for (BeanDefinition bd : beans) { | |
// The BeanDefinition class gives access to the Class<?> and other attributes. | |
} |