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
private List<MetaAttribute> getIdMemberNames(List<VariableElement> fields, List<ExecutableElement> methods) { final List<MetaAttribute> components = new ArrayList<>(); for ( var field : fields ) { if ( isIdField( field ) ) { final String propertyName = propertyName( field ); if ( members.containsKey( pro...
Creates a generated id class named {@code Entity_.Id} if the entity has multiple {@code @Id} fields, but no {@code @IdClass} annotation.
getIdMemberNames
java
hibernate/hibernate-orm
tooling/metamodel-generator/src/main/java/org/hibernate/processor/annotation/AnnotationMetaEntity.java
https://github.com/hibernate/hibernate-orm/blob/master/tooling/metamodel-generator/src/main/java/org/hibernate/processor/annotation/AnnotationMetaEntity.java
Apache-2.0
private void checkIdMembers(List<VariableElement> fields, List<ExecutableElement> methods) { final AnnotationMirror annotationMirror = getAnnotationMirror( element, ID_CLASS ); if ( annotationMirror != null ) { final AnnotationValue annotationValue = getAnnotationValue( annotationMirror ); if ( annotationValu...
Creates a generated id class named {@code Entity_.Id} if the entity has multiple {@code @Id} fields, but no {@code @IdClass} annotation.
checkIdMembers
java
hibernate/hibernate-orm
tooling/metamodel-generator/src/main/java/org/hibernate/processor/annotation/AnnotationMetaEntity.java
https://github.com/hibernate/hibernate-orm/blob/master/tooling/metamodel-generator/src/main/java/org/hibernate/processor/annotation/AnnotationMetaEntity.java
Apache-2.0
private boolean isIdProperty(ExecutableElement method) { return hasAnnotation( method, ID ) && isPersistent( method, AccessType.PROPERTY ); }
Creates a generated id class named {@code Entity_.Id} if the entity has multiple {@code @Id} fields, but no {@code @IdClass} annotation.
isIdProperty
java
hibernate/hibernate-orm
tooling/metamodel-generator/src/main/java/org/hibernate/processor/annotation/AnnotationMetaEntity.java
https://github.com/hibernate/hibernate-orm/blob/master/tooling/metamodel-generator/src/main/java/org/hibernate/processor/annotation/AnnotationMetaEntity.java
Apache-2.0
private boolean isIdField(VariableElement field) { return hasAnnotation( field, ID ) && isPersistent( field, AccessType.FIELD ); }
Creates a generated id class named {@code Entity_.Id} if the entity has multiple {@code @Id} fields, but no {@code @IdClass} annotation.
isIdField
java
hibernate/hibernate-orm
tooling/metamodel-generator/src/main/java/org/hibernate/processor/annotation/AnnotationMetaEntity.java
https://github.com/hibernate/hibernate-orm/blob/master/tooling/metamodel-generator/src/main/java/org/hibernate/processor/annotation/AnnotationMetaEntity.java
Apache-2.0
private static Stream<? extends Element> memberStream(TypeElement idClass) { Stream<? extends Element> result = idClass.getEnclosedElements().stream(); TypeMirror superclass = idClass.getSuperclass(); while ( superclass.getKind() == TypeKind.DECLARED ) { final DeclaredType declaredType = (DeclaredType) supercl...
Creates a generated id class named {@code Entity_.Id} if the entity has multiple {@code @Id} fields, but no {@code @IdClass} annotation.
memberStream
java
hibernate/hibernate-orm
tooling/metamodel-generator/src/main/java/org/hibernate/processor/annotation/AnnotationMetaEntity.java
https://github.com/hibernate/hibernate-orm/blob/master/tooling/metamodel-generator/src/main/java/org/hibernate/processor/annotation/AnnotationMetaEntity.java
Apache-2.0
private boolean isMatchingIdType(Element id, TypeMirror type, TypeMirror match) { return isSameType( type, match ) || isEquivalentPrimitiveType( type, match ) || isEquivalentPrimitiveType( match, type ) //TODO: check the id type of the associated entity || hasAnnotation( id, MANY_TO_ONE, ONE_TO_ONE ); }
Creates a generated id class named {@code Entity_.Id} if the entity has multiple {@code @Id} fields, but no {@code @IdClass} annotation.
isMatchingIdType
java
hibernate/hibernate-orm
tooling/metamodel-generator/src/main/java/org/hibernate/processor/annotation/AnnotationMetaEntity.java
https://github.com/hibernate/hibernate-orm/blob/master/tooling/metamodel-generator/src/main/java/org/hibernate/processor/annotation/AnnotationMetaEntity.java
Apache-2.0
private boolean isSameType(TypeMirror type, TypeMirror match) { return context.getTypeUtils().isSameType( type, match ); }
Creates a generated id class named {@code Entity_.Id} if the entity has multiple {@code @Id} fields, but no {@code @IdClass} annotation.
isSameType
java
hibernate/hibernate-orm
tooling/metamodel-generator/src/main/java/org/hibernate/processor/annotation/AnnotationMetaEntity.java
https://github.com/hibernate/hibernate-orm/blob/master/tooling/metamodel-generator/src/main/java/org/hibernate/processor/annotation/AnnotationMetaEntity.java
Apache-2.0
private boolean isEquivalentPrimitiveType(TypeMirror type, TypeMirror match) { return type.getKind().isPrimitive() && isSameType( context.getTypeUtils().boxedClass( ((PrimitiveType) type) ).asType(), match ); }
Creates a generated id class named {@code Entity_.Id} if the entity has multiple {@code @Id} fields, but no {@code @IdClass} annotation.
isEquivalentPrimitiveType
java
hibernate/hibernate-orm
tooling/metamodel-generator/src/main/java/org/hibernate/processor/annotation/AnnotationMetaEntity.java
https://github.com/hibernate/hibernate-orm/blob/master/tooling/metamodel-generator/src/main/java/org/hibernate/processor/annotation/AnnotationMetaEntity.java
Apache-2.0
private boolean checkEntities(List<ExecutableElement> lifecycleMethods, boolean hibernateRepo) { boolean foundPersistenceEntity = false; VariableElement nonPersistenceParameter = null; for (ExecutableElement lifecycleMethod : lifecycleMethods) { final List<? extends VariableElement> parameters = lifecycleMetho...
Creates a generated id class named {@code Entity_.Id} if the entity has multiple {@code @Id} fields, but no {@code @IdClass} annotation.
checkEntities
java
hibernate/hibernate-orm
tooling/metamodel-generator/src/main/java/org/hibernate/processor/annotation/AnnotationMetaEntity.java
https://github.com/hibernate/hibernate-orm/blob/master/tooling/metamodel-generator/src/main/java/org/hibernate/processor/annotation/AnnotationMetaEntity.java
Apache-2.0
private void validateStatelessSessionType() { if ( !isStatelessSession() ) { message( element, "repository must be backed by a 'StatelessSession'", Diagnostic.Kind.ERROR ); } }
Creates a generated id class named {@code Entity_.Id} if the entity has multiple {@code @Id} fields, but no {@code @IdClass} annotation.
validateStatelessSessionType
java
hibernate/hibernate-orm
tooling/metamodel-generator/src/main/java/org/hibernate/processor/annotation/AnnotationMetaEntity.java
https://github.com/hibernate/hibernate-orm/blob/master/tooling/metamodel-generator/src/main/java/org/hibernate/processor/annotation/AnnotationMetaEntity.java
Apache-2.0
private static @Nullable TypeElement primaryEntity(TypeElement element) { for (TypeMirror typeMirror : element.getInterfaces()) { final DeclaredType declaredType = (DeclaredType) typeMirror; final TypeElement typeElement = (TypeElement) declaredType.asElement(); final Name name = typeElement.getQualifiedName...
Creates a generated id class named {@code Entity_.Id} if the entity has multiple {@code @Id} fields, but no {@code @IdClass} annotation.
primaryEntity
java
hibernate/hibernate-orm
tooling/metamodel-generator/src/main/java/org/hibernate/processor/annotation/AnnotationMetaEntity.java
https://github.com/hibernate/hibernate-orm/blob/master/tooling/metamodel-generator/src/main/java/org/hibernate/processor/annotation/AnnotationMetaEntity.java
Apache-2.0
private @Nullable TypeElement primaryEntity(List<ExecutableElement> lifecycleMethods) { // first see if we are a subtype of DataRepository // in that case, the first type argument determines // the primary entity type TypeElement result = primaryEntity(element); if ( result != null ) { return result; } ...
Creates a generated id class named {@code Entity_.Id} if the entity has multiple {@code @Id} fields, but no {@code @IdClass} annotation.
primaryEntity
java
hibernate/hibernate-orm
tooling/metamodel-generator/src/main/java/org/hibernate/processor/annotation/AnnotationMetaEntity.java
https://github.com/hibernate/hibernate-orm/blob/master/tooling/metamodel-generator/src/main/java/org/hibernate/processor/annotation/AnnotationMetaEntity.java
Apache-2.0
private void addDefaultConstructor() { final String sessionVariableName = getSessionVariableName(sessionType); putMember("_", new DefaultConstructor( this, getConstructorName(), sessionVariableName, sessionType, sessionVariableName, dataStore(), context.addInjectAnnotation() )); }
Creates a generated id class named {@code Entity_.Id} if the entity has multiple {@code @Id} fields, but no {@code @IdClass} annotation.
addDefaultConstructor
java
hibernate/hibernate-orm
tooling/metamodel-generator/src/main/java/org/hibernate/processor/annotation/AnnotationMetaEntity.java
https://github.com/hibernate/hibernate-orm/blob/master/tooling/metamodel-generator/src/main/java/org/hibernate/processor/annotation/AnnotationMetaEntity.java
Apache-2.0
private @Nullable String dataStore() { final AnnotationMirror repo = getAnnotationMirror( element, JD_REPOSITORY ); if ( repo != null ) { final AnnotationValue dataStoreValue = getAnnotationValue( repo, "dataStore" ); if (dataStoreValue != null) { final String dataStore = dataStoreValue.getValue().toStrin...
Creates a generated id class named {@code Entity_.Id} if the entity has multiple {@code @Id} fields, but no {@code @IdClass} annotation.
dataStore
java
hibernate/hibernate-orm
tooling/metamodel-generator/src/main/java/org/hibernate/processor/annotation/AnnotationMetaEntity.java
https://github.com/hibernate/hibernate-orm/blob/master/tooling/metamodel-generator/src/main/java/org/hibernate/processor/annotation/AnnotationMetaEntity.java
Apache-2.0
private void setupSession() { if ( element.getTypeParameters().isEmpty() ) { jakartaDataRepository = hasAnnotation( element, JD_REPOSITORY ); final ExecutableElement getter = findSessionGetter( element ); if ( getter != null ) { // Never make a DAO for Panache subtypes if ( !isPanacheType( element ) ...
Creates a generated id class named {@code Entity_.Id} if the entity has multiple {@code @Id} fields, but no {@code @IdClass} annotation.
setupSession
java
hibernate/hibernate-orm
tooling/metamodel-generator/src/main/java/org/hibernate/processor/annotation/AnnotationMetaEntity.java
https://github.com/hibernate/hibernate-orm/blob/master/tooling/metamodel-generator/src/main/java/org/hibernate/processor/annotation/AnnotationMetaEntity.java
Apache-2.0
private boolean needsEventBus() { return jakartaDataRepository && !isReactive() // non-reactive && context.isDataEventPackageAvailable() // events && context.addInjectAnnotation() // @nject && context.addDependentAnnotation(); // CDI }
Creates a generated id class named {@code Entity_.Id} if the entity has multiple {@code @Id} fields, but no {@code @IdClass} annotation.
needsEventBus
java
hibernate/hibernate-orm
tooling/metamodel-generator/src/main/java/org/hibernate/processor/annotation/AnnotationMetaEntity.java
https://github.com/hibernate/hibernate-orm/blob/master/tooling/metamodel-generator/src/main/java/org/hibernate/processor/annotation/AnnotationMetaEntity.java
Apache-2.0
void addEventBus() { putMember("_event", new EventField(this) ); }
Creates a generated id class named {@code Entity_.Id} if the entity has multiple {@code @Id} fields, but no {@code @IdClass} annotation.
addEventBus
java
hibernate/hibernate-orm
tooling/metamodel-generator/src/main/java/org/hibernate/processor/annotation/AnnotationMetaEntity.java
https://github.com/hibernate/hibernate-orm/blob/master/tooling/metamodel-generator/src/main/java/org/hibernate/processor/annotation/AnnotationMetaEntity.java
Apache-2.0
boolean needsDefaultConstructor() { return jakartaDataRepository && !quarkusInjection && context.addDependentAnnotation(); }
For usage with CDI, but outside Quarkus, Jakarta Data repositories use {@code @PersistenceUnit} to obtain an {@code EntityManagerFactory} via field injection. So in that case we will need a {@link DefaultConstructor default constructor}. We don't do this in Quarkus, because there we can just inject the {@code Stateless...
needsDefaultConstructor
java
hibernate/hibernate-orm
tooling/metamodel-generator/src/main/java/org/hibernate/processor/annotation/AnnotationMetaEntity.java
https://github.com/hibernate/hibernate-orm/blob/master/tooling/metamodel-generator/src/main/java/org/hibernate/processor/annotation/AnnotationMetaEntity.java
Apache-2.0
private @Nullable ExecutableElement findSessionGetter(TypeElement type) { if ( !hasAnnotation( type, ENTITY, MAPPED_SUPERCLASS, EMBEDDABLE ) || isPanacheType( type ) ) { for ( ExecutableElement method : methodsIn( type.getEnclosedElements() ) ) { if ( isSessionGetter( method ) ) { return method; }...
For usage with CDI, but outside Quarkus, Jakarta Data repositories use {@code @PersistenceUnit} to obtain an {@code EntityManagerFactory} via field injection. So in that case we will need a {@link DefaultConstructor default constructor}. We don't do this in Quarkus, because there we can just inject the {@code Stateless...
findSessionGetter
java
hibernate/hibernate-orm
tooling/metamodel-generator/src/main/java/org/hibernate/processor/annotation/AnnotationMetaEntity.java
https://github.com/hibernate/hibernate-orm/blob/master/tooling/metamodel-generator/src/main/java/org/hibernate/processor/annotation/AnnotationMetaEntity.java
Apache-2.0
public boolean isStatelessSession() { return usingStatelessSession(sessionType); }
For usage with CDI, but outside Quarkus, Jakarta Data repositories use {@code @PersistenceUnit} to obtain an {@code EntityManagerFactory} via field injection. So in that case we will need a {@link DefaultConstructor default constructor}. We don't do this in Quarkus, because there we can just inject the {@code Stateless...
isStatelessSession
java
hibernate/hibernate-orm
tooling/metamodel-generator/src/main/java/org/hibernate/processor/annotation/AnnotationMetaEntity.java
https://github.com/hibernate/hibernate-orm/blob/master/tooling/metamodel-generator/src/main/java/org/hibernate/processor/annotation/AnnotationMetaEntity.java
Apache-2.0
public boolean isReactive() { return usingReactiveSession(sessionType); }
For usage with CDI, but outside Quarkus, Jakarta Data repositories use {@code @PersistenceUnit} to obtain an {@code EntityManagerFactory} via field injection. So in that case we will need a {@link DefaultConstructor default constructor}. We don't do this in Quarkus, because there we can just inject the {@code Stateless...
isReactive
java
hibernate/hibernate-orm
tooling/metamodel-generator/src/main/java/org/hibernate/processor/annotation/AnnotationMetaEntity.java
https://github.com/hibernate/hibernate-orm/blob/master/tooling/metamodel-generator/src/main/java/org/hibernate/processor/annotation/AnnotationMetaEntity.java
Apache-2.0
public boolean isReactiveSessionAccess() { return usingReactiveSessionAccess(sessionType); }
For usage with CDI, but outside Quarkus, Jakarta Data repositories use {@code @PersistenceUnit} to obtain an {@code EntityManagerFactory} via field injection. So in that case we will need a {@link DefaultConstructor default constructor}. We don't do this in Quarkus, because there we can just inject the {@code Stateless...
isReactiveSessionAccess
java
hibernate/hibernate-orm
tooling/metamodel-generator/src/main/java/org/hibernate/processor/annotation/AnnotationMetaEntity.java
https://github.com/hibernate/hibernate-orm/blob/master/tooling/metamodel-generator/src/main/java/org/hibernate/processor/annotation/AnnotationMetaEntity.java
Apache-2.0
private boolean isPanacheType(TypeElement type) { return context.usesQuarkusOrm() && isOrmPanacheType( type ) || context.usesQuarkusReactive() && isReactivePanacheType( type ); }
For usage with CDI, but outside Quarkus, Jakarta Data repositories use {@code @PersistenceUnit} to obtain an {@code EntityManagerFactory} via field injection. So in that case we will need a {@link DefaultConstructor default constructor}. We don't do this in Quarkus, because there we can just inject the {@code Stateless...
isPanacheType
java
hibernate/hibernate-orm
tooling/metamodel-generator/src/main/java/org/hibernate/processor/annotation/AnnotationMetaEntity.java
https://github.com/hibernate/hibernate-orm/blob/master/tooling/metamodel-generator/src/main/java/org/hibernate/processor/annotation/AnnotationMetaEntity.java
Apache-2.0
private boolean isOrmPanacheType(TypeElement type) { return implementsInterface( type, PANACHE_ORM_REPOSITORY_BASE ) || extendsClass( type, PANACHE_ORM_ENTITY_BASE ); }
For usage with CDI, but outside Quarkus, Jakarta Data repositories use {@code @PersistenceUnit} to obtain an {@code EntityManagerFactory} via field injection. So in that case we will need a {@link DefaultConstructor default constructor}. We don't do this in Quarkus, because there we can just inject the {@code Stateless...
isOrmPanacheType
java
hibernate/hibernate-orm
tooling/metamodel-generator/src/main/java/org/hibernate/processor/annotation/AnnotationMetaEntity.java
https://github.com/hibernate/hibernate-orm/blob/master/tooling/metamodel-generator/src/main/java/org/hibernate/processor/annotation/AnnotationMetaEntity.java
Apache-2.0
private boolean isReactivePanacheType(TypeElement type) { return implementsInterface( type, PANACHE_REACTIVE_REPOSITORY_BASE ) || extendsClass( type, PANACHE_REACTIVE_ENTITY_BASE ); }
For usage with CDI, but outside Quarkus, Jakarta Data repositories use {@code @PersistenceUnit} to obtain an {@code EntityManagerFactory} via field injection. So in that case we will need a {@link DefaultConstructor default constructor}. We don't do this in Quarkus, because there we can just inject the {@code Stateless...
isReactivePanacheType
java
hibernate/hibernate-orm
tooling/metamodel-generator/src/main/java/org/hibernate/processor/annotation/AnnotationMetaEntity.java
https://github.com/hibernate/hibernate-orm/blob/master/tooling/metamodel-generator/src/main/java/org/hibernate/processor/annotation/AnnotationMetaEntity.java
Apache-2.0
private String addDaoConstructor(@Nullable ExecutableElement method) { final String sessionType = method == null ? this.sessionType : fullReturnType(method); final String sessionVariableName = getSessionVariableName( sessionType ); final String name = method == null ? sessionVariableName : method.getSimpleName()....
If there is a session getter method, we generate an instance variable backing it, together with a constructor that initializes it.
addDaoConstructor
java
hibernate/hibernate-orm
tooling/metamodel-generator/src/main/java/org/hibernate/processor/annotation/AnnotationMetaEntity.java
https://github.com/hibernate/hibernate-orm/blob/master/tooling/metamodel-generator/src/main/java/org/hibernate/processor/annotation/AnnotationMetaEntity.java
Apache-2.0
private String setupQuarkusDaoConstructor() { if ( context.usesQuarkusOrm() ) { String name = "getEntityManager"; putMember( name, new RepositoryConstructor( this, getConstructorName(), name, sessionType, getSessionVariableName( sessionType ), dataStore(), c...
For Quarkus, we generate a constructor with injection for EntityManager in ORM, and in HR, we define the static session getter.
setupQuarkusDaoConstructor
java
hibernate/hibernate-orm
tooling/metamodel-generator/src/main/java/org/hibernate/processor/annotation/AnnotationMetaEntity.java
https://github.com/hibernate/hibernate-orm/blob/master/tooling/metamodel-generator/src/main/java/org/hibernate/processor/annotation/AnnotationMetaEntity.java
Apache-2.0
private static boolean isSessionGetter(ExecutableElement method) { if ( method.getParameters().isEmpty() ) { final TypeMirror returnType = method.getReturnType(); if ( returnType.getKind() == TypeKind.DECLARED ) { final DeclaredType declaredType = (DeclaredType) ununi(returnType); final Element element ...
The session getter method doesn't have to be a JavaBeans-style getter. It can be any method with no parameters and one of the needed return types.
isSessionGetter
java
hibernate/hibernate-orm
tooling/metamodel-generator/src/main/java/org/hibernate/processor/annotation/AnnotationMetaEntity.java
https://github.com/hibernate/hibernate-orm/blob/master/tooling/metamodel-generator/src/main/java/org/hibernate/processor/annotation/AnnotationMetaEntity.java
Apache-2.0
private boolean isGetterOrSetter(Element methodOfClass) { final ExecutableType methodType = (ExecutableType) methodOfClass.asType(); final Name methodSimpleName = methodOfClass.getSimpleName(); final List<? extends TypeMirror> methodParameterTypes = methodType.getParameterTypes(); final TypeMirror returnType = ...
Check if method respects Java Bean conventions for getter and setters. @param methodOfClass method element @return whether method respects Java Bean conventions.
isGetterOrSetter
java
hibernate/hibernate-orm
tooling/metamodel-generator/src/main/java/org/hibernate/processor/annotation/AnnotationMetaEntity.java
https://github.com/hibernate/hibernate-orm/blob/master/tooling/metamodel-generator/src/main/java/org/hibernate/processor/annotation/AnnotationMetaEntity.java
Apache-2.0
private static boolean hasPrefix(Name methodSimpleName, String prefix) { final int prefixLength = prefix.length(); if ( methodSimpleName.length() > prefixLength ) { for ( int i = 0; i < prefixLength; i++ ) { if ( methodSimpleName.charAt(i) != prefix.charAt(i) ) { return false; } } return true;...
Check if method respects Java Bean conventions for getter and setters. @param methodOfClass method element @return whether method respects Java Bean conventions.
hasPrefix
java
hibernate/hibernate-orm
tooling/metamodel-generator/src/main/java/org/hibernate/processor/annotation/AnnotationMetaEntity.java
https://github.com/hibernate/hibernate-orm/blob/master/tooling/metamodel-generator/src/main/java/org/hibernate/processor/annotation/AnnotationMetaEntity.java
Apache-2.0
private static boolean isGetter( Name methodSimpleName, List<? extends TypeMirror> methodParameterTypes, TypeMirror returnType) { return ( hasPrefix( methodSimpleName, "get" ) || hasPrefix( methodSimpleName,"is" ) ) && methodParameterTypes.isEmpty() && returnType.getKind() != TypeKind.VOID; }
Check if method respects Java Bean conventions for getter and setters. @param methodOfClass method element @return whether method respects Java Bean conventions.
isGetter
java
hibernate/hibernate-orm
tooling/metamodel-generator/src/main/java/org/hibernate/processor/annotation/AnnotationMetaEntity.java
https://github.com/hibernate/hibernate-orm/blob/master/tooling/metamodel-generator/src/main/java/org/hibernate/processor/annotation/AnnotationMetaEntity.java
Apache-2.0
private static boolean isSetter( Name methodSimpleName, List<? extends TypeMirror> methodParameterTypes, TypeMirror returnType) { return hasPrefix( methodSimpleName, "set") && methodParameterTypes.size() == 1 && returnType.getKind() != TypeKind.VOID; }
Check if method respects Java Bean conventions for getter and setters. @param methodOfClass method element @return whether method respects Java Bean conventions.
isSetter
java
hibernate/hibernate-orm
tooling/metamodel-generator/src/main/java/org/hibernate/processor/annotation/AnnotationMetaEntity.java
https://github.com/hibernate/hibernate-orm/blob/master/tooling/metamodel-generator/src/main/java/org/hibernate/processor/annotation/AnnotationMetaEntity.java
Apache-2.0
private void validatePersistentMembers(List<? extends Element> membersOfClass) { for ( Element memberOfClass : membersOfClass ) { if ( hasAnnotation(memberOfClass, MANY_TO_ONE, ONE_TO_ONE, ONE_TO_MANY, MANY_TO_MANY) ) { validateAssociation(memberOfClass); } } }
Check if method respects Java Bean conventions for getter and setters. @param methodOfClass method element @return whether method respects Java Bean conventions.
validatePersistentMembers
java
hibernate/hibernate-orm
tooling/metamodel-generator/src/main/java/org/hibernate/processor/annotation/AnnotationMetaEntity.java
https://github.com/hibernate/hibernate-orm/blob/master/tooling/metamodel-generator/src/main/java/org/hibernate/processor/annotation/AnnotationMetaEntity.java
Apache-2.0
private void addPersistentMembers(List<? extends Element> membersOfClass, AccessType membersKind) { for ( Element memberOfClass : membersOfClass ) { if ( isPersistent(memberOfClass, membersKind) ) { addPersistentMember(memberOfClass); } } }
Check if method respects Java Bean conventions for getter and setters. @param methodOfClass method element @return whether method respects Java Bean conventions.
addPersistentMembers
java
hibernate/hibernate-orm
tooling/metamodel-generator/src/main/java/org/hibernate/processor/annotation/AnnotationMetaEntity.java
https://github.com/hibernate/hibernate-orm/blob/master/tooling/metamodel-generator/src/main/java/org/hibernate/processor/annotation/AnnotationMetaEntity.java
Apache-2.0
private void addPersistentMember(Element memberOfClass) { if ( jakartaDataStaticModel ) { final DataAnnotationMetaAttribute dataMetaAttribute = memberOfClass.asType() .accept( new DataMetaAttributeGenerationVisitor(this, context), memberOfClass ); if ( dataMetaAttribute != null ) { final String ...
Check if method respects Java Bean conventions for getter and setters. @param methodOfClass method element @return whether method respects Java Bean conventions.
addPersistentMember
java
hibernate/hibernate-orm
tooling/metamodel-generator/src/main/java/org/hibernate/processor/annotation/AnnotationMetaEntity.java
https://github.com/hibernate/hibernate-orm/blob/master/tooling/metamodel-generator/src/main/java/org/hibernate/processor/annotation/AnnotationMetaEntity.java
Apache-2.0
private void addEmbeddablePersistentMember(Element memberOfEmbeddable, String path, AccessType membersKind) { if ( isPersistent(memberOfEmbeddable, membersKind) ) { //TODO respect AccessType of embeddable final DataAnnotationMetaAttribute metaAttribute = memberOfEmbeddable.asType() .accept( new DataMet...
Check if method respects Java Bean conventions for getter and setters. @param methodOfClass method element @return whether method respects Java Bean conventions.
addEmbeddablePersistentMember
java
hibernate/hibernate-orm
tooling/metamodel-generator/src/main/java/org/hibernate/processor/annotation/AnnotationMetaEntity.java
https://github.com/hibernate/hibernate-orm/blob/master/tooling/metamodel-generator/src/main/java/org/hibernate/processor/annotation/AnnotationMetaEntity.java
Apache-2.0
static boolean isEmbedded(Element memberOfClass) { if ( hasAnnotation(memberOfClass, EMBEDDED) ) { return true; } else { final TypeMirror type = attributeType(memberOfClass); if ( type.getKind() == TypeKind.DECLARED ) { final DeclaredType declaredType = (DeclaredType) type; return hasAnnotation( ...
Check if method respects Java Bean conventions for getter and setters. @param methodOfClass method element @return whether method respects Java Bean conventions.
isEmbedded
java
hibernate/hibernate-orm
tooling/metamodel-generator/src/main/java/org/hibernate/processor/annotation/AnnotationMetaEntity.java
https://github.com/hibernate/hibernate-orm/blob/master/tooling/metamodel-generator/src/main/java/org/hibernate/processor/annotation/AnnotationMetaEntity.java
Apache-2.0
private void validateAssociation(Element memberOfClass) { final TypeMirror type = attributeType(memberOfClass); if ( hasAnnotation(memberOfClass, MANY_TO_ONE) ) { final AnnotationMirror annotation = castNonNull(getAnnotationMirror(memberOfClass, MANY_TO_ONE)); validateToOneAssociation(memberOfClass, anno...
Check if method respects Java Bean conventions for getter and setters. @param methodOfClass method element @return whether method respects Java Bean conventions.
validateAssociation
java
hibernate/hibernate-orm
tooling/metamodel-generator/src/main/java/org/hibernate/processor/annotation/AnnotationMetaEntity.java
https://github.com/hibernate/hibernate-orm/blob/master/tooling/metamodel-generator/src/main/java/org/hibernate/processor/annotation/AnnotationMetaEntity.java
Apache-2.0
private static TypeMirror attributeType(Element memberOfClass) { switch ( memberOfClass.getKind() ) { case METHOD: final ExecutableElement method = (ExecutableElement) memberOfClass; return method.getReturnType(); case FIELD: return memberOfClass.asType(); default: throw new AssertionFailure(...
Check if method respects Java Bean conventions for getter and setters. @param methodOfClass method element @return whether method respects Java Bean conventions.
attributeType
java
hibernate/hibernate-orm
tooling/metamodel-generator/src/main/java/org/hibernate/processor/annotation/AnnotationMetaEntity.java
https://github.com/hibernate/hibernate-orm/blob/master/tooling/metamodel-generator/src/main/java/org/hibernate/processor/annotation/AnnotationMetaEntity.java
Apache-2.0
private void validateToOneAssociation(Element memberOfClass, AnnotationMirror annotation, TypeMirror type) { final AnnotationValue target = getAnnotationValue(annotation, "targetEntity"); validateAssociation(memberOfClass, annotation, target == null ? type : (TypeMirror) target.getValue()); }
Check if method respects Java Bean conventions for getter and setters. @param methodOfClass method element @return whether method respects Java Bean conventions.
validateToOneAssociation
java
hibernate/hibernate-orm
tooling/metamodel-generator/src/main/java/org/hibernate/processor/annotation/AnnotationMetaEntity.java
https://github.com/hibernate/hibernate-orm/blob/master/tooling/metamodel-generator/src/main/java/org/hibernate/processor/annotation/AnnotationMetaEntity.java
Apache-2.0
private void validateToManyAssociation(Element memberOfClass, AnnotationMirror annotation, TypeMirror type) { final AnnotationValue target = getAnnotationValue(annotation, "targetEntity"); validateAssociation(memberOfClass, annotation, target == null ? elementType(type) : (TypeMirror) target.getValue()); }
Check if method respects Java Bean conventions for getter and setters. @param methodOfClass method element @return whether method respects Java Bean conventions.
validateToManyAssociation
java
hibernate/hibernate-orm
tooling/metamodel-generator/src/main/java/org/hibernate/processor/annotation/AnnotationMetaEntity.java
https://github.com/hibernate/hibernate-orm/blob/master/tooling/metamodel-generator/src/main/java/org/hibernate/processor/annotation/AnnotationMetaEntity.java
Apache-2.0
private void validateAssociation(Element memberOfClass, AnnotationMirror annotation, @Nullable TypeMirror typeMirror) { if ( typeMirror != null ) { switch ( typeMirror.getKind() ) { case TYPEVAR: if ( hasAnnotation(element, ENTITY) ) { message(memberOfClass, "type '" + typeMirror + "' is a type vari...
Check if method respects Java Bean conventions for getter and setters. @param methodOfClass method element @return whether method respects Java Bean conventions.
validateAssociation
java
hibernate/hibernate-orm
tooling/metamodel-generator/src/main/java/org/hibernate/processor/annotation/AnnotationMetaEntity.java
https://github.com/hibernate/hibernate-orm/blob/master/tooling/metamodel-generator/src/main/java/org/hibernate/processor/annotation/AnnotationMetaEntity.java
Apache-2.0
private void validateBidirectionalMapping( Element memberOfClass, AnnotationMirror annotation, AnnotationValue annotationVal, TypeElement assocTypeElement) { final String mappedBy = annotationVal.getValue().toString(); if ( mappedBy != null && !mappedBy.isEmpty() // this happens for a typesafe ref, e.g. Page...
Check if method respects Java Bean conventions for getter and setters. @param methodOfClass method element @return whether method respects Java Bean conventions.
validateBidirectionalMapping
java
hibernate/hibernate-orm
tooling/metamodel-generator/src/main/java/org/hibernate/processor/annotation/AnnotationMetaEntity.java
https://github.com/hibernate/hibernate-orm/blob/master/tooling/metamodel-generator/src/main/java/org/hibernate/processor/annotation/AnnotationMetaEntity.java
Apache-2.0
private boolean compatibleAccess(TypeElement assocTypeElement, Element member) { final AccessType memberAccessType = determineAnnotationSpecifiedAccessType( member ); final AccessType accessType = memberAccessType == null ? getAccessType(assocTypeElement) : memberAccessType; return switch ( member.getKind() ) { ...
Check if method respects Java Bean conventions for getter and setters. @param methodOfClass method element @return whether method respects Java Bean conventions.
compatibleAccess
java
hibernate/hibernate-orm
tooling/metamodel-generator/src/main/java/org/hibernate/processor/annotation/AnnotationMetaEntity.java
https://github.com/hibernate/hibernate-orm/blob/master/tooling/metamodel-generator/src/main/java/org/hibernate/processor/annotation/AnnotationMetaEntity.java
Apache-2.0
private void validateBackRef( Element memberOfClass, AnnotationMirror annotation, TypeElement assocTypeElement, Element referencedMember, AnnotationValue annotationVal) { final TypeMirror backType; final String expectedMappingAnnotation; switch ( annotation.getAnnotationType().asElement().toString(...
Check if method respects Java Bean conventions for getter and setters. @param methodOfClass method element @return whether method respects Java Bean conventions.
validateBackRef
java
hibernate/hibernate-orm
tooling/metamodel-generator/src/main/java/org/hibernate/processor/annotation/AnnotationMetaEntity.java
https://github.com/hibernate/hibernate-orm/blob/master/tooling/metamodel-generator/src/main/java/org/hibernate/processor/annotation/AnnotationMetaEntity.java
Apache-2.0
private @Nullable Element getIdMember() { for ( Element e : element.getEnclosedElements() ) { if ( hasAnnotation( e, ID, EMBEDDED_ID ) ) { return e; } } return null; }
Check if method respects Java Bean conventions for getter and setters. @param methodOfClass method element @return whether method respects Java Bean conventions.
getIdMember
java
hibernate/hibernate-orm
tooling/metamodel-generator/src/main/java/org/hibernate/processor/annotation/AnnotationMetaEntity.java
https://github.com/hibernate/hibernate-orm/blob/master/tooling/metamodel-generator/src/main/java/org/hibernate/processor/annotation/AnnotationMetaEntity.java
Apache-2.0
private boolean isPersistent(Element memberOfClass, AccessType membersKind) { return ( entityAccessTypeInfo.getAccessType() == membersKind || determineAnnotationSpecifiedAccessType( memberOfClass ) != null ) && !containsAnnotation( memberOfClass, TRANSIENT ) && !memberOfClass.getModifiers().contains( Modif...
Check if method respects Java Bean conventions for getter and setters. @param methodOfClass method element @return whether method respects Java Bean conventions.
isPersistent
java
hibernate/hibernate-orm
tooling/metamodel-generator/src/main/java/org/hibernate/processor/annotation/AnnotationMetaEntity.java
https://github.com/hibernate/hibernate-orm/blob/master/tooling/metamodel-generator/src/main/java/org/hibernate/processor/annotation/AnnotationMetaEntity.java
Apache-2.0
private void addLifecycleMethods(List<ExecutableElement> queryMethods) { for ( ExecutableElement method : queryMethods) { if ( method.getModifiers().contains(Modifier.ABSTRACT) ) { addLifecycleMethod( method ); } } }
Check if method respects Java Bean conventions for getter and setters. @param methodOfClass method element @return whether method respects Java Bean conventions.
addLifecycleMethods
java
hibernate/hibernate-orm
tooling/metamodel-generator/src/main/java/org/hibernate/processor/annotation/AnnotationMetaEntity.java
https://github.com/hibernate/hibernate-orm/blob/master/tooling/metamodel-generator/src/main/java/org/hibernate/processor/annotation/AnnotationMetaEntity.java
Apache-2.0
private boolean isDeleteLifecycle(ExecutableElement method) { if ( method.getParameters().size() == 1 ) { final VariableElement parameter = method.getParameters().get(0); final DeclaredType declaredType = entityType( parameterType(parameter) ); return declaredType != null && containsAnnotation( declaredT...
Check if method respects Java Bean conventions for getter and setters. @param methodOfClass method element @return whether method respects Java Bean conventions.
isDeleteLifecycle
java
hibernate/hibernate-orm
tooling/metamodel-generator/src/main/java/org/hibernate/processor/annotation/AnnotationMetaEntity.java
https://github.com/hibernate/hibernate-orm/blob/master/tooling/metamodel-generator/src/main/java/org/hibernate/processor/annotation/AnnotationMetaEntity.java
Apache-2.0
private void addQueryMethods(List<ExecutableElement> queryMethods) { for ( ExecutableElement method : queryMethods) { final Set<Modifier> modifiers = method.getModifiers(); if ( modifiers.contains(Modifier.ABSTRACT) || modifiers.contains(Modifier.NATIVE) ) { addQueryMethod( method ); } } }
Check if method respects Java Bean conventions for getter and setters. @param methodOfClass method element @return whether method respects Java Bean conventions.
addQueryMethods
java
hibernate/hibernate-orm
tooling/metamodel-generator/src/main/java/org/hibernate/processor/annotation/AnnotationMetaEntity.java
https://github.com/hibernate/hibernate-orm/blob/master/tooling/metamodel-generator/src/main/java/org/hibernate/processor/annotation/AnnotationMetaEntity.java
Apache-2.0
private void addQueryMethod(ExecutableElement method) { final TypeMirror returnType = memberMethodType(method).getReturnType(); final TypeKind kind = returnType.getKind(); if ( kind == TypeKind.VOID || kind == TypeKind.ARRAY || kind.isPrimitive() ) { addQueryMethod( method, returnType, null ); } else if ( ...
Check if method respects Java Bean conventions for getter and setters. @param methodOfClass method element @return whether method respects Java Bean conventions.
addQueryMethod
java
hibernate/hibernate-orm
tooling/metamodel-generator/src/main/java/org/hibernate/processor/annotation/AnnotationMetaEntity.java
https://github.com/hibernate/hibernate-orm/blob/master/tooling/metamodel-generator/src/main/java/org/hibernate/processor/annotation/AnnotationMetaEntity.java
Apache-2.0
private TypeMirror unUniIfPossible(ExecutableElement method, TypeMirror returnType) { final TypeMirror result = ununi( returnType ); if ( repository ) { if ( isReactive() ) { if ( result == returnType ) { message( method, "backed by a reactive session, must return 'Uni'", Diagnostic.Kind.ERROR ); }...
Check if method respects Java Bean conventions for getter and setters. @param methodOfClass method element @return whether method respects Java Bean conventions.
unUniIfPossible
java
hibernate/hibernate-orm
tooling/metamodel-generator/src/main/java/org/hibernate/processor/annotation/AnnotationMetaEntity.java
https://github.com/hibernate/hibernate-orm/blob/master/tooling/metamodel-generator/src/main/java/org/hibernate/processor/annotation/AnnotationMetaEntity.java
Apache-2.0
private boolean validatedQueryReturnType(ExecutableElement method, TypeElement typeElement) { final String typeName = typeElement.getQualifiedName().toString(); switch ( typeName ) { case JD_PAGE: if ( !hasPageRequest(method) ) { message(method, "method with return type '" + typeName + "...
Check if method respects Java Bean conventions for getter and setters. @param methodOfClass method element @return whether method respects Java Bean conventions.
validatedQueryReturnType
java
hibernate/hibernate-orm
tooling/metamodel-generator/src/main/java/org/hibernate/processor/annotation/AnnotationMetaEntity.java
https://github.com/hibernate/hibernate-orm/blob/master/tooling/metamodel-generator/src/main/java/org/hibernate/processor/annotation/AnnotationMetaEntity.java
Apache-2.0
private static boolean hashKeyedPage(ExecutableElement method) { return method.getParameters().stream() .anyMatch(param -> typeNameEquals(param.asType(), HIB_KEYED_PAGE)); }
Check if method respects Java Bean conventions for getter and setters. @param methodOfClass method element @return whether method respects Java Bean conventions.
hashKeyedPage
java
hibernate/hibernate-orm
tooling/metamodel-generator/src/main/java/org/hibernate/processor/annotation/AnnotationMetaEntity.java
https://github.com/hibernate/hibernate-orm/blob/master/tooling/metamodel-generator/src/main/java/org/hibernate/processor/annotation/AnnotationMetaEntity.java
Apache-2.0
private static boolean hasPageRequest(ExecutableElement method) { return method.getParameters().stream() .anyMatch(param -> typeNameEquals(param.asType(), JD_PAGE_REQUEST)); }
Check if method respects Java Bean conventions for getter and setters. @param methodOfClass method element @return whether method respects Java Bean conventions.
hasPageRequest
java
hibernate/hibernate-orm
tooling/metamodel-generator/src/main/java/org/hibernate/processor/annotation/AnnotationMetaEntity.java
https://github.com/hibernate/hibernate-orm/blob/master/tooling/metamodel-generator/src/main/java/org/hibernate/processor/annotation/AnnotationMetaEntity.java
Apache-2.0
private static boolean hasOrder(ExecutableElement method) { return hasAnnotation(method, JD_ORDER_BY, JD_ORDER_BY_LIST) || method.getParameters().stream() .anyMatch(param -> typeNameEquals(param.asType(), JD_ORDER) || typeNameEquals(param.asType(), JD_SORT) || typeNameEqualsArray(param.asType(), JD...
Check if method respects Java Bean conventions for getter and setters. @param methodOfClass method element @return whether method respects Java Bean conventions.
hasOrder
java
hibernate/hibernate-orm
tooling/metamodel-generator/src/main/java/org/hibernate/processor/annotation/AnnotationMetaEntity.java
https://github.com/hibernate/hibernate-orm/blob/master/tooling/metamodel-generator/src/main/java/org/hibernate/processor/annotation/AnnotationMetaEntity.java
Apache-2.0
private static TypeMirror ununi(TypeMirror returnType) { if ( returnType.getKind() == TypeKind.DECLARED ) { final DeclaredType declaredType = (DeclaredType) returnType; final TypeElement typeElement = (TypeElement) declaredType.asElement(); if ( typeElement.getQualifiedName().contentEquals(Constants.UNI) ) {...
Check if method respects Java Bean conventions for getter and setters. @param methodOfClass method element @return whether method respects Java Bean conventions.
ununi
java
hibernate/hibernate-orm
tooling/metamodel-generator/src/main/java/org/hibernate/processor/annotation/AnnotationMetaEntity.java
https://github.com/hibernate/hibernate-orm/blob/master/tooling/metamodel-generator/src/main/java/org/hibernate/processor/annotation/AnnotationMetaEntity.java
Apache-2.0
private static boolean isLegalRawResultType(String containerTypeName) { return LEGAL_RAW_RESULT_TYPES.contains( containerTypeName ); }
Check if method respects Java Bean conventions for getter and setters. @param methodOfClass method element @return whether method respects Java Bean conventions.
isLegalRawResultType
java
hibernate/hibernate-orm
tooling/metamodel-generator/src/main/java/org/hibernate/processor/annotation/AnnotationMetaEntity.java
https://github.com/hibernate/hibernate-orm/blob/master/tooling/metamodel-generator/src/main/java/org/hibernate/processor/annotation/AnnotationMetaEntity.java
Apache-2.0
private static boolean isLegalGenericResultType(String containerTypeName) { return LEGAL_GENERIC_RESULT_TYPES.contains( containerTypeName ); }
Check if method respects Java Bean conventions for getter and setters. @param methodOfClass method element @return whether method respects Java Bean conventions.
isLegalGenericResultType
java
hibernate/hibernate-orm
tooling/metamodel-generator/src/main/java/org/hibernate/processor/annotation/AnnotationMetaEntity.java
https://github.com/hibernate/hibernate-orm/blob/master/tooling/metamodel-generator/src/main/java/org/hibernate/processor/annotation/AnnotationMetaEntity.java
Apache-2.0
private void addQueryMethod( ExecutableElement method, @Nullable TypeMirror returnType, @Nullable TypeElement containerType) { final AnnotationMirror hql = getAnnotationMirror( method, HQL ); if ( hql != null ) { addQueryMethod( method, returnType, containerType, hql, false ); } final AnnotationMirr...
Check if method respects Java Bean conventions for getter and setters. @param methodOfClass method element @return whether method respects Java Bean conventions.
addQueryMethod
java
hibernate/hibernate-orm
tooling/metamodel-generator/src/main/java/org/hibernate/processor/annotation/AnnotationMetaEntity.java
https://github.com/hibernate/hibernate-orm/blob/master/tooling/metamodel-generator/src/main/java/org/hibernate/processor/annotation/AnnotationMetaEntity.java
Apache-2.0
private void addDeleteMethod(ExecutableElement method, @Nullable TypeMirror returnType) { if ( returnType != null ) { final TypeKind kind = returnType.getKind(); if ( kind != TypeKind.VOID && kind != TypeKind.INT && kind != TypeKind.LONG ) { message(method, "must be 'void' or return 'int' or...
Check if method respects Java Bean conventions for getter and setters. @param methodOfClass method element @return whether method respects Java Bean conventions.
addDeleteMethod
java
hibernate/hibernate-orm
tooling/metamodel-generator/src/main/java/org/hibernate/processor/annotation/AnnotationMetaEntity.java
https://github.com/hibernate/hibernate-orm/blob/master/tooling/metamodel-generator/src/main/java/org/hibernate/processor/annotation/AnnotationMetaEntity.java
Apache-2.0
private void addLifecycleMethod(ExecutableElement method) { final TypeMirror returnType = unUniIfPossible( method, method.getReturnType() ); if ( method.getParameters().size() != 1 ) { message( method, "must have exactly one parameter", Diagnostic.Kind.ERROR ); } else if ( returnType == null ) { ...
Check if method respects Java Bean conventions for getter and setters. @param methodOfClass method element @return whether method respects Java Bean conventions.
addLifecycleMethod
java
hibernate/hibernate-orm
tooling/metamodel-generator/src/main/java/org/hibernate/processor/annotation/AnnotationMetaEntity.java
https://github.com/hibernate/hibernate-orm/blob/master/tooling/metamodel-generator/src/main/java/org/hibernate/processor/annotation/AnnotationMetaEntity.java
Apache-2.0
private boolean hasGeneratedId(DeclaredType entityType) { final TypeElement typeElement = (TypeElement) entityType.asElement(); for ( Element member : context.getAllMembers(typeElement) ) { if ( hasAnnotation(member, GENERATED_VALUE) && hasAnnotation(member, ID) ) { return true; } //TODO: look fo...
Check if method respects Java Bean conventions for getter and setters. @param methodOfClass method element @return whether method respects Java Bean conventions.
hasGeneratedId
java
hibernate/hibernate-orm
tooling/metamodel-generator/src/main/java/org/hibernate/processor/annotation/AnnotationMetaEntity.java
https://github.com/hibernate/hibernate-orm/blob/master/tooling/metamodel-generator/src/main/java/org/hibernate/processor/annotation/AnnotationMetaEntity.java
Apache-2.0
private static LifecycleMethod.ParameterKind lifecycleParameterKind(TypeMirror parameterType) { switch (parameterType.getKind()) { case ARRAY: return LifecycleMethod.ParameterKind.ARRAY; case DECLARED: final DeclaredType declaredType = (DeclaredType) parameterType; final TypeElement typeElement = (T...
Check if method respects Java Bean conventions for getter and setters. @param methodOfClass method element @return whether method respects Java Bean conventions.
lifecycleParameterKind
java
hibernate/hibernate-orm
tooling/metamodel-generator/src/main/java/org/hibernate/processor/annotation/AnnotationMetaEntity.java
https://github.com/hibernate/hibernate-orm/blob/master/tooling/metamodel-generator/src/main/java/org/hibernate/processor/annotation/AnnotationMetaEntity.java
Apache-2.0
private TypeMirror lifecycleParameterArgument(TypeMirror parameterType) { switch (parameterType.getKind()) { case ARRAY: final ArrayType arrayType = (ArrayType) parameterType; return arrayType.getComponentType(); case DECLARED: final DeclaredType declaredType = (DeclaredType) parameterType; fina...
Check if method respects Java Bean conventions for getter and setters. @param methodOfClass method element @return whether method respects Java Bean conventions.
lifecycleParameterArgument
java
hibernate/hibernate-orm
tooling/metamodel-generator/src/main/java/org/hibernate/processor/annotation/AnnotationMetaEntity.java
https://github.com/hibernate/hibernate-orm/blob/master/tooling/metamodel-generator/src/main/java/org/hibernate/processor/annotation/AnnotationMetaEntity.java
Apache-2.0
private static boolean isVoid(TypeMirror returnType) { switch (returnType.getKind()) { case VOID: return true; case DECLARED: final DeclaredType declaredType = (DeclaredType) returnType; final TypeElement typeElement = (TypeElement) declaredType.asElement(); return typeElement.getQualifiedName()...
Check if method respects Java Bean conventions for getter and setters. @param methodOfClass method element @return whether method respects Java Bean conventions.
isVoid
java
hibernate/hibernate-orm
tooling/metamodel-generator/src/main/java/org/hibernate/processor/annotation/AnnotationMetaEntity.java
https://github.com/hibernate/hibernate-orm/blob/master/tooling/metamodel-generator/src/main/java/org/hibernate/processor/annotation/AnnotationMetaEntity.java
Apache-2.0
private @Nullable DeclaredType entityType(TypeMirror parameterType) { final Types types = context.getTypeUtils(); switch ( parameterType.getKind() ) { case TYPEVAR: final TypeVariable typeVariable = (TypeVariable) parameterType; parameterType = typeVariable.getUpperBound(); //INTENTIONAL FALL THROUGH...
Check if method respects Java Bean conventions for getter and setters. @param methodOfClass method element @return whether method respects Java Bean conventions.
entityType
java
hibernate/hibernate-orm
tooling/metamodel-generator/src/main/java/org/hibernate/processor/annotation/AnnotationMetaEntity.java
https://github.com/hibernate/hibernate-orm/blob/master/tooling/metamodel-generator/src/main/java/org/hibernate/processor/annotation/AnnotationMetaEntity.java
Apache-2.0
private @Nullable TypeMirror elementType(TypeMirror parameterType) { switch ( parameterType.getKind() ) { case DECLARED: final DeclaredType declaredType = (DeclaredType) parameterType; final List<? extends TypeMirror> typeArguments = declaredType.getTypeArguments(); return switch ( typeArguments.size()...
Check if method respects Java Bean conventions for getter and setters. @param methodOfClass method element @return whether method respects Java Bean conventions.
elementType
java
hibernate/hibernate-orm
tooling/metamodel-generator/src/main/java/org/hibernate/processor/annotation/AnnotationMetaEntity.java
https://github.com/hibernate/hibernate-orm/blob/master/tooling/metamodel-generator/src/main/java/org/hibernate/processor/annotation/AnnotationMetaEntity.java
Apache-2.0
private static String lifecycleOperation(ExecutableElement method) { if ( hasAnnotation(method, JD_INSERT) ) { return "insert"; } else if ( hasAnnotation(method, JD_UPDATE) ) { return "update"; } else if ( hasAnnotation(method, JD_DELETE) ) { return "delete"; } else if ( hasAnnotation(method, JD_...
Check if method respects Java Bean conventions for getter and setters. @param methodOfClass method element @return whether method respects Java Bean conventions.
lifecycleOperation
java
hibernate/hibernate-orm
tooling/metamodel-generator/src/main/java/org/hibernate/processor/annotation/AnnotationMetaEntity.java
https://github.com/hibernate/hibernate-orm/blob/master/tooling/metamodel-generator/src/main/java/org/hibernate/processor/annotation/AnnotationMetaEntity.java
Apache-2.0
private void addFinderMethod( ExecutableElement method, @Nullable TypeMirror returnType, @Nullable TypeElement containerType) { if ( returnType == null ) { message( method, "missing return type", Diagnostic.Kind.ERROR ); } else if ( returnType.getKind() == TypeKind.ARRAY ) { final ArrayTy...
Check if method respects Java Bean conventions for getter and setters. @param methodOfClass method element @return whether method respects Java Bean conventions.
addFinderMethod
java
hibernate/hibernate-orm
tooling/metamodel-generator/src/main/java/org/hibernate/processor/annotation/AnnotationMetaEntity.java
https://github.com/hibernate/hibernate-orm/blob/master/tooling/metamodel-generator/src/main/java/org/hibernate/processor/annotation/AnnotationMetaEntity.java
Apache-2.0
private void createCriteriaFinder( ExecutableElement method, TypeMirror returnType, @Nullable String containerType, TypeElement entity) { final String methodName = method.getSimpleName().toString(); final List<String> paramNames = parameterNames( method, entity ); final List<String> paramTypes = parameterTypes...
Create a finder method which returns multiple results.
createCriteriaFinder
java
hibernate/hibernate-orm
tooling/metamodel-generator/src/main/java/org/hibernate/processor/annotation/AnnotationMetaEntity.java
https://github.com/hibernate/hibernate-orm/blob/master/tooling/metamodel-generator/src/main/java/org/hibernate/processor/annotation/AnnotationMetaEntity.java
Apache-2.0
private void checkFinderParameter(@Nullable TypeElement entityType, VariableElement parameter) { final Types types = context.getTypeUtils(); final TypeMirror parameterType = parameterType(parameter); final String typeName = parameterType.toString(); // TODO: we could allow restrictions even when the query retur...
Create a finder method which returns multiple results.
checkFinderParameter
java
hibernate/hibernate-orm
tooling/metamodel-generator/src/main/java/org/hibernate/processor/annotation/AnnotationMetaEntity.java
https://github.com/hibernate/hibernate-orm/blob/master/tooling/metamodel-generator/src/main/java/org/hibernate/processor/annotation/AnnotationMetaEntity.java
Apache-2.0
private void createCriteriaDelete(ExecutableElement method) { final TypeElement entity = primaryEntity; if ( entity == null) { message( method, "repository does not have a well-defined primary entity type", Diagnostic.Kind.ERROR); } else { final String methodName = method.getSimpleName().toString(); ...
Create a finder method which returns multiple results.
createCriteriaDelete
java
hibernate/hibernate-orm
tooling/metamodel-generator/src/main/java/org/hibernate/processor/annotation/AnnotationMetaEntity.java
https://github.com/hibernate/hibernate-orm/blob/master/tooling/metamodel-generator/src/main/java/org/hibernate/processor/annotation/AnnotationMetaEntity.java
Apache-2.0
private void wrongTypeArgError(TypeElement entityType, VariableElement parameter, String parameterType) { message(parameter, "mismatched type of " + message(parameterType, entityType), Diagnostic.Kind.ERROR ); }
Create a finder method which returns multiple results.
wrongTypeArgError
java
hibernate/hibernate-orm
tooling/metamodel-generator/src/main/java/org/hibernate/processor/annotation/AnnotationMetaEntity.java
https://github.com/hibernate/hibernate-orm/blob/master/tooling/metamodel-generator/src/main/java/org/hibernate/processor/annotation/AnnotationMetaEntity.java
Apache-2.0
private void missingTypeArgError(TypeElement entityType, VariableElement parameter, String parameterType) { message(parameter, "missing type of " + message(parameterType, entityType), Diagnostic.Kind.ERROR ); }
Create a finder method which returns multiple results.
missingTypeArgError
java
hibernate/hibernate-orm
tooling/metamodel-generator/src/main/java/org/hibernate/processor/annotation/AnnotationMetaEntity.java
https://github.com/hibernate/hibernate-orm/blob/master/tooling/metamodel-generator/src/main/java/org/hibernate/processor/annotation/AnnotationMetaEntity.java
Apache-2.0
private String message(String parameterType, TypeElement entityType) { final String entityTypeName = entityType.getSimpleName().toString(); if (parameterType.startsWith(HIB_ORDER) || parameterType.startsWith(JD_ORDER)) { return "order (should be 'Order<? super " + entityTypeName + ">')"; } else if (parameter...
Create a finder method which returns multiple results.
message
java
hibernate/hibernate-orm
tooling/metamodel-generator/src/main/java/org/hibernate/processor/annotation/AnnotationMetaEntity.java
https://github.com/hibernate/hibernate-orm/blob/master/tooling/metamodel-generator/src/main/java/org/hibernate/processor/annotation/AnnotationMetaEntity.java
Apache-2.0
private List<OrderBy> orderByList(ExecutableElement method, TypeElement returnType) { final TypeElement entityType = implicitEntityType( returnType ); if ( entityType != null ) { final AnnotationMirror orderByList = getAnnotationMirror( method, JD_ORDER_BY_LIST ); if ( orderByList != null ) { final List<O...
Create a finder method which returns multiple results.
orderByList
java
hibernate/hibernate-orm
tooling/metamodel-generator/src/main/java/org/hibernate/processor/annotation/AnnotationMetaEntity.java
https://github.com/hibernate/hibernate-orm/blob/master/tooling/metamodel-generator/src/main/java/org/hibernate/processor/annotation/AnnotationMetaEntity.java
Apache-2.0
private OrderBy orderByExpression(AnnotationMirror orderBy, TypeElement entityType, ExecutableElement method) { final String fieldName = castNonNull( getAnnotationValue(orderBy) ).getValue().toString(); if ( fieldName.equals("<error>") ) { throw new ProcessLaterException(); } final AnnotationValue descending...
Create a finder method which returns multiple results.
orderByExpression
java
hibernate/hibernate-orm
tooling/metamodel-generator/src/main/java/org/hibernate/processor/annotation/AnnotationMetaEntity.java
https://github.com/hibernate/hibernate-orm/blob/master/tooling/metamodel-generator/src/main/java/org/hibernate/processor/annotation/AnnotationMetaEntity.java
Apache-2.0
private static @Nullable TypeMirror getTypeArgument(TypeMirror parameterType) { switch ( parameterType.getKind() ) { case ARRAY: final ArrayType arrayType = (ArrayType) parameterType; return getTypeArgument( arrayType.getComponentType() ); case DECLARED: final DeclaredType type = (DeclaredType) para...
Create a finder method which returns multiple results.
getTypeArgument
java
hibernate/hibernate-orm
tooling/metamodel-generator/src/main/java/org/hibernate/processor/annotation/AnnotationMetaEntity.java
https://github.com/hibernate/hibernate-orm/blob/master/tooling/metamodel-generator/src/main/java/org/hibernate/processor/annotation/AnnotationMetaEntity.java
Apache-2.0
private static boolean isFinderParameterMappingToAttribute(VariableElement parameter) { final String typeName = parameter.asType().toString(); return !isSpecialParam(typeName) || isRangeParam(typeName); }
Create a finder method which returns multiple results.
isFinderParameterMappingToAttribute
java
hibernate/hibernate-orm
tooling/metamodel-generator/src/main/java/org/hibernate/processor/annotation/AnnotationMetaEntity.java
https://github.com/hibernate/hibernate-orm/blob/master/tooling/metamodel-generator/src/main/java/org/hibernate/processor/annotation/AnnotationMetaEntity.java
Apache-2.0
private String[] sessionTypeFromParameters(List<String> paramNames, List<String> paramTypes) { for ( int i = 0; i < paramNames.size(); i ++ ) { final String type = paramTypes.get(i); final String name = paramNames.get(i); if ( isSessionParameter(type) ) { return new String[] { type, name }; } } re...
Create a finder method which returns multiple results.
sessionTypeFromParameters
java
hibernate/hibernate-orm
tooling/metamodel-generator/src/main/java/org/hibernate/processor/annotation/AnnotationMetaEntity.java
https://github.com/hibernate/hibernate-orm/blob/master/tooling/metamodel-generator/src/main/java/org/hibernate/processor/annotation/AnnotationMetaEntity.java
Apache-2.0
@Override protected String getSessionVariableName() { return getSessionVariableName(sessionType); }
Create a finder method which returns multiple results.
getSessionVariableName
java
hibernate/hibernate-orm
tooling/metamodel-generator/src/main/java/org/hibernate/processor/annotation/AnnotationMetaEntity.java
https://github.com/hibernate/hibernate-orm/blob/master/tooling/metamodel-generator/src/main/java/org/hibernate/processor/annotation/AnnotationMetaEntity.java
Apache-2.0
private String getSessionVariableName(String sessionType) { return switch (sessionType) { case HIB_SESSION, HIB_STATELESS_SESSION, MUTINY_SESSION, MUTINY_STATELESS_SESSION -> "session"; // case UNI_MUTINY_SESSION, UNI_MUTINY_STATELESS_SESSION -> "session"; default -> sessionGetter; }; }
Create a finder method which returns multiple results.
getSessionVariableName
java
hibernate/hibernate-orm
tooling/metamodel-generator/src/main/java/org/hibernate/processor/annotation/AnnotationMetaEntity.java
https://github.com/hibernate/hibernate-orm/blob/master/tooling/metamodel-generator/src/main/java/org/hibernate/processor/annotation/AnnotationMetaEntity.java
Apache-2.0
private static List<String> enabledFetchProfiles(ExecutableElement method) { final AnnotationMirror findAnnotation = getAnnotationMirror( method, FIND ); if ( findAnnotation == null ) { return emptyList(); } else { final AnnotationValue enabledFetchProfiles = getAnnotationValue( findAnnotation, "enab...
Create a finder method which returns multiple results.
enabledFetchProfiles
java
hibernate/hibernate-orm
tooling/metamodel-generator/src/main/java/org/hibernate/processor/annotation/AnnotationMetaEntity.java
https://github.com/hibernate/hibernate-orm/blob/master/tooling/metamodel-generator/src/main/java/org/hibernate/processor/annotation/AnnotationMetaEntity.java
Apache-2.0
private void createMultipleParameterFinder( ExecutableElement method, TypeMirror returnType, TypeElement entity, @Nullable String containerType) { final String methodName = method.getSimpleName().toString(); final List<String> paramNames = parameterNames( method, entity ); final List<String> paramTypes = param...
Create a finder method which returns multiple results.
createMultipleParameterFinder
java
hibernate/hibernate-orm
tooling/metamodel-generator/src/main/java/org/hibernate/processor/annotation/AnnotationMetaEntity.java
https://github.com/hibernate/hibernate-orm/blob/master/tooling/metamodel-generator/src/main/java/org/hibernate/processor/annotation/AnnotationMetaEntity.java
Apache-2.0
private void warnAboutMissingOrder(ExecutableElement method) { if ( !hasAnnotation( method, JD_ORDER_BY, JD_ORDER_BY_LIST ) ) { boolean hasPageRequest = false; boolean hasSortOrOrder = false; for ( VariableElement parameter : method.getParameters() ) { final String parameterType = parameter.asType().toS...
Create a finder method which returns multiple results.
warnAboutMissingOrder
java
hibernate/hibernate-orm
tooling/metamodel-generator/src/main/java/org/hibernate/processor/annotation/AnnotationMetaEntity.java
https://github.com/hibernate/hibernate-orm/blob/master/tooling/metamodel-generator/src/main/java/org/hibernate/processor/annotation/AnnotationMetaEntity.java
Apache-2.0
private void createSingleParameterFinder( ExecutableElement method, TypeMirror returnType, TypeElement entity, @Nullable String containerType) { final String methodName = method.getSimpleName().toString(); final VariableElement parameter = method.getParameters().stream() .filter(AnnotationMetaEntity::i...
Create a finder method which returns multiple results.
createSingleParameterFinder
java
hibernate/hibernate-orm
tooling/metamodel-generator/src/main/java/org/hibernate/processor/annotation/AnnotationMetaEntity.java
https://github.com/hibernate/hibernate-orm/blob/master/tooling/metamodel-generator/src/main/java/org/hibernate/processor/annotation/AnnotationMetaEntity.java
Apache-2.0
private static FieldType pickStrategy(FieldType fieldType, String sessionType, List<String> profiles) { if ( ( usingStatelessSession(sessionType) || usingReactiveSession(sessionType) ) && !profiles.isEmpty() ) { // no support for passing fetch profiles i.e. IdentifierLoadAccess // in SS or M.S except via Qu...
Create a finder method which returns multiple results.
pickStrategy
java
hibernate/hibernate-orm
tooling/metamodel-generator/src/main/java/org/hibernate/processor/annotation/AnnotationMetaEntity.java
https://github.com/hibernate/hibernate-orm/blob/master/tooling/metamodel-generator/src/main/java/org/hibernate/processor/annotation/AnnotationMetaEntity.java
Apache-2.0
private boolean matchesNaturalKey(TypeElement entity, List<@Nullable FieldType> fieldTypes) { return fieldTypes.stream().allMatch(type -> type == FieldType.NATURAL_ID) && entity.getEnclosedElements().stream() .filter(member -> hasAnnotation(member, NATURAL_ID)) .count() == fieldTypes.size(); }
Create a finder method which returns multiple results.
matchesNaturalKey
java
hibernate/hibernate-orm
tooling/metamodel-generator/src/main/java/org/hibernate/processor/annotation/AnnotationMetaEntity.java
https://github.com/hibernate/hibernate-orm/blob/master/tooling/metamodel-generator/src/main/java/org/hibernate/processor/annotation/AnnotationMetaEntity.java
Apache-2.0
private @Nullable FieldType validateFinderParameter(TypeElement entityType, VariableElement param) { final String path = parameterName( param ); final boolean idClassRef = isIdRef( path ) && hasAnnotation( entityType, ID_CLASS ); final Element member = idClassRef ? null : memberMatchingPath( entityType, path ); ...
Create a finder method which returns multiple results.
validateFinderParameter
java
hibernate/hibernate-orm
tooling/metamodel-generator/src/main/java/org/hibernate/processor/annotation/AnnotationMetaEntity.java
https://github.com/hibernate/hibernate-orm/blob/master/tooling/metamodel-generator/src/main/java/org/hibernate/processor/annotation/AnnotationMetaEntity.java
Apache-2.0
private TypeMirror actualParameterType(VariableElement param) { final ExecutableElement method = (ExecutableElement) param.getEnclosingElement(); final ExecutableType methodType = (ExecutableType) context.getTypeUtils() .asMemberOf( (DeclaredType) element.asType(), method ); return met...
Create a finder method which returns multiple results.
actualParameterType
java
hibernate/hibernate-orm
tooling/metamodel-generator/src/main/java/org/hibernate/processor/annotation/AnnotationMetaEntity.java
https://github.com/hibernate/hibernate-orm/blob/master/tooling/metamodel-generator/src/main/java/org/hibernate/processor/annotation/AnnotationMetaEntity.java
Apache-2.0
private boolean checkParameterType(TypeElement entityType, VariableElement param, TypeMirror attributeType) { final Types types = context.getTypeUtils(); // if ( entityType.getKind() == CLASS ) { // do no checks if the entity type is a type variable TypeMirror parameterType = parameterType( param ); if ( types...
Check the type of a parameter of a {@code @Find} method against the field type in the entity class. @return true if the parameter is multivalued (i.e. it's an {@code in} condition)
checkParameterType
java
hibernate/hibernate-orm
tooling/metamodel-generator/src/main/java/org/hibernate/processor/annotation/AnnotationMetaEntity.java
https://github.com/hibernate/hibernate-orm/blob/master/tooling/metamodel-generator/src/main/java/org/hibernate/processor/annotation/AnnotationMetaEntity.java
Apache-2.0
private void parameterTypeError(TypeElement entityType, VariableElement param, TypeMirror attributeType) { message(param, "matching field has type '" + stripAnnotations(typeAsString(attributeType)) + "' in entity class '" + entityType + "'", Diagnostic.Kind.ERROR ); }
Check the type of a parameter of a {@code @Find} method against the field type in the entity class. @return true if the parameter is multivalued (i.e. it's an {@code in} condition)
parameterTypeError
java
hibernate/hibernate-orm
tooling/metamodel-generator/src/main/java/org/hibernate/processor/annotation/AnnotationMetaEntity.java
https://github.com/hibernate/hibernate-orm/blob/master/tooling/metamodel-generator/src/main/java/org/hibernate/processor/annotation/AnnotationMetaEntity.java
Apache-2.0
private String stripAnnotations(String type) { if ( type.startsWith("@") ) { final int index = type.lastIndexOf(' '); return index > 0 ? type.substring( index + 1 ) : type; } else { return type; } }
Check the type of a parameter of a {@code @Find} method against the field type in the entity class. @return true if the parameter is multivalued (i.e. it's an {@code in} condition)
stripAnnotations
java
hibernate/hibernate-orm
tooling/metamodel-generator/src/main/java/org/hibernate/processor/annotation/AnnotationMetaEntity.java
https://github.com/hibernate/hibernate-orm/blob/master/tooling/metamodel-generator/src/main/java/org/hibernate/processor/annotation/AnnotationMetaEntity.java
Apache-2.0
private boolean finderParameterNullable(TypeElement entity, VariableElement param) { final Element member = memberMatchingPath( entity, parameterName( param ) ); return isNullable( param ) && ( member == null || isNullable( member ) ); }
Check the type of a parameter of a {@code @Find} method against the field type in the entity class. @return true if the parameter is multivalued (i.e. it's an {@code in} condition)
finderParameterNullable
java
hibernate/hibernate-orm
tooling/metamodel-generator/src/main/java/org/hibernate/processor/annotation/AnnotationMetaEntity.java
https://github.com/hibernate/hibernate-orm/blob/master/tooling/metamodel-generator/src/main/java/org/hibernate/processor/annotation/AnnotationMetaEntity.java
Apache-2.0
private AccessType getAccessType(TypeElement entity) { final String entityClassName = entity.getQualifiedName().toString(); determineAccessTypeForHierarchy( entity, context ); return castNonNull( context.getAccessTypeInfo( entityClassName ) ).getAccessType(); }
Check the type of a parameter of a {@code @Find} method against the field type in the entity class. @return true if the parameter is multivalued (i.e. it's an {@code in} condition)
getAccessType
java
hibernate/hibernate-orm
tooling/metamodel-generator/src/main/java/org/hibernate/processor/annotation/AnnotationMetaEntity.java
https://github.com/hibernate/hibernate-orm/blob/master/tooling/metamodel-generator/src/main/java/org/hibernate/processor/annotation/AnnotationMetaEntity.java
Apache-2.0
private static TypeMirror memberType(Element member) { if ( member.getKind() == ElementKind.METHOD ) { final ExecutableElement method = (ExecutableElement) member; return method.getReturnType(); } else { return member.asType(); } }
Check the type of a parameter of a {@code @Find} method against the field type in the entity class. @return true if the parameter is multivalued (i.e. it's an {@code in} condition)
memberType
java
hibernate/hibernate-orm
tooling/metamodel-generator/src/main/java/org/hibernate/processor/annotation/AnnotationMetaEntity.java
https://github.com/hibernate/hibernate-orm/blob/master/tooling/metamodel-generator/src/main/java/org/hibernate/processor/annotation/AnnotationMetaEntity.java
Apache-2.0
private @Nullable Element memberMatchingPath(TypeElement entityType, String path) { return memberMatchingPath( entityType, new StringTokenizer(path, ".") ); }
Check the type of a parameter of a {@code @Find} method against the field type in the entity class. @return true if the parameter is multivalued (i.e. it's an {@code in} condition)
memberMatchingPath
java
hibernate/hibernate-orm
tooling/metamodel-generator/src/main/java/org/hibernate/processor/annotation/AnnotationMetaEntity.java
https://github.com/hibernate/hibernate-orm/blob/master/tooling/metamodel-generator/src/main/java/org/hibernate/processor/annotation/AnnotationMetaEntity.java
Apache-2.0
private @Nullable Element memberMatchingPath(TypeElement entityType, StringTokenizer tokens) { final AccessType accessType = getAccessType(entityType); final String nextToken = tokens.nextToken(); for ( Element member : context.getAllMembers(entityType) ) { if ( isIdRef(nextToken) && hasAnnotation(member, ID, ...
Check the type of a parameter of a {@code @Find} method against the field type in the entity class. @return true if the parameter is multivalued (i.e. it's an {@code in} condition)
memberMatchingPath
java
hibernate/hibernate-orm
tooling/metamodel-generator/src/main/java/org/hibernate/processor/annotation/AnnotationMetaEntity.java
https://github.com/hibernate/hibernate-orm/blob/master/tooling/metamodel-generator/src/main/java/org/hibernate/processor/annotation/AnnotationMetaEntity.java
Apache-2.0
private static boolean isIdRef(String token) { return "id(this)".equalsIgnoreCase(token); // post M4 }
Check the type of a parameter of a {@code @Find} method against the field type in the entity class. @return true if the parameter is multivalued (i.e. it's an {@code in} condition)
isIdRef
java
hibernate/hibernate-orm
tooling/metamodel-generator/src/main/java/org/hibernate/processor/annotation/AnnotationMetaEntity.java
https://github.com/hibernate/hibernate-orm/blob/master/tooling/metamodel-generator/src/main/java/org/hibernate/processor/annotation/AnnotationMetaEntity.java
Apache-2.0