This file contains 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
@Inject | |
private ResourceLoader resourceLoader; | |
@Test | |
public void processClasses() throws IOException, ClassNotFoundException { | |
TypeFilter typeFilter = new AssignableTypeFilter(MyClass.class); | |
ResourcePatternResolver resourcePatternResolver = ResourcePatternUtils.getResourcePatternResolver(resourceLoader); | |
MetadataReaderFactory metadataReaderFactory = new CachingMetadataReaderFactory(resourceLoader); | |
String packageSearchPath = ResourcePatternResolver.CLASSPATH_ALL_URL_PREFIX + |
This file contains 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 ExplicitPropertiesFilter extends SimpleBeanPropertyFilter { | |
@Override | |
protected boolean include(BeanPropertyWriter writer) { | |
JsonProperty anno = writer.getAnnotation(JsonProperty.class); | |
return anno != null; | |
} | |
@Override | |
protected boolean include(PropertyWriter writer) { |
This file contains 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 abstract class DynamicVisitor { | |
private final Class<? extends DynamicVisitor> thisClass; | |
private final MethodMap methods; | |
protected DynamicVisitor() { | |
this.thisClass = getClass(); | |
this.methods = new MethodMap(); | |
for (Method m : thisClass.getMethods()) { | |
if ("visit".equals(m.getName())) { |
This file contains 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
private void registerSubtypes(ObjectMapper objectMapper, Class<?> base) { | |
Reflections reflections = new Reflections(base.getPackage().getName()); | |
Class<?>[] subTypes = reflections.getSubTypesOf(base).toArray(new Class<?>[0]); | |
objectMapper.registerSubtypes(subTypes); | |
} |
This file contains 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
EmberSchema schema = ...; | |
JsonGenerator jgen = objectMapper.getFactory() | |
.createGenerator(System.out) | |
.useDefaultPrettyPrinter(); | |
jgen.writeObject(schema); | |
jgen.close(); |
This file contains 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
{ | |
"current": 1, | |
"rowCount": 50, | |
"rows": [ | |
{ | |
"id": 1122, | |
"sender": "eric@facebook.com", | |
"received": "2015-06-21T18:41:56" | |
}, | |
{ |
This file contains 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
{ | |
"current": 1, | |
"rowCount": 50, | |
"data": [ | |
{ | |
"id": 1122, | |
"sender": "eric@facebook.com", | |
"received": "2015-06-21T18:41:56" | |
}, | |
{ |
This file contains 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
{ | |
"data":[ | |
[ | |
"1", | |
"iPad2 (8GB)", | |
"322" | |
], | |
[ | |
"2", | |
"iPad2 (16GB)", |
This file contains 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 HibernateSchemaManagementTool implements SchemaManagementTool, ServiceRegistryAwareService { | |
private ServiceRegistry serviceRegistry; | |
@Override | |
public SchemaCreator getSchemaCreator(Map options) { | |
// TODO use AvailableSettings.SCHEMA_CREATE_FILTER | |
return new SchemaCreatorImpl( getSchemaFilter( options, "hibernate.schema.create.filter" ) ); | |
} | |
@Override |
This file contains 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 ExampleProcessEnginePlugin extends AbstractProcessEnginePlugin { | |
@Override | |
public void preInit(ProcessEngineConfigurationImpl processEngineConfiguration) { | |
super.preInit(processEngineConfiguration); | |
ExampleFormEngine formEngine = new ExampleFormEngine(); | |
processEngineConfiguration.setCustomFormEngines(singletonList(formEngine)); | |
processEngineConfiguration.setCustomPreBPMNParseListeners(singletonList(new ExampleParseListener(formEngine))); | |
} | |
} |
OlderNewer