code stringlengths 23 201k | docstring stringlengths 17 96.2k | func_name stringlengths 0 235 | language stringclasses 1
value | repo stringlengths 8 72 | path stringlengths 11 317 | url stringlengths 57 377 | license stringclasses 7
values |
|---|---|---|---|---|---|---|---|
@Override
public Boolean visitDeclared(DeclaredType declaredType, Element element) {
final ElementKind kind = element.getKind();
if ( kind == ElementKind.ENUM ) {
return true;
}
else if ( isClassOrRecordType(element) || kind == ElementKind.INTERFACE ) {
final TypeElement typeElement = (TypeElement) eleme... | Checks whether the visited type is a basic attribute according to the JPA 2 spec
( section 2.8 Mapping Defaults for Non-Relationship Fields or Properties) | visitDeclared | java | hibernate/hibernate-orm | tooling/metamodel-generator/src/main/java/org/hibernate/processor/util/BasicAttributeVisitor.java | https://github.com/hibernate/hibernate-orm/blob/master/tooling/metamodel-generator/src/main/java/org/hibernate/processor/util/BasicAttributeVisitor.java | Apache-2.0 |
private boolean isSerializable(TypeElement typeElement) {
final TypeMirror serializableType =
context.getElementUtils()
.getTypeElement(Serializable.class.getName())
.asType();
return context.getTypeUtils()
.isSubtype( typeElement.asType(), serializableType );
} | Checks whether the visited type is a basic attribute according to the JPA 2 spec
( section 2.8 Mapping Defaults for Non-Relationship Fields or Properties) | isSerializable | java | hibernate/hibernate-orm | tooling/metamodel-generator/src/main/java/org/hibernate/processor/util/BasicAttributeVisitor.java | https://github.com/hibernate/hibernate-orm/blob/master/tooling/metamodel-generator/src/main/java/org/hibernate/processor/util/BasicAttributeVisitor.java | Apache-2.0 |
@EnsuresNonNull("#1")
public static <T extends @Nullable Object> @NonNull T castNonNull(@Nullable T ref) {
assert ref != null : "Misuse of castNonNull: called with a null argument";
return ref;
} | A method that suppresses warnings from the Nullness Checker.
<p>The method takes a possibly-null reference, unsafely casts it to have the @NonNull type
qualifier, and returns it. The Nullness Checker considers both the return value, and also the
argument, to be non-null after the method call. Therefore, the {@code cas... | castNonNull | java | hibernate/hibernate-orm | tooling/metamodel-generator/src/main/java/org/hibernate/processor/util/NullnessUtil.java | https://github.com/hibernate/hibernate-orm/blob/master/tooling/metamodel-generator/src/main/java/org/hibernate/processor/util/NullnessUtil.java | Apache-2.0 |
public static @EnsuresNonNull("#1") <T extends @Nullable Object> @NonNull T castNonNull(
@Nullable T ref, String message) {
assert ref != null : "Misuse of castNonNull: called with a null argument: " + message;
return ref;
} | Suppress warnings from the Nullness Checker, with a custom error message. See {@link
#castNonNull(Object)} for documentation.
@param <T> the type of the reference
@param ref a reference of @Nullable type, that is non-null at run time
@param message text to include if this method is misused
@return the argument, cast ... | castNonNull | java | hibernate/hibernate-orm | tooling/metamodel-generator/src/main/java/org/hibernate/processor/util/NullnessUtil.java | https://github.com/hibernate/hibernate-orm/blob/master/tooling/metamodel-generator/src/main/java/org/hibernate/processor/util/NullnessUtil.java | Apache-2.0 |
@EnsuresNonNull("#1")
public static <T extends @Nullable Object> @NonNull T @NonNull [] castNonNullDeep(
T @Nullable [] arr) {
return castNonNullArray( arr, null );
} | Like castNonNull, but whereas that method only checks and casts the reference itself, this
traverses all levels of the argument array. The array is recursively checked to ensure that all
elements at every array level are non-null.
@param <T> the component type of the array
@param arr an array all of whose elements, an... | castNonNullDeep | java | hibernate/hibernate-orm | tooling/metamodel-generator/src/main/java/org/hibernate/processor/util/NullnessUtil.java | https://github.com/hibernate/hibernate-orm/blob/master/tooling/metamodel-generator/src/main/java/org/hibernate/processor/util/NullnessUtil.java | Apache-2.0 |
@EnsuresNonNull("#1")
public static <T extends @Nullable Object> @NonNull T @NonNull [] castNonNullDeep(
T @Nullable [] arr, String message) {
return castNonNullArray( arr, message );
} | Like castNonNull, but whereas that method only checks and casts the reference itself, this
traverses all levels of the argument array. The array is recursively checked to ensure that all
elements at every array level are non-null.
@param <T> the component type of the array
@param arr an array all of whose elements, an... | castNonNullDeep | java | hibernate/hibernate-orm | tooling/metamodel-generator/src/main/java/org/hibernate/processor/util/NullnessUtil.java | https://github.com/hibernate/hibernate-orm/blob/master/tooling/metamodel-generator/src/main/java/org/hibernate/processor/util/NullnessUtil.java | Apache-2.0 |
@EnsuresNonNull("#1")
public static <T extends @Nullable Object> @NonNull T @NonNull [][] castNonNullDeep(
T @Nullable [] @Nullable [] arr) {
return castNonNullArray( arr, null );
} | Like castNonNull, but whereas that method only checks and casts the reference itself, this
traverses all levels of the argument array. The array is recursively checked to ensure that all
elements at every array level are non-null.
@param <T> the component type of the component type of the array
@param arr an array all... | castNonNullDeep | java | hibernate/hibernate-orm | tooling/metamodel-generator/src/main/java/org/hibernate/processor/util/NullnessUtil.java | https://github.com/hibernate/hibernate-orm/blob/master/tooling/metamodel-generator/src/main/java/org/hibernate/processor/util/NullnessUtil.java | Apache-2.0 |
@EnsuresNonNull("#1")
public static <T extends @Nullable Object> @NonNull T @NonNull [][] castNonNullDeep(
T @Nullable [] @Nullable [] arr, String message) {
return castNonNullArray( arr, message );
} | Like castNonNull, but whereas that method only checks and casts the reference itself, this
traverses all levels of the argument array. The array is recursively checked to ensure that all
elements at every array level are non-null.
@param <T> the component type of the component type of the array
@param arr an array all... | castNonNullDeep | java | hibernate/hibernate-orm | tooling/metamodel-generator/src/main/java/org/hibernate/processor/util/NullnessUtil.java | https://github.com/hibernate/hibernate-orm/blob/master/tooling/metamodel-generator/src/main/java/org/hibernate/processor/util/NullnessUtil.java | Apache-2.0 |
@EnsuresNonNull("#1")
public static <T extends @Nullable Object> @NonNull T @NonNull [][][] castNonNullDeep(
T @Nullable [] @Nullable [] @Nullable [] arr) {
return castNonNullArray( arr, null );
} | Like castNonNull, but whereas that method only checks and casts the reference itself, this
traverses all levels of the argument array. The array is recursively checked to ensure that all
elements at every array level are non-null.
@param <T> the component type (three levels in) of the array
@param arr an array all of ... | castNonNullDeep | java | hibernate/hibernate-orm | tooling/metamodel-generator/src/main/java/org/hibernate/processor/util/NullnessUtil.java | https://github.com/hibernate/hibernate-orm/blob/master/tooling/metamodel-generator/src/main/java/org/hibernate/processor/util/NullnessUtil.java | Apache-2.0 |
@EnsuresNonNull("#1")
public static <T extends @Nullable Object> @NonNull T @NonNull [][][] castNonNullDeep(
T @Nullable [] @Nullable [] @Nullable [] arr, String message) {
return castNonNullArray( arr, message );
} | Like castNonNull, but whereas that method only checks and casts the reference itself, this
traverses all levels of the argument array. The array is recursively checked to ensure that all
elements at every array level are non-null.
@param <T> the component type (three levels in) of the array
@param arr an array all of ... | castNonNullDeep | java | hibernate/hibernate-orm | tooling/metamodel-generator/src/main/java/org/hibernate/processor/util/NullnessUtil.java | https://github.com/hibernate/hibernate-orm/blob/master/tooling/metamodel-generator/src/main/java/org/hibernate/processor/util/NullnessUtil.java | Apache-2.0 |
@EnsuresNonNull("#1")
public static <T extends @Nullable Object> @NonNull T @NonNull [][][][] castNonNullDeep(
T @Nullable [] @Nullable [] @Nullable [] @Nullable [] arr) {
return castNonNullArray( arr, null );
} | Like castNonNull, but whereas that method only checks and casts the reference itself, this
traverses all levels of the argument array. The array is recursively checked to ensure that all
elements at every array level are non-null.
@param <T> the component type of the array
@param arr an array all of whose elements, an... | castNonNullDeep | java | hibernate/hibernate-orm | tooling/metamodel-generator/src/main/java/org/hibernate/processor/util/NullnessUtil.java | https://github.com/hibernate/hibernate-orm/blob/master/tooling/metamodel-generator/src/main/java/org/hibernate/processor/util/NullnessUtil.java | Apache-2.0 |
@EnsuresNonNull("#1")
public static <T extends @Nullable Object> @NonNull T @NonNull [][][][] castNonNullDeep(
T @Nullable [] @Nullable [] @Nullable [] @Nullable [] arr, String message) {
return castNonNullArray( arr, message );
} | Like castNonNull, but whereas that method only checks and casts the reference itself, this
traverses all levels of the argument array. The array is recursively checked to ensure that all
elements at every array level are non-null.
@param <T> the component type (four levels in) of the array
@param arr an array all of w... | castNonNullDeep | java | hibernate/hibernate-orm | tooling/metamodel-generator/src/main/java/org/hibernate/processor/util/NullnessUtil.java | https://github.com/hibernate/hibernate-orm/blob/master/tooling/metamodel-generator/src/main/java/org/hibernate/processor/util/NullnessUtil.java | Apache-2.0 |
@EnsuresNonNull("#1")
public static <T extends @Nullable Object> @NonNull T @NonNull [][][][][] castNonNullDeep(
T @Nullable [] @Nullable [] @Nullable [] @Nullable [] @Nullable [] arr) {
return castNonNullArray( arr, null );
} | Like castNonNull, but whereas that method only checks and casts the reference itself, this
traverses all levels of the argument array. The array is recursively checked to ensure that all
elements at every array level are non-null.
@param <T> the component type (four levels in) of the array
@param arr an array all of w... | castNonNullDeep | java | hibernate/hibernate-orm | tooling/metamodel-generator/src/main/java/org/hibernate/processor/util/NullnessUtil.java | https://github.com/hibernate/hibernate-orm/blob/master/tooling/metamodel-generator/src/main/java/org/hibernate/processor/util/NullnessUtil.java | Apache-2.0 |
@EnsuresNonNull("#1")
public static <T extends @Nullable Object> @NonNull T @NonNull [][][][][] castNonNullDeep(
T @Nullable [] @Nullable [] @Nullable [] @Nullable [] @Nullable [] arr, String message) {
return castNonNullArray( arr, message );
} | Like castNonNull, but whereas that method only checks and casts the reference itself, this
traverses all levels of the argument array. The array is recursively checked to ensure that all
elements at every array level are non-null.
@param <T> the component type (five levels in) of the array
@param arr an array all of w... | castNonNullDeep | java | hibernate/hibernate-orm | tooling/metamodel-generator/src/main/java/org/hibernate/processor/util/NullnessUtil.java | https://github.com/hibernate/hibernate-orm/blob/master/tooling/metamodel-generator/src/main/java/org/hibernate/processor/util/NullnessUtil.java | Apache-2.0 |
private static <T extends @Nullable Object> @NonNull T @NonNull [] castNonNullArray(
T @Nullable [] arr, @Nullable String message) {
assert arr != null
: "Misuse of castNonNullArray: called with a null array argument"
+ ( message == null ? "" : ": " + message );
for ( int i = 0; i < arr.length; ++i ) {
... | The implementation of castNonNullDeep.
@param <T> the component type (five levels in) of the array
@param arr an array all of whose elements, and their elements recursively, are non-null at run
time
@param message text to include if there is a non-null value, or null to use uncustomized
message
@return the argument, ... | castNonNullArray | java | hibernate/hibernate-orm | tooling/metamodel-generator/src/main/java/org/hibernate/processor/util/NullnessUtil.java | https://github.com/hibernate/hibernate-orm/blob/master/tooling/metamodel-generator/src/main/java/org/hibernate/processor/util/NullnessUtil.java | Apache-2.0 |
private static void checkIfArray(@NonNull Object ref, @Nullable String message) {
assert ref != null
: "Misuse of checkIfArray: called with a null argument"
+ ( ( message == null ) ? "" : ( ": " + message ) );
Class<?> comp = ref.getClass().getComponentType();
if ( comp != null ) {
// comp is non-null ... | If the argument is an array, requires it to be non-null at all levels.
@param ref a value; if an array, all of its elements, and their elements recursively, are
non-null at run time
@param message text to include if there is a non-null value, or null to use uncustomized
message | checkIfArray | java | hibernate/hibernate-orm | tooling/metamodel-generator/src/main/java/org/hibernate/processor/util/NullnessUtil.java | https://github.com/hibernate/hibernate-orm/blob/master/tooling/metamodel-generator/src/main/java/org/hibernate/processor/util/NullnessUtil.java | Apache-2.0 |
public static String removeDollar(String simpleName) {
return simpleName.endsWith("$")
? simpleName.substring(0, simpleName.length()-1)
: simpleName;
} | If this is an "intermediate" class providing {@code @Query}
annotations for the query by magical method name crap, then
by convention it will be named with a trailing $ sign. Strip
that off, so we get the standard constructor. | removeDollar | java | hibernate/hibernate-orm | tooling/metamodel-generator/src/main/java/org/hibernate/processor/util/StringUtil.java | https://github.com/hibernate/hibernate-orm/blob/master/tooling/metamodel-generator/src/main/java/org/hibernate/processor/util/StringUtil.java | Apache-2.0 |
public static String toTypeString(TypeMirror type) {
return type.getKind().isPrimitive()
? castNonNull( PRIMITIVE_WRAPPERS.get( type.getKind() ) )
: TypeRenderingVisitor.toString( type );
} | Utility class.
@author Max Andersen
@author Hardy Ferentschik
@author Emmanuel Bernard | toTypeString | java | hibernate/hibernate-orm | tooling/metamodel-generator/src/main/java/org/hibernate/processor/util/TypeUtils.java | https://github.com/hibernate/hibernate-orm/blob/master/tooling/metamodel-generator/src/main/java/org/hibernate/processor/util/TypeUtils.java | Apache-2.0 |
public static String toArrayTypeString(ArrayType type, Context context) {
final TypeMirror componentType = type.getComponentType();
if ( componentType.getKind().isPrimitive() ) {
return PRIMITIVES.get( componentType.getKind() ) + "[]";
}
else {
// When an ArrayType is annotated with an annotation which us... | Utility class.
@author Max Andersen
@author Hardy Ferentschik
@author Emmanuel Bernard | toArrayTypeString | java | hibernate/hibernate-orm | tooling/metamodel-generator/src/main/java/org/hibernate/processor/util/TypeUtils.java | https://github.com/hibernate/hibernate-orm/blob/master/tooling/metamodel-generator/src/main/java/org/hibernate/processor/util/TypeUtils.java | Apache-2.0 |
@Override
protected TypeMirror defaultAction(TypeMirror e, Void aVoid) {
return e;
} | Utility class.
@author Max Andersen
@author Hardy Ferentschik
@author Emmanuel Bernard | defaultAction | java | hibernate/hibernate-orm | tooling/metamodel-generator/src/main/java/org/hibernate/processor/util/TypeUtils.java | https://github.com/hibernate/hibernate-orm/blob/master/tooling/metamodel-generator/src/main/java/org/hibernate/processor/util/TypeUtils.java | Apache-2.0 |
public static @Nullable TypeElement getSuperclassTypeElement(TypeElement element) {
final TypeMirror superclass = element.getSuperclass();
//superclass of Object is of NoType which returns some other kind
if ( superclass.getKind() == TypeKind.DECLARED ) {
final DeclaredType declaredType = (DeclaredType) superc... | Utility class.
@author Max Andersen
@author Hardy Ferentschik
@author Emmanuel Bernard | getSuperclassTypeElement | java | hibernate/hibernate-orm | tooling/metamodel-generator/src/main/java/org/hibernate/processor/util/TypeUtils.java | https://github.com/hibernate/hibernate-orm/blob/master/tooling/metamodel-generator/src/main/java/org/hibernate/processor/util/TypeUtils.java | Apache-2.0 |
public static String extractClosestRealTypeAsString(TypeMirror type, Context context) {
final TypeMirror mirror = extractClosestRealType( type, context, new HashSet<>() );
return mirror == null ? "?" : mirror.toString();
} | Utility class.
@author Max Andersen
@author Hardy Ferentschik
@author Emmanuel Bernard | extractClosestRealTypeAsString | java | hibernate/hibernate-orm | tooling/metamodel-generator/src/main/java/org/hibernate/processor/util/TypeUtils.java | https://github.com/hibernate/hibernate-orm/blob/master/tooling/metamodel-generator/src/main/java/org/hibernate/processor/util/TypeUtils.java | Apache-2.0 |
private static @Nullable TypeMirror lowerBound(@Nullable TypeMirror bound) {
return bound == null || bound.getKind() == TypeKind.NULL ? null : bound;
} | Utility class.
@author Max Andersen
@author Hardy Ferentschik
@author Emmanuel Bernard | lowerBound | java | hibernate/hibernate-orm | tooling/metamodel-generator/src/main/java/org/hibernate/processor/util/TypeUtils.java | https://github.com/hibernate/hibernate-orm/blob/master/tooling/metamodel-generator/src/main/java/org/hibernate/processor/util/TypeUtils.java | Apache-2.0 |
private static @Nullable TypeMirror upperBound(@Nullable TypeMirror bound) {
if ( bound !=null && bound.getKind() == TypeKind.DECLARED ) {
final DeclaredType type = (DeclaredType) bound;
return type.asElement().getSimpleName().contentEquals(JAVA_OBJECT) ? null : bound;
}
else {
return null;
}
} | Utility class.
@author Max Andersen
@author Hardy Ferentschik
@author Emmanuel Bernard | upperBound | java | hibernate/hibernate-orm | tooling/metamodel-generator/src/main/java/org/hibernate/processor/util/TypeUtils.java | https://github.com/hibernate/hibernate-orm/blob/master/tooling/metamodel-generator/src/main/java/org/hibernate/processor/util/TypeUtils.java | Apache-2.0 |
public static @Nullable TypeMirror extractClosestRealType(TypeMirror type, Context context, Set<TypeVariable> beingVisited) {
if ( type == null ) {
return null;
}
switch ( type.getKind() ) {
case TYPEVAR:
final TypeVariable typeVariable = (TypeVariable) type;
if ( !beingVisited.add( typeVariable ) )... | Utility class.
@author Max Andersen
@author Hardy Ferentschik
@author Emmanuel Bernard | extractClosestRealType | java | hibernate/hibernate-orm | tooling/metamodel-generator/src/main/java/org/hibernate/processor/util/TypeUtils.java | https://github.com/hibernate/hibernate-orm/blob/master/tooling/metamodel-generator/src/main/java/org/hibernate/processor/util/TypeUtils.java | Apache-2.0 |
public static boolean containsAnnotation(Element element, String... annotations) {
assert element != null;
assert annotations != null;
final Set<String> annotationClassNames = Set.of(annotations);
for ( AnnotationMirror mirror : element.getAnnotationMirrors() ) {
if ( annotationClassNames.contains( mirror.ge... | Utility class.
@author Max Andersen
@author Hardy Ferentschik
@author Emmanuel Bernard | containsAnnotation | java | hibernate/hibernate-orm | tooling/metamodel-generator/src/main/java/org/hibernate/processor/util/TypeUtils.java | https://github.com/hibernate/hibernate-orm/blob/master/tooling/metamodel-generator/src/main/java/org/hibernate/processor/util/TypeUtils.java | Apache-2.0 |
public static boolean isAnnotationMirrorOfType(AnnotationMirror annotationMirror, String qualifiedName) {
assert annotationMirror != null;
assert qualifiedName != null;
final Element element = annotationMirror.getAnnotationType().asElement();
final TypeElement typeElement = (TypeElement) element;
return typeE... | Returns {@code true} if the provided annotation type is of the same type as the provided class, {@code false} otherwise.
This method uses the string class names for comparison. See also
<a href="http://www.retep.org/2009/02/getting-class-values-from-annotations.html">getting-class-values-from-annotations</a>.
@param a... | isAnnotationMirrorOfType | java | hibernate/hibernate-orm | tooling/metamodel-generator/src/main/java/org/hibernate/processor/util/TypeUtils.java | https://github.com/hibernate/hibernate-orm/blob/master/tooling/metamodel-generator/src/main/java/org/hibernate/processor/util/TypeUtils.java | Apache-2.0 |
public static @Nullable AnnotationMirror getAnnotationMirror(Element element, String qualifiedName) {
assert element != null;
assert qualifiedName != null;
for ( AnnotationMirror mirror : element.getAnnotationMirrors() ) {
if ( isAnnotationMirrorOfType( mirror, qualifiedName ) ) {
return mirror;
}
}
... | Checks whether the {@code Element} hosts the annotation with the given fully qualified class name.
@param element the element to check for the hosted annotation
@param qualifiedName the fully qualified class name of the annotation to check for
@return the annotation mirror for the specified annotation class from the ... | getAnnotationMirror | java | hibernate/hibernate-orm | tooling/metamodel-generator/src/main/java/org/hibernate/processor/util/TypeUtils.java | https://github.com/hibernate/hibernate-orm/blob/master/tooling/metamodel-generator/src/main/java/org/hibernate/processor/util/TypeUtils.java | Apache-2.0 |
public static boolean hasAnnotation(Element element, String qualifiedName) {
return getAnnotationMirror( element, qualifiedName ) != null;
} | Checks whether the {@code Element} hosts the annotation with the given fully qualified class name.
@param element the element to check for the hosted annotation
@param qualifiedName the fully qualified class name of the annotation to check for
@return the annotation mirror for the specified annotation class from the ... | hasAnnotation | java | hibernate/hibernate-orm | tooling/metamodel-generator/src/main/java/org/hibernate/processor/util/TypeUtils.java | https://github.com/hibernate/hibernate-orm/blob/master/tooling/metamodel-generator/src/main/java/org/hibernate/processor/util/TypeUtils.java | Apache-2.0 |
public static boolean hasAnnotation(Element element, String... qualifiedNames) {
for ( String qualifiedName : qualifiedNames ) {
if ( hasAnnotation( element, qualifiedName ) ) {
return true;
}
}
return false;
} | Checks whether the {@code Element} hosts the annotation with the given fully qualified class name.
@param element the element to check for the hosted annotation
@param qualifiedName the fully qualified class name of the annotation to check for
@return the annotation mirror for the specified annotation class from the ... | hasAnnotation | java | hibernate/hibernate-orm | tooling/metamodel-generator/src/main/java/org/hibernate/processor/util/TypeUtils.java | https://github.com/hibernate/hibernate-orm/blob/master/tooling/metamodel-generator/src/main/java/org/hibernate/processor/util/TypeUtils.java | Apache-2.0 |
public static @Nullable AnnotationValue getAnnotationValue(AnnotationMirror annotationMirror) {
return getAnnotationValue( annotationMirror, DEFAULT_ANNOTATION_PARAMETER_NAME );
} | Checks whether the {@code Element} hosts the annotation with the given fully qualified class name.
@param element the element to check for the hosted annotation
@param qualifiedName the fully qualified class name of the annotation to check for
@return the annotation mirror for the specified annotation class from the ... | getAnnotationValue | java | hibernate/hibernate-orm | tooling/metamodel-generator/src/main/java/org/hibernate/processor/util/TypeUtils.java | https://github.com/hibernate/hibernate-orm/blob/master/tooling/metamodel-generator/src/main/java/org/hibernate/processor/util/TypeUtils.java | Apache-2.0 |
public static @Nullable AnnotationValue getAnnotationValue(AnnotationMirror annotationMirror, String member) {
assert annotationMirror != null;
assert member != null;
for ( Map.Entry<? extends ExecutableElement, ? extends AnnotationValue> entry
: annotationMirror.getElementValues().entrySet() ) {
if ( entr... | Checks whether the {@code Element} hosts the annotation with the given fully qualified class name.
@param element the element to check for the hosted annotation
@param qualifiedName the fully qualified class name of the annotation to check for
@return the annotation mirror for the specified annotation class from the ... | getAnnotationValue | java | hibernate/hibernate-orm | tooling/metamodel-generator/src/main/java/org/hibernate/processor/util/TypeUtils.java | https://github.com/hibernate/hibernate-orm/blob/master/tooling/metamodel-generator/src/main/java/org/hibernate/processor/util/TypeUtils.java | Apache-2.0 |
public static void determineAccessTypeForHierarchy(TypeElement searchedElement, Context context) {
final String qualifiedName = searchedElement.getQualifiedName().toString();
context.logMessage( Diagnostic.Kind.OTHER, "Determining access type for " + qualifiedName );
final AccessTypeInformation accessTypeInfo = c... | Checks whether the {@code Element} hosts the annotation with the given fully qualified class name.
@param element the element to check for the hosted annotation
@param qualifiedName the fully qualified class name of the annotation to check for
@return the annotation mirror for the specified annotation class from the ... | determineAccessTypeForHierarchy | java | hibernate/hibernate-orm | tooling/metamodel-generator/src/main/java/org/hibernate/processor/util/TypeUtils.java | https://github.com/hibernate/hibernate-orm/blob/master/tooling/metamodel-generator/src/main/java/org/hibernate/processor/util/TypeUtils.java | Apache-2.0 |
public static TypeMirror getCollectionElementType(
DeclaredType type, String returnTypeName, @Nullable String explicitTargetEntityName, Context context) {
if ( explicitTargetEntityName != null ) {
return context.getElementUtils().getTypeElement( explicitTargetEntityName ).asType();
}
else {
final List<? ... | Checks whether the {@code Element} hosts the annotation with the given fully qualified class name.
@param element the element to check for the hosted annotation
@param qualifiedName the fully qualified class name of the annotation to check for
@return the annotation mirror for the specified annotation class from the ... | getCollectionElementType | java | hibernate/hibernate-orm | tooling/metamodel-generator/src/main/java/org/hibernate/processor/util/TypeUtils.java | https://github.com/hibernate/hibernate-orm/blob/master/tooling/metamodel-generator/src/main/java/org/hibernate/processor/util/TypeUtils.java | Apache-2.0 |
private static void updateEmbeddableAccessType(TypeElement element, Context context, AccessType defaultAccessType) {
for ( Element field : ElementFilter.fieldsIn( element.getEnclosedElements() ) ) {
updateEmbeddableAccessTypeForMember( context, defaultAccessType, field );
}
for ( Element method : ElementFilte... | Checks whether the {@code Element} hosts the annotation with the given fully qualified class name.
@param element the element to check for the hosted annotation
@param qualifiedName the fully qualified class name of the annotation to check for
@return the annotation mirror for the specified annotation class from the ... | updateEmbeddableAccessType | java | hibernate/hibernate-orm | tooling/metamodel-generator/src/main/java/org/hibernate/processor/util/TypeUtils.java | https://github.com/hibernate/hibernate-orm/blob/master/tooling/metamodel-generator/src/main/java/org/hibernate/processor/util/TypeUtils.java | Apache-2.0 |
private static void updateEmbeddableAccessTypeForMember(Context context, AccessType defaultAccessType, Element member) {
final @Nullable TypeElement embedded = member.asType().accept( new EmbeddedAttributeVisitor( context ), member );
if ( embedded != null ) {
updateEmbeddableAccessType( context, defaultAccessTy... | Checks whether the {@code Element} hosts the annotation with the given fully qualified class name.
@param element the element to check for the hosted annotation
@param qualifiedName the fully qualified class name of the annotation to check for
@return the annotation mirror for the specified annotation class from the ... | updateEmbeddableAccessTypeForMember | java | hibernate/hibernate-orm | tooling/metamodel-generator/src/main/java/org/hibernate/processor/util/TypeUtils.java | https://github.com/hibernate/hibernate-orm/blob/master/tooling/metamodel-generator/src/main/java/org/hibernate/processor/util/TypeUtils.java | Apache-2.0 |
private static void updateEmbeddableAccessType(Context context, AccessType defaultAccessType, TypeElement embedded) {
final String embeddedClassName = embedded.getQualifiedName().toString();
final AccessTypeInformation accessTypeInfo = context.getAccessTypeInfo(embeddedClassName);
if ( accessTypeInfo == null ) {
... | Checks whether the {@code Element} hosts the annotation with the given fully qualified class name.
@param element the element to check for the hosted annotation
@param qualifiedName the fully qualified class name of the annotation to check for
@return the annotation mirror for the specified annotation class from the ... | updateEmbeddableAccessType | java | hibernate/hibernate-orm | tooling/metamodel-generator/src/main/java/org/hibernate/processor/util/TypeUtils.java | https://github.com/hibernate/hibernate-orm/blob/master/tooling/metamodel-generator/src/main/java/org/hibernate/processor/util/TypeUtils.java | Apache-2.0 |
private static @Nullable AccessType getDefaultAccessForHierarchy(TypeElement element, Context context) {
AccessType defaultAccessType = null;
TypeElement superClass = element;
do {
superClass = getSuperclassTypeElement( superClass );
if ( superClass != null ) {
final String qualifiedName = superClass.ge... | Checks whether the {@code Element} hosts the annotation with the given fully qualified class name.
@param element the element to check for the hosted annotation
@param qualifiedName the fully qualified class name of the annotation to check for
@return the annotation mirror for the specified annotation class from the ... | getDefaultAccessForHierarchy | java | hibernate/hibernate-orm | tooling/metamodel-generator/src/main/java/org/hibernate/processor/util/TypeUtils.java | https://github.com/hibernate/hibernate-orm/blob/master/tooling/metamodel-generator/src/main/java/org/hibernate/processor/util/TypeUtils.java | Apache-2.0 |
private static void setDefaultAccessTypeForMappedSuperclassesInHierarchy(TypeElement element, AccessType defaultAccessType, Context context) {
TypeElement superClass = element;
do {
superClass = getSuperclassTypeElement( superClass );
if ( superClass != null ) {
final String qualifiedName = superClass.get... | Checks whether the {@code Element} hosts the annotation with the given fully qualified class name.
@param element the element to check for the hosted annotation
@param qualifiedName the fully qualified class name of the annotation to check for
@return the annotation mirror for the specified annotation class from the ... | setDefaultAccessTypeForMappedSuperclassesInHierarchy | java | hibernate/hibernate-orm | tooling/metamodel-generator/src/main/java/org/hibernate/processor/util/TypeUtils.java | https://github.com/hibernate/hibernate-orm/blob/master/tooling/metamodel-generator/src/main/java/org/hibernate/processor/util/TypeUtils.java | Apache-2.0 |
private static @Nullable AccessType getAccessTypeInCaseElementIsRoot(TypeElement searchedElement, Context context) {
for ( Element subElement : searchedElement.getEnclosedElements() ) {
for ( AnnotationMirror entityAnnotation :
context.getElementUtils().getAllAnnotationMirrors( subElement ) ) {
if ( isIdA... | Iterates all elements of a type to check whether they contain the id annotation. If so the placement of this
annotation determines the access type
@param searchedElement the type to be searched
@param context The global execution context
@return returns the access type of the element annotated with the id annotation.... | getAccessTypeInCaseElementIsRoot | java | hibernate/hibernate-orm | tooling/metamodel-generator/src/main/java/org/hibernate/processor/util/TypeUtils.java | https://github.com/hibernate/hibernate-orm/blob/master/tooling/metamodel-generator/src/main/java/org/hibernate/processor/util/TypeUtils.java | Apache-2.0 |
private static @Nullable AccessType getAccessTypeOfIdAnnotation(Element element) {
return switch ( element.getKind() ) {
case FIELD -> AccessType.FIELD;
case METHOD -> AccessType.PROPERTY;
default -> null;
};
} | Iterates all elements of a type to check whether they contain the id annotation. If so the placement of this
annotation determines the access type
@param searchedElement the type to be searched
@param context The global execution context
@return returns the access type of the element annotated with the id annotation.... | getAccessTypeOfIdAnnotation | java | hibernate/hibernate-orm | tooling/metamodel-generator/src/main/java/org/hibernate/processor/util/TypeUtils.java | https://github.com/hibernate/hibernate-orm/blob/master/tooling/metamodel-generator/src/main/java/org/hibernate/processor/util/TypeUtils.java | Apache-2.0 |
private static boolean isIdAnnotation(AnnotationMirror annotationMirror) {
return isAnnotationMirrorOfType( annotationMirror, ID )
|| isAnnotationMirrorOfType( annotationMirror, EMBEDDED_ID );
} | Iterates all elements of a type to check whether they contain the id annotation. If so the placement of this
annotation determines the access type
@param searchedElement the type to be searched
@param context The global execution context
@return returns the access type of the element annotated with the id annotation.... | isIdAnnotation | java | hibernate/hibernate-orm | tooling/metamodel-generator/src/main/java/org/hibernate/processor/util/TypeUtils.java | https://github.com/hibernate/hibernate-orm/blob/master/tooling/metamodel-generator/src/main/java/org/hibernate/processor/util/TypeUtils.java | Apache-2.0 |
public static @Nullable AccessType determineAnnotationSpecifiedAccessType(Element element) {
final AnnotationMirror mirror = getAnnotationMirror( element, ACCESS );
if ( mirror != null ) {
final AnnotationValue accessType = getAnnotationValue( mirror );
if ( accessType != null ) {
final VariableElement en... | Iterates all elements of a type to check whether they contain the id annotation. If so the placement of this
annotation determines the access type
@param searchedElement the type to be searched
@param context The global execution context
@return returns the access type of the element annotated with the id annotation.... | determineAnnotationSpecifiedAccessType | java | hibernate/hibernate-orm | tooling/metamodel-generator/src/main/java/org/hibernate/processor/util/TypeUtils.java | https://github.com/hibernate/hibernate-orm/blob/master/tooling/metamodel-generator/src/main/java/org/hibernate/processor/util/TypeUtils.java | Apache-2.0 |
public static ElementKind getElementKindForAccessType(AccessType accessType) {
return accessType == AccessType.FIELD ? ElementKind.FIELD : ElementKind.METHOD;
} | Iterates all elements of a type to check whether they contain the id annotation. If so the placement of this
annotation determines the access type
@param searchedElement the type to be searched
@param context The global execution context
@return returns the access type of the element annotated with the id annotation.... | getElementKindForAccessType | java | hibernate/hibernate-orm | tooling/metamodel-generator/src/main/java/org/hibernate/processor/util/TypeUtils.java | https://github.com/hibernate/hibernate-orm/blob/master/tooling/metamodel-generator/src/main/java/org/hibernate/processor/util/TypeUtils.java | Apache-2.0 |
public static String getKeyType(DeclaredType type, Context context) {
final List<? extends TypeMirror> typeArguments = type.getTypeArguments();
if ( typeArguments.isEmpty() ) {
context.logMessage( Diagnostic.Kind.ERROR, "Unable to determine type argument for " + type );
return JAVA_OBJECT;
}
else {
ret... | Iterates all elements of a type to check whether they contain the id annotation. If so the placement of this
annotation determines the access type
@param searchedElement the type to be searched
@param context The global execution context
@return returns the access type of the element annotated with the id annotation.... | getKeyType | java | hibernate/hibernate-orm | tooling/metamodel-generator/src/main/java/org/hibernate/processor/util/TypeUtils.java | https://github.com/hibernate/hibernate-orm/blob/master/tooling/metamodel-generator/src/main/java/org/hibernate/processor/util/TypeUtils.java | Apache-2.0 |
public static boolean isClassOrRecordType(Element element) {
final ElementKind kind = element.getKind();
// we want to accept classes and records but not enums,
// and we want to avoid depending on ElementKind.RECORD
return kind.isClass() && kind != ElementKind.ENUM;
} | Iterates all elements of a type to check whether they contain the id annotation. If so the placement of this
annotation determines the access type
@param searchedElement the type to be searched
@param context The global execution context
@return returns the access type of the element annotated with the id annotation.... | isClassOrRecordType | java | hibernate/hibernate-orm | tooling/metamodel-generator/src/main/java/org/hibernate/processor/util/TypeUtils.java | https://github.com/hibernate/hibernate-orm/blob/master/tooling/metamodel-generator/src/main/java/org/hibernate/processor/util/TypeUtils.java | Apache-2.0 |
public static boolean isClassRecordOrInterfaceType(Element element) {
final ElementKind kind = element.getKind();
// we want to accept classes and records but not enums,
// and we want to avoid depending on ElementKind.RECORD
return kind.isClass() && kind != ElementKind.ENUM
|| kind.isInterface() && kind != ... | Iterates all elements of a type to check whether they contain the id annotation. If so the placement of this
annotation determines the access type
@param searchedElement the type to be searched
@param context The global execution context
@return returns the access type of the element annotated with the id annotation.... | isClassRecordOrInterfaceType | java | hibernate/hibernate-orm | tooling/metamodel-generator/src/main/java/org/hibernate/processor/util/TypeUtils.java | https://github.com/hibernate/hibernate-orm/blob/master/tooling/metamodel-generator/src/main/java/org/hibernate/processor/util/TypeUtils.java | Apache-2.0 |
public static boolean primitiveClassMatchesKind(Class<?> itemType, TypeKind kind) {
return switch ( kind ) {
case SHORT -> itemType.equals( Short.class );
case INT -> itemType.equals( Integer.class );
case LONG -> itemType.equals( Long.class );
case BOOLEAN -> itemType.equals( Boolean.class );
case FLO... | Iterates all elements of a type to check whether they contain the id annotation. If so the placement of this
annotation determines the access type
@param searchedElement the type to be searched
@param context The global execution context
@return returns the access type of the element annotated with the id annotation.... | primitiveClassMatchesKind | java | hibernate/hibernate-orm | tooling/metamodel-generator/src/main/java/org/hibernate/processor/util/TypeUtils.java | https://github.com/hibernate/hibernate-orm/blob/master/tooling/metamodel-generator/src/main/java/org/hibernate/processor/util/TypeUtils.java | Apache-2.0 |
public static boolean isPropertyGetter(ExecutableType executable, Element element) {
return element.getKind() == ElementKind.METHOD
&& isProperty( element.getSimpleName().toString(),
toTypeString( executable.getReturnType() ) );
} | Iterates all elements of a type to check whether they contain the id annotation. If so the placement of this
annotation determines the access type
@param searchedElement the type to be searched
@param context The global execution context
@return returns the access type of the element annotated with the id annotation.... | isPropertyGetter | java | hibernate/hibernate-orm | tooling/metamodel-generator/src/main/java/org/hibernate/processor/util/TypeUtils.java | https://github.com/hibernate/hibernate-orm/blob/master/tooling/metamodel-generator/src/main/java/org/hibernate/processor/util/TypeUtils.java | Apache-2.0 |
public static boolean isBasicAttribute(Element element, Element returnedElement, Context context) {
return hasAnnotation( element, BASIC, ONE_TO_ONE, MANY_TO_ONE, EMBEDDED, EMBEDDED_ID, ID )
|| hasAnnotation( element, "org.hibernate.annotations.Type") // METAGEN-28
|| returnedElement.asType().accept( new BasicA... | Iterates all elements of a type to check whether they contain the id annotation. If so the placement of this
annotation determines the access type
@param searchedElement the type to be searched
@param context The global execution context
@return returns the access type of the element annotated with the id annotation.... | isBasicAttribute | java | hibernate/hibernate-orm | tooling/metamodel-generator/src/main/java/org/hibernate/processor/util/TypeUtils.java | https://github.com/hibernate/hibernate-orm/blob/master/tooling/metamodel-generator/src/main/java/org/hibernate/processor/util/TypeUtils.java | Apache-2.0 |
public static @Nullable String getFullyQualifiedClassNameOfTargetEntity(
AnnotationMirror mirror, String member) {
final AnnotationValue value = getAnnotationValue( mirror, member);
if ( value != null ) {
final TypeMirror parameterType = (TypeMirror) value.getValue();
if ( parameterType.getKind() != TypeKi... | Iterates all elements of a type to check whether they contain the id annotation. If so the placement of this
annotation determines the access type
@param searchedElement the type to be searched
@param context The global execution context
@return returns the access type of the element annotated with the id annotation.... | getFullyQualifiedClassNameOfTargetEntity | java | hibernate/hibernate-orm | tooling/metamodel-generator/src/main/java/org/hibernate/processor/util/TypeUtils.java | https://github.com/hibernate/hibernate-orm/blob/master/tooling/metamodel-generator/src/main/java/org/hibernate/processor/util/TypeUtils.java | Apache-2.0 |
public static @Nullable String getTargetEntity(List<? extends AnnotationMirror> annotations) {
for ( AnnotationMirror mirror : annotations ) {
if ( isAnnotationMirrorOfType( mirror, ELEMENT_COLLECTION ) ) {
return getFullyQualifiedClassNameOfTargetEntity( mirror, "targetClass" );
}
else if ( isAnnotation... | @param annotations list of annotation mirrors.
@return target entity class name as string or {@code null} if no targetEntity is here or if equals to void | getTargetEntity | java | hibernate/hibernate-orm | tooling/metamodel-generator/src/main/java/org/hibernate/processor/util/TypeUtils.java | https://github.com/hibernate/hibernate-orm/blob/master/tooling/metamodel-generator/src/main/java/org/hibernate/processor/util/TypeUtils.java | Apache-2.0 |
public static String propertyName(Element element) {
switch ( element.getKind() ) {
case FIELD:
return element.getSimpleName().toString();
case METHOD:
final Name name = element.getSimpleName();
if ( name.length() > 3 && name.subSequence( 0, 3 ).equals( "get" ) ) {
return decapitalize( name.sub... | @param annotations list of annotation mirrors.
@return target entity class name as string or {@code null} if no targetEntity is here or if equals to void | propertyName | java | hibernate/hibernate-orm | tooling/metamodel-generator/src/main/java/org/hibernate/processor/util/TypeUtils.java | https://github.com/hibernate/hibernate-orm/blob/master/tooling/metamodel-generator/src/main/java/org/hibernate/processor/util/TypeUtils.java | Apache-2.0 |
public static @Nullable Element findMappedSuperElement(Metamodel entity, Context context) {
final Element element = entity.getElement();
if ( element instanceof TypeElement typeElement ) {
TypeMirror superClass = typeElement.getSuperclass();
//superclass of Object is of NoType which returns some other kind
... | @param annotations list of annotation mirrors.
@return target entity class name as string or {@code null} if no targetEntity is here or if equals to void | findMappedSuperElement | java | hibernate/hibernate-orm | tooling/metamodel-generator/src/main/java/org/hibernate/processor/util/TypeUtils.java | https://github.com/hibernate/hibernate-orm/blob/master/tooling/metamodel-generator/src/main/java/org/hibernate/processor/util/TypeUtils.java | Apache-2.0 |
private static boolean extendsSuperMetaModel(Element superClassElement, boolean entityMetaComplete, Context context) {
// if we processed the superclass in the same run we definitely need to extend
final TypeElement typeElement = (TypeElement) superClassElement;
final String superClassName = typeElement.getQualif... | Checks whether this metamodel class needs to extend another metamodel class.
This method checks whether the processor has generated a metamodel class for the super class, but it also
allows for the possibility that the metamodel class was generated in a previous compilation. (It could be
part of a separate jar. See als... | extendsSuperMetaModel | java | hibernate/hibernate-orm | tooling/metamodel-generator/src/main/java/org/hibernate/processor/util/TypeUtils.java | https://github.com/hibernate/hibernate-orm/blob/master/tooling/metamodel-generator/src/main/java/org/hibernate/processor/util/TypeUtils.java | Apache-2.0 |
public static boolean implementsInterface(TypeElement type, String interfaceName) {
for ( TypeMirror iface : type.getInterfaces() ) {
if ( iface.getKind() == TypeKind.DECLARED ) {
final DeclaredType declaredType = (DeclaredType) iface;
final TypeElement typeElement = (TypeElement) declaredType.asElement();... | Checks whether this metamodel class needs to extend another metamodel class.
This method checks whether the processor has generated a metamodel class for the super class, but it also
allows for the possibility that the metamodel class was generated in a previous compilation. (It could be
part of a separate jar. See als... | implementsInterface | java | hibernate/hibernate-orm | tooling/metamodel-generator/src/main/java/org/hibernate/processor/util/TypeUtils.java | https://github.com/hibernate/hibernate-orm/blob/master/tooling/metamodel-generator/src/main/java/org/hibernate/processor/util/TypeUtils.java | Apache-2.0 |
public static boolean extendsClass(TypeElement type, String className) {
TypeMirror superclass = type.getSuperclass();
while ( superclass != null && superclass.getKind() == TypeKind.DECLARED ) {
final DeclaredType declaredType = (DeclaredType) superclass;
final TypeElement typeElement = (TypeElement) declare... | Checks whether this metamodel class needs to extend another metamodel class.
This method checks whether the processor has generated a metamodel class for the super class, but it also
allows for the possibility that the metamodel class was generated in a previous compilation. (It could be
part of a separate jar. See als... | extendsClass | java | hibernate/hibernate-orm | tooling/metamodel-generator/src/main/java/org/hibernate/processor/util/TypeUtils.java | https://github.com/hibernate/hibernate-orm/blob/master/tooling/metamodel-generator/src/main/java/org/hibernate/processor/util/TypeUtils.java | Apache-2.0 |
public static boolean isMemberType(Element element) {
return element.getEnclosingElement() instanceof TypeElement;
} | Checks whether this metamodel class needs to extend another metamodel class.
This method checks whether the processor has generated a metamodel class for the super class, but it also
allows for the possibility that the metamodel class was generated in a previous compilation. (It could be
part of a separate jar. See als... | isMemberType | java | hibernate/hibernate-orm | tooling/metamodel-generator/src/main/java/org/hibernate/processor/util/TypeUtils.java | https://github.com/hibernate/hibernate-orm/blob/master/tooling/metamodel-generator/src/main/java/org/hibernate/processor/util/TypeUtils.java | Apache-2.0 |
public static String getGeneratedClassFullyQualifiedName(TypeElement typeElement, boolean jakartaDataStyle) {
final String simpleName = typeElement.getSimpleName().toString();
final Element enclosingElement = typeElement.getEnclosingElement();
return qualifiedName( enclosingElement, jakartaDataStyle )
+ "." +... | Checks whether this metamodel class needs to extend another metamodel class.
This method checks whether the processor has generated a metamodel class for the super class, but it also
allows for the possibility that the metamodel class was generated in a previous compilation. (It could be
part of a separate jar. See als... | getGeneratedClassFullyQualifiedName | java | hibernate/hibernate-orm | tooling/metamodel-generator/src/main/java/org/hibernate/processor/util/TypeUtils.java | https://github.com/hibernate/hibernate-orm/blob/master/tooling/metamodel-generator/src/main/java/org/hibernate/processor/util/TypeUtils.java | Apache-2.0 |
private static String qualifiedName(Element enclosingElement, boolean jakartaDataStyle) {
if ( enclosingElement instanceof TypeElement typeElement ) {
return getGeneratedClassFullyQualifiedName( typeElement, jakartaDataStyle );
}
else if ( enclosingElement instanceof PackageElement packageElement ) {
return... | Checks whether this metamodel class needs to extend another metamodel class.
This method checks whether the processor has generated a metamodel class for the super class, but it also
allows for the possibility that the metamodel class was generated in a previous compilation. (It could be
part of a separate jar. See als... | qualifiedName | java | hibernate/hibernate-orm | tooling/metamodel-generator/src/main/java/org/hibernate/processor/util/TypeUtils.java | https://github.com/hibernate/hibernate-orm/blob/master/tooling/metamodel-generator/src/main/java/org/hibernate/processor/util/TypeUtils.java | Apache-2.0 |
public static String getGeneratedClassFullyQualifiedName(TypeElement element, String packageName, boolean jakartaDataStyle) {
final StringBuilder builder = new StringBuilder( packageName );
final Name qualifiedName = element.getQualifiedName();
final String tail = qualifiedName.subSequence( builder.length(), qual... | Checks whether this metamodel class needs to extend another metamodel class.
This method checks whether the processor has generated a metamodel class for the super class, but it also
allows for the possibility that the metamodel class was generated in a previous compilation. (It could be
part of a separate jar. See als... | getGeneratedClassFullyQualifiedName | java | hibernate/hibernate-orm | tooling/metamodel-generator/src/main/java/org/hibernate/processor/util/TypeUtils.java | https://github.com/hibernate/hibernate-orm/blob/master/tooling/metamodel-generator/src/main/java/org/hibernate/processor/util/TypeUtils.java | Apache-2.0 |
@Override
public @Nullable TypeElement visitDeclared(DeclaredType declaredType, Element element) {
final TypeElement returnedElement = (TypeElement)
context.getTypeUtils().asElement( declaredType );
return containsAnnotation( castNonNull( returnedElement ), EMBEDDABLE ) ? returnedElement : null;
} | Checks whether this metamodel class needs to extend another metamodel class.
This method checks whether the processor has generated a metamodel class for the super class, but it also
allows for the possibility that the metamodel class was generated in a previous compilation. (It could be
part of a separate jar. See als... | visitDeclared | java | hibernate/hibernate-orm | tooling/metamodel-generator/src/main/java/org/hibernate/processor/util/TypeUtils.java | https://github.com/hibernate/hibernate-orm/blob/master/tooling/metamodel-generator/src/main/java/org/hibernate/processor/util/TypeUtils.java | Apache-2.0 |
@Override
public @Nullable TypeElement visitExecutable(ExecutableType executable, Element element) {
if ( element.getKind().equals( ElementKind.METHOD ) ) {
final String string = element.getSimpleName().toString();
return isProperty( string, toTypeString( executable.getReturnType() ) )
? executable.g... | Checks whether this metamodel class needs to extend another metamodel class.
This method checks whether the processor has generated a metamodel class for the super class, but it also
allows for the possibility that the metamodel class was generated in a previous compilation. (It could be
part of a separate jar. See als... | visitExecutable | java | hibernate/hibernate-orm | tooling/metamodel-generator/src/main/java/org/hibernate/processor/util/TypeUtils.java | https://github.com/hibernate/hibernate-orm/blob/master/tooling/metamodel-generator/src/main/java/org/hibernate/processor/util/TypeUtils.java | Apache-2.0 |
public static boolean isPrimitive(String paramType) {
return PRIMITIVE_TYPES.contains( paramType );
} | Checks whether this metamodel class needs to extend another metamodel class.
This method checks whether the processor has generated a metamodel class for the super class, but it also
allows for the possibility that the metamodel class was generated in a previous compilation. (It could be
part of a separate jar. See als... | isPrimitive | java | hibernate/hibernate-orm | tooling/metamodel-generator/src/main/java/org/hibernate/processor/util/TypeUtils.java | https://github.com/hibernate/hibernate-orm/blob/master/tooling/metamodel-generator/src/main/java/org/hibernate/processor/util/TypeUtils.java | Apache-2.0 |
@Override
public boolean handleEvent(ValidationEvent validationEvent) {
ValidationEventLocator locator = validationEvent.getLocator();
lineNumber = locator.getLineNumber();
columnNumber = locator.getColumnNumber();
message = validationEvent.getMessage();
return false;
} | Validation event handler used for obtaining line and column numbers in case of parsing failures.
@author Hardy Ferentschik | handleEvent | java | hibernate/hibernate-orm | tooling/metamodel-generator/src/main/java/org/hibernate/processor/util/xml/ContextProvidingValidationEventHandler.java | https://github.com/hibernate/hibernate-orm/blob/master/tooling/metamodel-generator/src/main/java/org/hibernate/processor/util/xml/ContextProvidingValidationEventHandler.java | Apache-2.0 |
public int getLineNumber() {
return lineNumber;
} | Validation event handler used for obtaining line and column numbers in case of parsing failures.
@author Hardy Ferentschik | getLineNumber | java | hibernate/hibernate-orm | tooling/metamodel-generator/src/main/java/org/hibernate/processor/util/xml/ContextProvidingValidationEventHandler.java | https://github.com/hibernate/hibernate-orm/blob/master/tooling/metamodel-generator/src/main/java/org/hibernate/processor/util/xml/ContextProvidingValidationEventHandler.java | Apache-2.0 |
public int getColumnNumber() {
return columnNumber;
} | Validation event handler used for obtaining line and column numbers in case of parsing failures.
@author Hardy Ferentschik | getColumnNumber | java | hibernate/hibernate-orm | tooling/metamodel-generator/src/main/java/org/hibernate/processor/util/xml/ContextProvidingValidationEventHandler.java | https://github.com/hibernate/hibernate-orm/blob/master/tooling/metamodel-generator/src/main/java/org/hibernate/processor/util/xml/ContextProvidingValidationEventHandler.java | Apache-2.0 |
public String getMessage() {
return message;
} | Validation event handler used for obtaining line and column numbers in case of parsing failures.
@author Hardy Ferentschik | getMessage | java | hibernate/hibernate-orm | tooling/metamodel-generator/src/main/java/org/hibernate/processor/util/xml/ContextProvidingValidationEventHandler.java | https://github.com/hibernate/hibernate-orm/blob/master/tooling/metamodel-generator/src/main/java/org/hibernate/processor/util/xml/ContextProvidingValidationEventHandler.java | Apache-2.0 |
@Override
public XMLEvent peek() throws XMLStreamException {
return wrap( super.peek() );
} | Transforms the version attribute and namespace of the JPA configuration files (persistence.xml and orm.xml) to
the default. For the purpose of the metamodel it is enough to parse the xml against the latest specification version
and schema.
@author Hardy Ferentschik | peek | java | hibernate/hibernate-orm | tooling/metamodel-generator/src/main/java/org/hibernate/processor/util/xml/JpaNamespaceTransformingEventReader.java | https://github.com/hibernate/hibernate-orm/blob/master/tooling/metamodel-generator/src/main/java/org/hibernate/processor/util/xml/JpaNamespaceTransformingEventReader.java | Apache-2.0 |
@Override
public XMLEvent nextEvent() throws XMLStreamException {
return wrap( super.nextEvent() );
} | Transforms the version attribute and namespace of the JPA configuration files (persistence.xml and orm.xml) to
the default. For the purpose of the metamodel it is enough to parse the xml against the latest specification version
and schema.
@author Hardy Ferentschik | nextEvent | java | hibernate/hibernate-orm | tooling/metamodel-generator/src/main/java/org/hibernate/processor/util/xml/JpaNamespaceTransformingEventReader.java | https://github.com/hibernate/hibernate-orm/blob/master/tooling/metamodel-generator/src/main/java/org/hibernate/processor/util/xml/JpaNamespaceTransformingEventReader.java | Apache-2.0 |
private XMLEvent wrap(XMLEvent event) {
if ( event != null && event.isStartElement() ) {
return transform( event.asStartElement() );
}
return event;
} | Transforms the version attribute and namespace of the JPA configuration files (persistence.xml and orm.xml) to
the default. For the purpose of the metamodel it is enough to parse the xml against the latest specification version
and schema.
@author Hardy Ferentschik | wrap | java | hibernate/hibernate-orm | tooling/metamodel-generator/src/main/java/org/hibernate/processor/util/xml/JpaNamespaceTransformingEventReader.java | https://github.com/hibernate/hibernate-orm/blob/master/tooling/metamodel-generator/src/main/java/org/hibernate/processor/util/xml/JpaNamespaceTransformingEventReader.java | Apache-2.0 |
private StartElement transform(StartElement startElement) {
String elementName = startElement.getName().getLocalPart();
// use the start element to determine whether we have a persistence.xml or orm.xml
if ( START_ELEMENT_TO_NAMESPACE_URI.containsKey( elementName ) ) {
currentDocumentNamespaceUri = START_ELEME... | Transforms the version attribute and namespace of the JPA configuration files (persistence.xml and orm.xml) to
the default. For the purpose of the metamodel it is enough to parse the xml against the latest specification version
and schema.
@author Hardy Ferentschik | transform | java | hibernate/hibernate-orm | tooling/metamodel-generator/src/main/java/org/hibernate/processor/util/xml/JpaNamespaceTransformingEventReader.java | https://github.com/hibernate/hibernate-orm/blob/master/tooling/metamodel-generator/src/main/java/org/hibernate/processor/util/xml/JpaNamespaceTransformingEventReader.java | Apache-2.0 |
private List<Namespace> updateElementNamespaces(StartElement startElement) {
List<Namespace> newNamespaceList = new ArrayList<>();
Iterator<Namespace> existingNamespaceIterator = startElement.getNamespaces();
while ( existingNamespaceIterator.hasNext() ) {
Namespace namespace = existingNamespaceIterator.next()... | Transforms the version attribute and namespace of the JPA configuration files (persistence.xml and orm.xml) to
the default. For the purpose of the metamodel it is enough to parse the xml against the latest specification version
and schema.
@author Hardy Ferentschik | updateElementNamespaces | java | hibernate/hibernate-orm | tooling/metamodel-generator/src/main/java/org/hibernate/processor/util/xml/JpaNamespaceTransformingEventReader.java | https://github.com/hibernate/hibernate-orm/blob/master/tooling/metamodel-generator/src/main/java/org/hibernate/processor/util/xml/JpaNamespaceTransformingEventReader.java | Apache-2.0 |
private List<Attribute> updateElementAttributes(StartElement startElement) {
// adjust the version attribute
List<Attribute> newElementAttributeList = new ArrayList<>();
Iterator<Attribute> existingAttributesIterator = startElement.getAttributes();
while ( existingAttributesIterator.hasNext() ) {
Attribute a... | Transforms the version attribute and namespace of the JPA configuration files (persistence.xml and orm.xml) to
the default. For the purpose of the metamodel it is enough to parse the xml against the latest specification version
and schema.
@author Hardy Ferentschik | updateElementAttributes | java | hibernate/hibernate-orm | tooling/metamodel-generator/src/main/java/org/hibernate/processor/util/xml/JpaNamespaceTransformingEventReader.java | https://github.com/hibernate/hibernate-orm/blob/master/tooling/metamodel-generator/src/main/java/org/hibernate/processor/util/xml/JpaNamespaceTransformingEventReader.java | Apache-2.0 |
public @Nullable InputStream getInputStreamForResource(String resource) {
// METAGEN-75
if ( !resource.startsWith( RESOURCE_PATH_SEPARATOR ) ) {
resource = RESOURCE_PATH_SEPARATOR + resource;
}
String pkg = getPackage( resource );
String name = getRelativeName( resource );
InputStream ormStream;
try {... | Returns an input stream for the specified resource. First an attempt is made to load the resource
via the {@code Filer} API and if that fails {@link Class#getResourceAsStream} is used.
@param resource the resource to load
@return an input stream for the specified resource or {@code null} in case resource cannot be l... | getInputStreamForResource | java | hibernate/hibernate-orm | tooling/metamodel-generator/src/main/java/org/hibernate/processor/util/xml/XmlParserHelper.java | https://github.com/hibernate/hibernate-orm/blob/master/tooling/metamodel-generator/src/main/java/org/hibernate/processor/util/xml/XmlParserHelper.java | Apache-2.0 |
public Schema getSchema(String schemaResource) throws XmlParsingException {
Schema schema = SCHEMA_CACHE.get( schemaResource );
if ( schema != null ) {
return schema;
}
schema = loadSchema( schemaResource );
Schema previous = SCHEMA_CACHE.putIfAbsent( schemaResource, schema );
return previous != null ... | Returns an input stream for the specified resource. First an attempt is made to load the resource
via the {@code Filer} API and if that fails {@link Class#getResourceAsStream} is used.
@param resource the resource to load
@return an input stream for the specified resource or {@code null} in case resource cannot be l... | getSchema | java | hibernate/hibernate-orm | tooling/metamodel-generator/src/main/java/org/hibernate/processor/util/xml/XmlParserHelper.java | https://github.com/hibernate/hibernate-orm/blob/master/tooling/metamodel-generator/src/main/java/org/hibernate/processor/util/xml/XmlParserHelper.java | Apache-2.0 |
public <T> T getJaxbRoot(InputStream stream, Class<T> clazz, Schema schema)
throws XmlParsingException {
XMLEventReader staxEventReader;
try {
staxEventReader = createXmlEventReader( stream );
}
catch ( XMLStreamException e ) {
throw new XmlParsingException( "Unable to create stax reader", e );
}
... | Returns an input stream for the specified resource. First an attempt is made to load the resource
via the {@code Filer} API and if that fails {@link Class#getResourceAsStream} is used.
@param resource the resource to load
@return an input stream for the specified resource or {@code null} in case resource cannot be l... | getJaxbRoot | java | hibernate/hibernate-orm | tooling/metamodel-generator/src/main/java/org/hibernate/processor/util/xml/XmlParserHelper.java | https://github.com/hibernate/hibernate-orm/blob/master/tooling/metamodel-generator/src/main/java/org/hibernate/processor/util/xml/XmlParserHelper.java | Apache-2.0 |
private synchronized XMLEventReader createXmlEventReader(InputStream xmlStream) throws XMLStreamException {
return XML_INPUT_FACTORY.createXMLEventReader( xmlStream );
} | Returns an input stream for the specified resource. First an attempt is made to load the resource
via the {@code Filer} API and if that fails {@link Class#getResourceAsStream} is used.
@param resource the resource to load
@return an input stream for the specified resource or {@code null} in case resource cannot be l... | createXmlEventReader | java | hibernate/hibernate-orm | tooling/metamodel-generator/src/main/java/org/hibernate/processor/util/xml/XmlParserHelper.java | https://github.com/hibernate/hibernate-orm/blob/master/tooling/metamodel-generator/src/main/java/org/hibernate/processor/util/xml/XmlParserHelper.java | Apache-2.0 |
private String getPackage(String resourceName) {
if ( !resourceName.contains("/") ) {
return "";
}
else {
return resourceName.substring( 0, resourceName.lastIndexOf("/") );
}
} | Returns an input stream for the specified resource. First an attempt is made to load the resource
via the {@code Filer} API and if that fails {@link Class#getResourceAsStream} is used.
@param resource the resource to load
@return an input stream for the specified resource or {@code null} in case resource cannot be l... | getPackage | java | hibernate/hibernate-orm | tooling/metamodel-generator/src/main/java/org/hibernate/processor/util/xml/XmlParserHelper.java | https://github.com/hibernate/hibernate-orm/blob/master/tooling/metamodel-generator/src/main/java/org/hibernate/processor/util/xml/XmlParserHelper.java | Apache-2.0 |
private String getRelativeName(String resourceName) {
if ( !resourceName.contains("/") ) {
return resourceName;
}
else {
return resourceName.substring( resourceName.lastIndexOf("/") + 1 );
}
} | Returns an input stream for the specified resource. First an attempt is made to load the resource
via the {@code Filer} API and if that fails {@link Class#getResourceAsStream} is used.
@param resource the resource to load
@return an input stream for the specified resource or {@code null} in case resource cannot be l... | getRelativeName | java | hibernate/hibernate-orm | tooling/metamodel-generator/src/main/java/org/hibernate/processor/util/xml/XmlParserHelper.java | https://github.com/hibernate/hibernate-orm/blob/master/tooling/metamodel-generator/src/main/java/org/hibernate/processor/util/xml/XmlParserHelper.java | Apache-2.0 |
private Schema loadSchema(String schemaName) throws XmlParsingException {
URL schemaUrl = NullnessUtil.castNonNull( this.getClass().getClassLoader() ).getResource( schemaName );
if ( schemaUrl == null ) {
throw new IllegalArgumentException( "Couldn't find schema on classpath: " + schemaName );
}
SchemaFacto... | Returns an input stream for the specified resource. First an attempt is made to load the resource
via the {@code Filer} API and if that fails {@link Class#getResourceAsStream} is used.
@param resource the resource to load
@return an input stream for the specified resource or {@code null} in case resource cannot be l... | loadSchema | java | hibernate/hibernate-orm | tooling/metamodel-generator/src/main/java/org/hibernate/processor/util/xml/XmlParserHelper.java | https://github.com/hibernate/hibernate-orm/blob/master/tooling/metamodel-generator/src/main/java/org/hibernate/processor/util/xml/XmlParserHelper.java | Apache-2.0 |
public static MockSessionFactory create(
ProcessingEnvironment environment,
Map<String,String> entityNameMappings,
Map<String, Set<String>> enumTypesByValue,
boolean indexing) {
return instance.make(environment, indexing, entityNameMappings, enumTypesByValue);
} | Implementation of the {@code Mock} objects based on standard
annotation processor APIs. Note that alternative implementations
exist in the Query Validator project.
@author Gavin King | create | java | hibernate/hibernate-orm | tooling/metamodel-generator/src/main/java/org/hibernate/processor/validation/ProcessorSessionFactory.java | https://github.com/hibernate/hibernate-orm/blob/master/tooling/metamodel-generator/src/main/java/org/hibernate/processor/validation/ProcessorSessionFactory.java | Apache-2.0 |
@Override
MockEntityPersister createMockEntityPersister(String entityName) {
final TypeElement type = findEntityClass(entityName);
return type == null ? null : entityPersister.make(entityName, type, this);
} | Implementation of the {@code Mock} objects based on standard
annotation processor APIs. Note that alternative implementations
exist in the Query Validator project.
@author Gavin King | createMockEntityPersister | java | hibernate/hibernate-orm | tooling/metamodel-generator/src/main/java/org/hibernate/processor/validation/ProcessorSessionFactory.java | https://github.com/hibernate/hibernate-orm/blob/master/tooling/metamodel-generator/src/main/java/org/hibernate/processor/validation/ProcessorSessionFactory.java | Apache-2.0 |
@Override
MockCollectionPersister createMockCollectionPersister(String role) {
final String entityName = root(role); //only works because entity names don't contain dots
final String propertyPath = unroot(role);
final TypeElement entityClass = findEntityClass(entityName);
final AccessType defaultAccessType = g... | Implementation of the {@code Mock} objects based on standard
annotation processor APIs. Note that alternative implementations
exist in the Query Validator project.
@author Gavin King | createMockCollectionPersister | java | hibernate/hibernate-orm | tooling/metamodel-generator/src/main/java/org/hibernate/processor/validation/ProcessorSessionFactory.java | https://github.com/hibernate/hibernate-orm/blob/master/tooling/metamodel-generator/src/main/java/org/hibernate/processor/validation/ProcessorSessionFactory.java | Apache-2.0 |
@Override
Type propertyType(String typeName, String propertyPath) {
final TypeElement type = findClassByQualifiedName(typeName);
final AccessType accessType = getAccessType(type, AccessType.FIELD);
final Element propertyByPath = findPropertyByPath(type, propertyPath, accessType);
return propertyByPath == null ... | Implementation of the {@code Mock} objects based on standard
annotation processor APIs. Note that alternative implementations
exist in the Query Validator project.
@author Gavin King | propertyType | java | hibernate/hibernate-orm | tooling/metamodel-generator/src/main/java/org/hibernate/processor/validation/ProcessorSessionFactory.java | https://github.com/hibernate/hibernate-orm/blob/master/tooling/metamodel-generator/src/main/java/org/hibernate/processor/validation/ProcessorSessionFactory.java | Apache-2.0 |
private static Element findPropertyByPath(TypeElement type,
String propertyPath,
AccessType defaultAccessType) {
return stream(split(".", propertyPath))
.reduce((Element) type,
(symbol, segment) -> dereference( defaultAccessType, symbol, segment ),
(last, current) -> current);
} | Implementation of the {@code Mock} objects based on standard
annotation processor APIs. Note that alternative implementations
exist in the Query Validator project.
@author Gavin King | findPropertyByPath | java | hibernate/hibernate-orm | tooling/metamodel-generator/src/main/java/org/hibernate/processor/validation/ProcessorSessionFactory.java | https://github.com/hibernate/hibernate-orm/blob/master/tooling/metamodel-generator/src/main/java/org/hibernate/processor/validation/ProcessorSessionFactory.java | Apache-2.0 |
private static Element dereference(AccessType defaultAccessType, Element symbol, String segment) {
if (symbol == null) {
return null;
}
else {
return asElement(symbol.asType()) instanceof TypeElement element
? findProperty(element, segment, defaultAccessType)
: null;
}
} | Implementation of the {@code Mock} objects based on standard
annotation processor APIs. Note that alternative implementations
exist in the Query Validator project.
@author Gavin King | dereference | java | hibernate/hibernate-orm | tooling/metamodel-generator/src/main/java/org/hibernate/processor/validation/ProcessorSessionFactory.java | https://github.com/hibernate/hibernate-orm/blob/master/tooling/metamodel-generator/src/main/java/org/hibernate/processor/validation/ProcessorSessionFactory.java | Apache-2.0 |
private Type propertyType(Element member, String entityName, String path, AccessType defaultAccessType) {
final TypeMirror memberType = memberType(member);
if (isEmbeddedProperty(member)) {
return componentType( entityName, path, defaultAccessType, memberType );
}
else if (isToOneAssociation(member)) {
re... | Implementation of the {@code Mock} objects based on standard
annotation processor APIs. Note that alternative implementations
exist in the Query Validator project.
@author Gavin King | propertyType | java | hibernate/hibernate-orm | tooling/metamodel-generator/src/main/java/org/hibernate/processor/validation/ProcessorSessionFactory.java | https://github.com/hibernate/hibernate-orm/blob/master/tooling/metamodel-generator/src/main/java/org/hibernate/processor/validation/ProcessorSessionFactory.java | Apache-2.0 |
private Component componentType(String entityName, String path, AccessType defaultAccessType, TypeMirror memberType) {
return component.make( asElement( memberType ), entityName, path, defaultAccessType, this );
} | Implementation of the {@code Mock} objects based on standard
annotation processor APIs. Note that alternative implementations
exist in the Query Validator project.
@author Gavin King | componentType | java | hibernate/hibernate-orm | tooling/metamodel-generator/src/main/java/org/hibernate/processor/validation/ProcessorSessionFactory.java | https://github.com/hibernate/hibernate-orm/blob/master/tooling/metamodel-generator/src/main/java/org/hibernate/processor/validation/ProcessorSessionFactory.java | Apache-2.0 |
@SuppressWarnings({"rawtypes", "unchecked"})
private static BasicType<?> enumType(Element member, TypeMirror memberType) {
final Class<Enum> enumClass = Enum.class; // because we can't load the real enum class!
return enumType( member, qualifiedName( memberType ), enumClass );
} | Implementation of the {@code Mock} objects based on standard
annotation processor APIs. Note that alternative implementations
exist in the Query Validator project.
@author Gavin King | enumType | java | hibernate/hibernate-orm | tooling/metamodel-generator/src/main/java/org/hibernate/processor/validation/ProcessorSessionFactory.java | https://github.com/hibernate/hibernate-orm/blob/master/tooling/metamodel-generator/src/main/java/org/hibernate/processor/validation/ProcessorSessionFactory.java | Apache-2.0 |
private static <T extends Enum<T>> BasicType<T> enumType(Element member, String typeName, Class<T> enumClass) {
final EnumJavaType<T> javaType = new EnumJavaType<>( enumClass ) {
@Override
public String getTypeName() {
return typeName;
}
};
return new BasicTypeImpl<>( javaType, enumJdbcType(member) )... | Implementation of the {@code Mock} objects based on standard
annotation processor APIs. Note that alternative implementations
exist in the Query Validator project.
@author Gavin King | enumType | java | hibernate/hibernate-orm | tooling/metamodel-generator/src/main/java/org/hibernate/processor/validation/ProcessorSessionFactory.java | https://github.com/hibernate/hibernate-orm/blob/master/tooling/metamodel-generator/src/main/java/org/hibernate/processor/validation/ProcessorSessionFactory.java | Apache-2.0 |
@Override
public String getTypeName() {
return typeName;
} | Implementation of the {@code Mock} objects based on standard
annotation processor APIs. Note that alternative implementations
exist in the Query Validator project.
@author Gavin King | getTypeName | java | hibernate/hibernate-orm | tooling/metamodel-generator/src/main/java/org/hibernate/processor/validation/ProcessorSessionFactory.java | https://github.com/hibernate/hibernate-orm/blob/master/tooling/metamodel-generator/src/main/java/org/hibernate/processor/validation/ProcessorSessionFactory.java | Apache-2.0 |
@Override
public String getTypeName() {
return typeName;
} | Implementation of the {@code Mock} objects based on standard
annotation processor APIs. Note that alternative implementations
exist in the Query Validator project.
@author Gavin King | getTypeName | java | hibernate/hibernate-orm | tooling/metamodel-generator/src/main/java/org/hibernate/processor/validation/ProcessorSessionFactory.java | https://github.com/hibernate/hibernate-orm/blob/master/tooling/metamodel-generator/src/main/java/org/hibernate/processor/validation/ProcessorSessionFactory.java | Apache-2.0 |
private static JdbcType enumJdbcType(Element member) {
final VariableElement mapping = (VariableElement)
getAnnotationMember(getAnnotation(member,"Enumerated"), "value");
return mapping != null && mapping.getSimpleName().contentEquals("STRING")
? VarcharJdbcType.INSTANCE
: IntegerJdbcType.INSTANCE;
} | Implementation of the {@code Mock} objects based on standard
annotation processor APIs. Note that alternative implementations
exist in the Query Validator project.
@author Gavin King | enumJdbcType | java | hibernate/hibernate-orm | tooling/metamodel-generator/src/main/java/org/hibernate/processor/validation/ProcessorSessionFactory.java | https://github.com/hibernate/hibernate-orm/blob/master/tooling/metamodel-generator/src/main/java/org/hibernate/processor/validation/ProcessorSessionFactory.java | Apache-2.0 |
@Override @Nullable
Set<String> getEnumTypesForValue(String value) {
final Set<String> result = enumTypesByValue.get(value);
if ( result != null ) {
return result;
}
if ( indexing ) {
final Set<String> indexed = getIndexedEnumTypesByValue(value);
if ( indexed != null ) {
enumTypesByValue.put(value... | Implementation of the {@code Mock} objects based on standard
annotation processor APIs. Note that alternative implementations
exist in the Query Validator project.
@author Gavin King | getEnumTypesForValue | java | hibernate/hibernate-orm | tooling/metamodel-generator/src/main/java/org/hibernate/processor/validation/ProcessorSessionFactory.java | https://github.com/hibernate/hibernate-orm/blob/master/tooling/metamodel-generator/src/main/java/org/hibernate/processor/validation/ProcessorSessionFactory.java | Apache-2.0 |
private @Nullable Set<String> getIndexedEnumTypesByValue(String value) {
try (Reader reader = filer.getResource( StandardLocation.SOURCE_OUTPUT, ENTITY_INDEX, value )
.openReader( true ); BufferedReader buffered = new BufferedReader( reader )) {
return Set.of( split( " ", buffered.readLine() ) );
}
catch (... | Implementation of the {@code Mock} objects based on standard
annotation processor APIs. Note that alternative implementations
exist in the Query Validator project.
@author Gavin King | getIndexedEnumTypesByValue | java | hibernate/hibernate-orm | tooling/metamodel-generator/src/main/java/org/hibernate/processor/validation/ProcessorSessionFactory.java | https://github.com/hibernate/hibernate-orm/blob/master/tooling/metamodel-generator/src/main/java/org/hibernate/processor/validation/ProcessorSessionFactory.java | Apache-2.0 |
private static Type elementCollectionElementType(TypeElement elementType,
String role, String path,
AccessType defaultAccessType,
MockSessionFactory factory) {
if (isEmbeddableType(elementType)) {
return component.make(elementType, role, path, defaultAccessType, factory);
}
else {
return factory.ge... | Implementation of the {@code Mock} objects based on standard
annotation processor APIs. Note that alternative implementations
exist in the Query Validator project.
@author Gavin King | elementCollectionElementType | java | hibernate/hibernate-orm | tooling/metamodel-generator/src/main/java/org/hibernate/processor/validation/ProcessorSessionFactory.java | https://github.com/hibernate/hibernate-orm/blob/master/tooling/metamodel-generator/src/main/java/org/hibernate/processor/validation/ProcessorSessionFactory.java | Apache-2.0 |
private static CollectionType collectionType(TypeMirror type, String role) {
return createCollectionType(role, simpleName(type));
} | Implementation of the {@code Mock} objects based on standard
annotation processor APIs. Note that alternative implementations
exist in the Query Validator project.
@author Gavin King | collectionType | java | hibernate/hibernate-orm | tooling/metamodel-generator/src/main/java/org/hibernate/processor/validation/ProcessorSessionFactory.java | https://github.com/hibernate/hibernate-orm/blob/master/tooling/metamodel-generator/src/main/java/org/hibernate/processor/validation/ProcessorSessionFactory.java | Apache-2.0 |
@Override
public int getPropertyIndex(String name) {
final String[] names = getPropertyNames();
for ( int i = 0, max = names.length; i < max; i++ ) {
if ( names[i].equals( name ) ) {
return i;
}
}
throw new PropertyNotFoundException(
"Could not resolve attribute '" + name + "' of '" + ge... | Implementation of the {@code Mock} objects based on standard
annotation processor APIs. Note that alternative implementations
exist in the Query Validator project.
@author Gavin King | getPropertyIndex | java | hibernate/hibernate-orm | tooling/metamodel-generator/src/main/java/org/hibernate/processor/validation/ProcessorSessionFactory.java | https://github.com/hibernate/hibernate-orm/blob/master/tooling/metamodel-generator/src/main/java/org/hibernate/processor/validation/ProcessorSessionFactory.java | Apache-2.0 |
@Override
public String getName() {
return type.getSimpleName().toString();
} | Implementation of the {@code Mock} objects based on standard
annotation processor APIs. Note that alternative implementations
exist in the Query Validator project.
@author Gavin King | getName | java | hibernate/hibernate-orm | tooling/metamodel-generator/src/main/java/org/hibernate/processor/validation/ProcessorSessionFactory.java | https://github.com/hibernate/hibernate-orm/blob/master/tooling/metamodel-generator/src/main/java/org/hibernate/processor/validation/ProcessorSessionFactory.java | Apache-2.0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.