Skip to content

Instantly share code, notes, and snippets.

View hferentschik's full-sized avatar

Hardy Ferentschik hferentschik

View GitHub Profile
[ERROR] my-rules:PublicMethodsMayNotExposeInternalTypes: API/SPI methods must not expose internal types.
[ERROR] method=org.hibernate.search.engine.spi.SearchFactoryImplementor#org.hibernate.search.engine.impl.FilterDef getFilterDefinition(java.lang.String)
[ERROR] method=org.hibernate.search.engine.spi.SearchFactoryImplementor#org.hibernate.search.indexes.impl.IndexManagerHolder getIndexManagerHolder()
[ERROR] method=org.hibernate.search.engine.spi.SearchFactoryImplementor#org.hibernate.search.backend.impl.batch.BatchBackend makeBatchBackend(org.hibernate.search.batchindexing.MassIndexerProgressMonitor)
[ERROR] method=org.hibernate.search.engine.spi.EntityIndexBinding#org.hibernate.search.query.collector.impl.FieldCacheCollectorFactory getIdFieldCacheCollectionFactory()
[ERROR] method=org.hibernate.search.engine.spi.DocumentBuilderIndexedEntity#org.hibernate.search.query.collector.impl.FieldCacheCollectorFactory getIdFieldCacheCollectionFactory()
[ERROR] method=org.hibernate.search.engine.spi.Abs
@hferentschik
hferentschik / Foo
Last active August 29, 2015 14:04
Type annotations and Hibernate Validator
public class Foo {
@Valid // !? needed or not? Atm this is needed to trigger iteration
private List<@Email String> myEmailList; // that's the case we should primarily address
// ...
}
Running TestSuite
Tests run: 1048, Failures: 2, Errors: 0, Skipped: 0, Time elapsed: 41.127 sec <<< FAILURE! - in TestSuite
testIsValid(org.hibernate.validator.test.internal.constraintvalidators.bv.future.FutureValidatorForOffsetTimeTest) Time elapsed: 0.027 sec <<< FAILURE!
java.lang.AssertionError: expected [true] but found [false]
at org.testng.Assert.fail(Assert.java:94)
at org.testng.Assert.failNotEquals(Assert.java:494)
at org.testng.Assert.assertTrue(Assert.java:42)
at org.testng.Assert.assertTrue(Assert.java:52)
at org.hibernate.validator.test.internal.constraintvalidators.bv.future.FutureValidatorForOffsetTimeTest.testIsValid(FutureValidatorForOffsetTimeTest.java:51)
#!/bin/bash
# cpustatus
#
# Prints the current state of the CPU like temperature, voltage and speed.
# The temperature is reported in degrees Celsius (C) while
# the CPU speed is calculated in megahertz (MHz).
function convert_to_MHz {
let value=$1/1000
echo "$value"
@hferentschik
hferentschik / gist:4723955
Created February 6, 2013 16:53
HV 5.0.0.Beta1 release blog

In unison release of Hibernate Validator 5.0.0.Beta1 and Bean Validation TCK 1.1.0.Beta3

Playing catchup with last week's Bean Valdiation specification release (1.1.0.Beta3) we are happy to make the following releases available as well:

  • Bean Validation TCK 1.1.0.Beta3

    • Maven artefacts on the JBoss Maven repository under the GAV org.hibernate.beanvalidation.tck:beanvalidation-tck-tests:1.1.0.Beta3
    • Zip and tar bundles on SourceForge
  • Hibernate Validator 5.0.0.Beta1

  • Maven artefacts on the JBoss Maven repository under the GAV org.hibernate:hibernate-validator:5.0.0.Beta1

<?xml version="1.0" encoding="UTF-8"?>
<!--
~ JBoss, Home of Professional Open Source
~ Copyright 2013, Red Hat, Inc. and/or its affiliates, and individual contributors
~ by the @authors tag. See the copyright.txt in the distribution for a
~ full listing of individual contributors.
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
~ You may obtain a copy of the License at
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ JBoss, Home of Professional Open Source
~ Copyright 2013, Red Hat, Inc. and/or its affiliates, and individual contributors
~ by the @authors tag. See the copyright.txt in the distribution for a
~ full listing of individual contributors.
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
~ You may obtain a copy of the License at
@hferentschik
hferentschik / BeanELResolver
Created January 23, 2013 16:13
How a method is resolved in JUEL
private Method findMethod(Object base, String name, Class<?>[] types, int paramCount) {
if (types != null) {
try {
return findAccessibleMethod(base.getClass().getMethod(name, types));
} catch (NoSuchMethodException e) {
return null;
}
}
Method varArgsMethod = null;
for (Method method : base.getClass().getMethods()) {
private Object invokeMethod(Method m, Object base, Object[] params) {
Class[] parameterTypes = m.getParameterTypes();
Object[] parameters = null;
if (parameterTypes.length > 0) {
ExpressionFactory exprFactory = ExpressionFactory.newInstance();
if (m.isVarArgs()) {
// TODO
} else {
parameters = new Object[parameterTypes.length];
@hferentschik
hferentschik / gist:3910827
Created October 18, 2012 09:59
Java EE integration of BV

This section describes the metadata annotations and deployment descriptor entries that allow an application to obtain instances of the Bean Validation Validator and ValidatorFactory types.

Applications that need to use those interfaces can find appropriate objects by looking up the name java:comp/Validator for Validator and java:comp/ValidatorFactory for ValidatorFactory, or by requesting the injection of an object of the appropriate type via the Resource annotation. The authenticationType and shareable elements of the Resource annotation must not be specified.

@Resource ValidatorFactory validatorFactory;
@Resource Validator validator;

For Validator objects, the default validation context is used. This means that all such Validators will be equivalent to those obtained by first acquiring a ValidatorFactory and then invoking the getValidator method on it with no arguments. In other words, the following two code snippets are equivalent: