HHH-6133 Formatting and applying missing licence header
This commit is contained in:
parent
0e20d34cd8
commit
095e858f77
|
@ -23,6 +23,7 @@
|
|||
*/
|
||||
package org.hibernate.metamodel.source.annotations.xml.filter;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
@ -40,13 +41,10 @@ abstract class AbstractAnnotationFilter implements IndexedAnnotationFilter {
|
|||
protected static final DotName[] EMPTY_DOTNAME_ARRAY = new DotName[0];
|
||||
private Set<DotName> candidates;
|
||||
|
||||
|
||||
private boolean match(DotName annName) {
|
||||
if ( candidates == null ) {
|
||||
candidates = new HashSet<DotName>();
|
||||
for ( DotName name : targetAnnotation() ) {
|
||||
candidates.add( name );
|
||||
}
|
||||
candidates.addAll( Arrays.asList( targetAnnotation() ) );
|
||||
}
|
||||
return candidates.contains( annName );
|
||||
}
|
||||
|
|
|
@ -1,3 +1,26 @@
|
|||
/*
|
||||
* Hibernate, Relational Persistence for Idiomatic Java
|
||||
*
|
||||
* Copyright (c) 2011, Red Hat Inc. or third-party contributors as
|
||||
* indicated by the @author tags or express copyright attribution
|
||||
* statements applied by the authors. All third-party contributions are
|
||||
* distributed under license by Red Hat Inc..
|
||||
*
|
||||
* This copyrighted material is made available to anyone wishing to use, modify,
|
||||
* copy, or redistribute it subject to the terms and conditions of the GNU
|
||||
* Lesser General Public License, as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
|
||||
* for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with this distribution; if not, write to:
|
||||
* Free Software Foundation, Inc.
|
||||
* 51 Franklin Street, Fifth Floor
|
||||
* Boston, MA 02110-1301 USA
|
||||
*/
|
||||
package org.hibernate.metamodel.source.annotations.xml.filter;
|
||||
|
||||
import java.util.List;
|
||||
|
@ -32,5 +55,4 @@ class NameAnnotationFilter extends AbstractAnnotationFilter {
|
|||
ENTITY_LISTENERS
|
||||
};
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -89,9 +89,6 @@ class NameTargetAnnotationFilter extends AbstractAnnotationFilter {
|
|||
MAP_KEY_CLASS,
|
||||
MAP_KEY_COLUMN,
|
||||
MAP_KEY_ENUMERATED
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -52,7 +52,8 @@ abstract class AbstractEntityObjectMocker extends AnnotationMocker {
|
|||
AbstractEntityObjectMocker(IndexBuilder indexBuilder, EntityMappingsMocker.Default defaults) {
|
||||
super( indexBuilder, defaults );
|
||||
}
|
||||
private boolean isPreProcessCalled=false;
|
||||
|
||||
private boolean isPreProcessCalled = false;
|
||||
|
||||
final void preProcess() {
|
||||
applyDefaults();
|
||||
|
@ -64,7 +65,7 @@ abstract class AbstractEntityObjectMocker extends AnnotationMocker {
|
|||
}
|
||||
|
||||
final void process() {
|
||||
if(!isPreProcessCalled){
|
||||
if ( !isPreProcessCalled ) {
|
||||
throw new AssertionFailure( "preProcess should be called before process" );
|
||||
}
|
||||
if ( getAccessType() == null ) {
|
||||
|
@ -177,6 +178,4 @@ abstract class AbstractEntityObjectMocker extends AnnotationMocker {
|
|||
protected AnnotationTarget getTarget() {
|
||||
return classInfo;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -51,6 +51,8 @@ import org.hibernate.metamodel.source.annotation.xml.XMLUniqueConstraint;
|
|||
import org.hibernate.metamodel.source.annotations.JPADotNames;
|
||||
|
||||
/**
|
||||
* Base class for the mock jandex annotations created from orm.xml.
|
||||
*
|
||||
* @author Strong Liu
|
||||
*/
|
||||
abstract class AbstractMocker implements JPADotNames {
|
||||
|
@ -60,7 +62,6 @@ abstract class AbstractMocker implements JPADotNames {
|
|||
this.indexBuilder = indexBuilder;
|
||||
}
|
||||
|
||||
|
||||
abstract protected EntityMappingsMocker.Default getDefaults();
|
||||
|
||||
/**
|
||||
|
@ -119,9 +120,8 @@ abstract class AbstractMocker implements JPADotNames {
|
|||
|
||||
}
|
||||
|
||||
|
||||
//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
//@Column
|
||||
//@Column
|
||||
protected AnnotationInstance parserColumn(XMLColumn column, AnnotationTarget target) {
|
||||
if ( column == null ) {
|
||||
return null;
|
||||
|
@ -558,7 +558,6 @@ abstract class AbstractMocker implements JPADotNames {
|
|||
return create( JOIN_COLUMN, target, annotationValueList );
|
||||
}
|
||||
|
||||
|
||||
protected AnnotationInstance parserLob(XMLLob lob, AnnotationTarget target) {
|
||||
if ( lob == null ) {
|
||||
return null;
|
||||
|
|
|
@ -40,8 +40,8 @@ import org.hibernate.metamodel.source.annotations.util.JandexHelper;
|
|||
/**
|
||||
* @author Strong Liu
|
||||
*/
|
||||
class AccessHelper implements JPADotNames {
|
||||
static XMLAccessType getAccessFromIdPosition(DotName className, IndexBuilder indexBuilder) {
|
||||
class AccessHelper implements JPADotNames {
|
||||
static XMLAccessType getAccessFromIdPosition(DotName className, IndexBuilder indexBuilder) {
|
||||
Map<DotName, List<AnnotationInstance>> indexedAnnotations = indexBuilder.getIndexedAnnotations( className );
|
||||
Map<DotName, List<AnnotationInstance>> ormAnnotations = indexBuilder.getClassInfoAnnotationsMap( className );
|
||||
XMLAccessType accessType = getAccessFromIdPosition( ormAnnotations );
|
||||
|
@ -93,11 +93,11 @@ import org.hibernate.metamodel.source.annotations.util.JandexHelper;
|
|||
return accessType;
|
||||
}
|
||||
|
||||
static XMLAccessType annotationTargetToAccessType(AnnotationTarget target) {
|
||||
static XMLAccessType annotationTargetToAccessType(AnnotationTarget target) {
|
||||
return ( target instanceof MethodInfo ) ? XMLAccessType.PROPERTY : XMLAccessType.FIELD;
|
||||
}
|
||||
|
||||
static XMLAccessType getEntityAccess(DotName className, IndexBuilder indexBuilder) {
|
||||
static XMLAccessType getEntityAccess(DotName className, IndexBuilder indexBuilder) {
|
||||
Map<DotName, List<AnnotationInstance>> indexedAnnotations = indexBuilder.getIndexedAnnotations( className );
|
||||
Map<DotName, List<AnnotationInstance>> ormAnnotations = indexBuilder.getClassInfoAnnotationsMap( className );
|
||||
XMLAccessType accessType = getAccess( ormAnnotations );
|
||||
|
@ -138,7 +138,7 @@ import org.hibernate.metamodel.source.annotations.util.JandexHelper;
|
|||
.containsKey( EMBEDDABLE );
|
||||
}
|
||||
|
||||
static XMLAccessType getAccessFromAttributeAnnotation(DotName className, String attributeName, IndexBuilder indexBuilder) {
|
||||
static XMLAccessType getAccessFromAttributeAnnotation(DotName className, String attributeName, IndexBuilder indexBuilder) {
|
||||
Map<DotName, List<AnnotationInstance>> indexedAnnotations = indexBuilder.getIndexedAnnotations( className );
|
||||
if ( indexedAnnotations != null && indexedAnnotations.containsKey( ACCESS ) ) {
|
||||
List<AnnotationInstance> annotationInstances = indexedAnnotations.get( ACCESS );
|
||||
|
|
|
@ -27,10 +27,8 @@ package org.hibernate.metamodel.source.annotations.xml.mocker;
|
|||
* @author Strong Liu
|
||||
*/
|
||||
abstract class AnnotationMocker extends AbstractMocker {
|
||||
|
||||
private EntityMappingsMocker.Default defaults;
|
||||
|
||||
|
||||
AnnotationMocker(IndexBuilder indexBuilder, EntityMappingsMocker.Default defaults) {
|
||||
super( indexBuilder );
|
||||
this.defaults = defaults;
|
||||
|
|
|
@ -106,6 +106,4 @@ class AttributesBuilder extends AbstractAttributesBuilder {
|
|||
XMLEmbeddedId getEmbeddedId() {
|
||||
return attributes.getEmbeddedId();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -66,9 +66,9 @@ class BasicMocker extends PropertyMocker {
|
|||
protected XMLAccessType getAccessType() {
|
||||
return basic.getAccess();
|
||||
}
|
||||
@Override
|
||||
|
||||
@Override
|
||||
protected void setAccessType(XMLAccessType accessType) {
|
||||
basic.setAccess( accessType );
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -71,8 +71,6 @@ class ElementCollectionMocker extends PropertyMocker {
|
|||
parserMapKeyClass( elementCollection.getMapKeyClass(), getTarget() );
|
||||
parserMapKeyEnumerated( elementCollection.getMapKeyEnumerated(), getTarget() );
|
||||
parserMapKeyTemporal( elementCollection.getMapKeyTemporal(), getTarget() );
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -84,7 +82,8 @@ class ElementCollectionMocker extends PropertyMocker {
|
|||
protected XMLAccessType getAccessType() {
|
||||
return elementCollection.getAccess();
|
||||
}
|
||||
@Override
|
||||
|
||||
@Override
|
||||
protected void setAccessType(XMLAccessType accessType) {
|
||||
elementCollection.setAccess( accessType );
|
||||
}
|
||||
|
|
|
@ -107,6 +107,4 @@ class EmbeddableAttributesBuilder extends AbstractAttributesBuilder {
|
|||
XMLEmbeddedId getEmbeddedId() {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -41,6 +41,7 @@ import org.hibernate.metamodel.source.annotation.xml.XMLPreUpdate;
|
|||
|
||||
/**
|
||||
* Mock <embeddable> to {@link javax.persistence.Embeddable @Embeddable}
|
||||
*
|
||||
* @author Strong Liu
|
||||
*/
|
||||
class EmbeddableMocker extends AbstractEntityObjectMocker {
|
||||
|
@ -78,7 +79,6 @@ class EmbeddableMocker extends AbstractEntityObjectMocker {
|
|||
embeddable.setMetadataComplete( getDefaults().getMetadataComplete() );
|
||||
}
|
||||
LOG.debugf( "Adding XML overriding information for %s", className );
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -53,7 +53,8 @@ class EmbeddedIdMocker extends PropertyMocker {
|
|||
protected XMLAccessType getAccessType() {
|
||||
return embeddedId.getAccess();
|
||||
}
|
||||
@Override
|
||||
|
||||
@Override
|
||||
protected void setAccessType(XMLAccessType accessType) {
|
||||
embeddedId.setAccess( accessType );
|
||||
}
|
||||
|
|
|
@ -251,9 +251,5 @@ public class EntityMappingsMocker {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -1,3 +1,26 @@
|
|||
/*
|
||||
* Hibernate, Relational Persistence for Idiomatic Java
|
||||
*
|
||||
* Copyright (c) 2011, Red Hat Inc. or third-party contributors as
|
||||
* indicated by the @author tags or express copyright attribution
|
||||
* statements applied by the authors. All third-party contributions are
|
||||
* distributed under license by Red Hat Inc..
|
||||
*
|
||||
* This copyrighted material is made available to anyone wishing to use, modify,
|
||||
* copy, or redistribute it subject to the terms and conditions of the GNU
|
||||
* Lesser General Public License, as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
|
||||
* for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with this distribution; if not, write to:
|
||||
* Free Software Foundation, Inc.
|
||||
* 51 Franklin Street, Fifth Floor
|
||||
* Boston, MA 02110-1301 USA
|
||||
*/
|
||||
package org.hibernate.metamodel.source.annotations.xml.mocker;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
@ -30,8 +53,6 @@ import org.hibernate.metamodel.source.annotation.xml.XMLPreRemove;
|
|||
import org.hibernate.metamodel.source.annotation.xml.XMLPreUpdate;
|
||||
import org.hibernate.metamodel.source.annotation.xml.XMLSecondaryTable;
|
||||
import org.hibernate.metamodel.source.annotation.xml.XMLTable;
|
||||
import org.hibernate.metamodel.source.annotations.util.JandexHelper;
|
||||
|
||||
|
||||
/**
|
||||
* Mock <entity> to {@link javax.persistence.Entity @Entity}
|
||||
|
@ -313,6 +334,4 @@ class EntityMocker extends AbstractEntityObjectMocker {
|
|||
return MockHelper.EMPTY_ANNOTATION_VALUE_ARRAY;
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -1,3 +1,26 @@
|
|||
/*
|
||||
* Hibernate, Relational Persistence for Idiomatic Java
|
||||
*
|
||||
* Copyright (c) 2011, Red Hat Inc. or third-party contributors as
|
||||
* indicated by the @author tags or express copyright attribution
|
||||
* statements applied by the authors. All third-party contributions are
|
||||
* distributed under license by Red Hat Inc..
|
||||
*
|
||||
* This copyrighted material is made available to anyone wishing to use, modify,
|
||||
* copy, or redistribute it subject to the terms and conditions of the GNU
|
||||
* Lesser General Public License, as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
|
||||
* for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with this distribution; if not, write to:
|
||||
* Free Software Foundation, Inc.
|
||||
* 51 Franklin Street, Fifth Floor
|
||||
* Boston, MA 02110-1301 USA
|
||||
*/
|
||||
package org.hibernate.metamodel.source.annotations.xml.mocker;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
@ -118,7 +141,6 @@ class GlobalAnnotations implements JPADotNames {
|
|||
for ( AnnotationInstance annotationInstance : indexedAnnotationInstanceList ) {
|
||||
pushIfNotExist( annotationInstance );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void pushIfNotExist(AnnotationInstance annotationInstance) {
|
||||
|
@ -142,7 +164,6 @@ class GlobalAnnotations implements JPADotNames {
|
|||
if ( isNotExist ) {
|
||||
push( annName, annotationInstance );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void collectGlobalMappings(XMLEntityMappings entityMappings, EntityMappingsMocker.Default defaults) {
|
||||
|
@ -225,6 +246,4 @@ class GlobalAnnotations implements JPADotNames {
|
|||
}
|
||||
return generator;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -46,6 +46,7 @@ import org.hibernate.metamodel.source.annotation.xml.XMLTableGenerator;
|
|||
/**
|
||||
* note: Global Configurations {@link org.hibernate.metamodel.source.annotations.xml.filter.IndexedAnnotationFilter.GLOBAL_ANNOTATIONS}
|
||||
* in the new build Index has no target
|
||||
*
|
||||
* @author Strong Liu
|
||||
*/
|
||||
class GlobalConfigurationMocker extends AbstractMocker {
|
||||
|
@ -165,7 +166,9 @@ class GlobalConfigurationMocker extends AbstractMocker {
|
|||
"", annotationInstance
|
||||
);
|
||||
}
|
||||
MockHelper.addToCollectionIfNotNull( annotationValueList, AnnotationValue.createArrayValue( name, values ) );
|
||||
MockHelper.addToCollectionIfNotNull(
|
||||
annotationValueList, AnnotationValue.createArrayValue( name, values )
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -183,7 +186,9 @@ class GlobalConfigurationMocker extends AbstractMocker {
|
|||
"", annotationInstance
|
||||
);
|
||||
}
|
||||
MockHelper.addToCollectionIfNotNull( annotationValueList, AnnotationValue.createArrayValue( name, values ) );
|
||||
MockHelper.addToCollectionIfNotNull(
|
||||
annotationValueList, AnnotationValue.createArrayValue( name, values )
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -205,7 +210,9 @@ class GlobalConfigurationMocker extends AbstractMocker {
|
|||
"", annotationInstance
|
||||
);
|
||||
}
|
||||
MockHelper.addToCollectionIfNotNull( annotationValueList, AnnotationValue.createArrayValue( name, values ) );
|
||||
MockHelper.addToCollectionIfNotNull(
|
||||
annotationValueList, AnnotationValue.createArrayValue( name, values )
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -290,7 +297,9 @@ class GlobalConfigurationMocker extends AbstractMocker {
|
|||
"", annotationInstance
|
||||
);
|
||||
}
|
||||
MockHelper.addToCollectionIfNotNull( annotationValueList, AnnotationValue.createArrayValue( name, values ) );
|
||||
MockHelper.addToCollectionIfNotNull(
|
||||
annotationValueList, AnnotationValue.createArrayValue( name, values )
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -25,17 +25,12 @@ package org.hibernate.metamodel.source.annotations.xml.mocker;
|
|||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.jboss.jandex.AnnotationInstance;
|
||||
import org.jboss.jandex.AnnotationTarget;
|
||||
import org.jboss.jandex.AnnotationValue;
|
||||
import org.jboss.jandex.ClassInfo;
|
||||
import org.jboss.jandex.DotName;
|
||||
import org.jboss.jandex.MethodInfo;
|
||||
|
||||
import org.hibernate.AnnotationException;
|
||||
import org.hibernate.HibernateException;
|
||||
import org.hibernate.metamodel.source.annotation.xml.XMLAccessType;
|
||||
import org.hibernate.metamodel.source.annotation.xml.XMLGeneratedValue;
|
||||
import org.hibernate.metamodel.source.annotation.xml.XMLId;
|
||||
|
@ -86,6 +81,4 @@ class IdMocker extends PropertyMocker {
|
|||
protected void setAccessType(XMLAccessType accessType) {
|
||||
id.setAccess( accessType );
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -157,7 +157,8 @@ public class IndexBuilder {
|
|||
public ClassInfo getClassInfo(DotName name) {
|
||||
return classes.get( name );
|
||||
}
|
||||
public ClassInfo getIndexedClassInfo(DotName name){
|
||||
|
||||
public ClassInfo getIndexedClassInfo(DotName name) {
|
||||
return index.getClassByName( name );
|
||||
}
|
||||
|
||||
|
@ -303,6 +304,4 @@ public class IndexBuilder {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -66,7 +66,7 @@ class ListenerMocker extends AbstractMocker {
|
|||
parser( listener );
|
||||
|
||||
}
|
||||
MockHelper.classArrayValue( "value", clazzNameList, annotationValueList,indexBuilder.getServiceRegistry() );
|
||||
MockHelper.classArrayValue( "value", clazzNameList, annotationValueList, indexBuilder.getServiceRegistry() );
|
||||
return create( ENTITY_LISTENERS, annotationValueList );
|
||||
}
|
||||
|
||||
|
@ -81,7 +81,7 @@ class ListenerMocker extends AbstractMocker {
|
|||
builder.parser( listener.getPrePersist() );
|
||||
builder.parser( listener.getPreRemove() );
|
||||
builder.parser( listener.getPreUpdate() );
|
||||
indexBuilder.finishEntityObject( tempClassInfo.name(),null );
|
||||
indexBuilder.finishEntityObject( tempClassInfo.name(), null );
|
||||
}
|
||||
|
||||
//@PrePersist
|
||||
|
|
|
@ -63,8 +63,8 @@ class ManyToManyMocker extends PropertyMocker {
|
|||
parserMapKeyTemporal( manyToMany.getMapKeyTemporal(), getTarget() );
|
||||
parserMapKeyEnumerated( manyToMany.getMapKeyEnumerated(), getTarget() );
|
||||
parserMapKey( manyToMany.getMapKey(), getTarget() );
|
||||
parserAttributeOverrides( manyToMany.getMapKeyAttributeOverride(),getTarget() );
|
||||
parserMapKeyJoinColumnList( manyToMany.getMapKeyJoinColumn(),getTarget() );
|
||||
parserAttributeOverrides( manyToMany.getMapKeyAttributeOverride(), getTarget() );
|
||||
parserMapKeyJoinColumnList( manyToMany.getMapKeyJoinColumn(), getTarget() );
|
||||
parserOrderColumn( manyToMany.getOrderColumn(), getTarget() );
|
||||
parserJoinTable( manyToMany.getJoinTable(), getTarget() );
|
||||
if ( manyToMany.getOrderBy() != null ) {
|
||||
|
@ -76,7 +76,8 @@ class ManyToManyMocker extends PropertyMocker {
|
|||
protected XMLAccessType getAccessType() {
|
||||
return manyToMany.getAccess();
|
||||
}
|
||||
@Override
|
||||
|
||||
@Override
|
||||
protected void setAccessType(XMLAccessType accessType) {
|
||||
manyToMany.setAccess( accessType );
|
||||
}
|
||||
|
|
|
@ -72,9 +72,9 @@ class ManyToOneMocker extends PropertyMocker {
|
|||
protected XMLAccessType getAccessType() {
|
||||
return manyToOne.getAccess();
|
||||
}
|
||||
@Override
|
||||
|
||||
@Override
|
||||
protected void setAccessType(XMLAccessType accessType) {
|
||||
manyToOne.setAccess( accessType );
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -41,6 +41,7 @@ import org.hibernate.metamodel.source.annotation.xml.XMLPreUpdate;
|
|||
|
||||
/**
|
||||
* Mock <mapped-superclass> to {@link javax.persistence.MappedSuperclass @MappedSuperClass}
|
||||
*
|
||||
* @author Strong Liu
|
||||
*/
|
||||
class MappedSuperclassMocker extends AbstractEntityObjectMocker {
|
||||
|
@ -54,6 +55,7 @@ class MappedSuperclassMocker extends AbstractEntityObjectMocker {
|
|||
super( indexBuilder, defaults );
|
||||
this.mappedSuperclass = mappedSuperclass;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void applyDefaults() {
|
||||
String className = MockHelper.buildSafeClassName( mappedSuperclass.getClazz(), getDefaults().getPackageName() );
|
||||
|
@ -142,6 +144,4 @@ class MappedSuperclassMocker extends AbstractEntityObjectMocker {
|
|||
protected XMLPostLoad getPostLoad() {
|
||||
return mappedSuperclass.getPostLoad();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -60,7 +60,7 @@ class OneToManyMocker extends PropertyMocker {
|
|||
MockHelper.cascadeValue( "cascade", oneToMany.getCascade(), isDefaultCascadePersist(), annotationValueList );
|
||||
create( ONE_TO_MANY, getTarget(), annotationValueList );
|
||||
parserAttributeOverrides( oneToMany.getMapKeyAttributeOverride(), getTarget() );
|
||||
parserMapKeyJoinColumnList( oneToMany.getMapKeyJoinColumn(),getTarget() );
|
||||
parserMapKeyJoinColumnList( oneToMany.getMapKeyJoinColumn(), getTarget() );
|
||||
parserMapKey( oneToMany.getMapKey(), getTarget() );
|
||||
parserMapKeyColumn( oneToMany.getMapKeyColumn(), getTarget() );
|
||||
parserMapKeyClass( oneToMany.getMapKeyClass(), getTarget() );
|
||||
|
@ -78,7 +78,8 @@ class OneToManyMocker extends PropertyMocker {
|
|||
protected XMLAccessType getAccessType() {
|
||||
return oneToMany.getAccess();
|
||||
}
|
||||
@Override
|
||||
|
||||
@Override
|
||||
protected void setAccessType(XMLAccessType accessType) {
|
||||
oneToMany.setAccess( accessType );
|
||||
}
|
||||
|
|
|
@ -76,7 +76,8 @@ class OneToOneMocker extends PropertyMocker {
|
|||
protected XMLAccessType getAccessType() {
|
||||
return oneToOne.getAccess();
|
||||
}
|
||||
@Override
|
||||
|
||||
@Override
|
||||
protected void setAccessType(XMLAccessType accessType) {
|
||||
oneToOne.setAccess( accessType );
|
||||
}
|
||||
|
|
|
@ -53,7 +53,8 @@ class TransientMocker extends PropertyMocker {
|
|||
protected XMLAccessType getAccessType() {
|
||||
return XMLAccessType.FIELD;
|
||||
}
|
||||
@Override
|
||||
|
||||
@Override
|
||||
protected void setAccessType(XMLAccessType accessType) {
|
||||
//ignore
|
||||
}
|
||||
|
|
|
@ -55,10 +55,9 @@ class VersionMocker extends PropertyMocker {
|
|||
protected XMLAccessType getAccessType() {
|
||||
return version.getAccess();
|
||||
}
|
||||
@Override
|
||||
|
||||
@Override
|
||||
protected void setAccessType(XMLAccessType accessType) {
|
||||
version.setAccess( accessType );
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -50,5 +50,4 @@ class XMLAssociationOverrideProxy extends XMLAssociationOverride {
|
|||
void setJoinTableAnnotationValue(AnnotationValue joinTableAnnotationValue) {
|
||||
this.joinTableAnnotationValue = joinTableAnnotationValue;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,28 @@
|
|||
/*
|
||||
* Hibernate, Relational Persistence for Idiomatic Java
|
||||
*
|
||||
* Copyright (c) 2011 by Red Hat Inc and/or its affiliates or by
|
||||
* third-party contributors as indicated by either @author tags or express
|
||||
* copyright attribution statements applied by the authors. All
|
||||
* third-party contributions are distributed under license by Red Hat Inc.
|
||||
*
|
||||
* This copyrighted material is made available to anyone wishing to use, modify,
|
||||
* copy, or redistribute it subject to the terms and conditions of the GNU
|
||||
* Lesser General Public License, as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
|
||||
* for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with this distribution; if not, write to:
|
||||
* Free Software Foundation, Inc.
|
||||
* 51 Franklin Street, Fifth Floor
|
||||
* Boston, MA 02110-1301 USA
|
||||
*/
|
||||
package org.hibernate.metamodel.source.annotations.xml.mocker;
|
||||
|
||||
/**
|
||||
* Mocker classes to create mock JPA annotations from orm.xml
|
||||
*/
|
|
@ -1,3 +1,26 @@
|
|||
/*
|
||||
* Hibernate, Relational Persistence for Idiomatic Java
|
||||
*
|
||||
* Copyright (c) 2011, Red Hat Inc. or third-party contributors as
|
||||
* indicated by the @author tags or express copyright attribution
|
||||
* statements applied by the authors. All third-party contributions are
|
||||
* distributed under license by Red Hat Inc..
|
||||
*
|
||||
* This copyrighted material is made available to anyone wishing to use, modify,
|
||||
* copy, or redistribute it subject to the terms and conditions of the GNU
|
||||
* Lesser General Public License, as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
|
||||
* for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with this distribution; if not, write to:
|
||||
* Free Software Foundation, Inc.
|
||||
* 51 Franklin Street, Fifth Floor
|
||||
* Boston, MA 02110-1301 USA
|
||||
*/
|
||||
package org.hibernate.metamodel.source.annotations.xml.mocker;
|
||||
|
||||
import java.io.IOException;
|
||||
|
|
|
@ -1,3 +1,26 @@
|
|||
/*
|
||||
* Hibernate, Relational Persistence for Idiomatic Java
|
||||
*
|
||||
* Copyright (c) 2011, Red Hat Inc. or third-party contributors as
|
||||
* indicated by the @author tags or express copyright attribution
|
||||
* statements applied by the authors. All third-party contributions are
|
||||
* distributed under license by Red Hat Inc..
|
||||
*
|
||||
* This copyrighted material is made available to anyone wishing to use, modify,
|
||||
* copy, or redistribute it subject to the terms and conditions of the GNU
|
||||
* Lesser General Public License, as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
|
||||
* for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with this distribution; if not, write to:
|
||||
* Free Software Foundation, Inc.
|
||||
* 51 Franklin Street, Fifth Floor
|
||||
* Boston, MA 02110-1301 USA
|
||||
*/
|
||||
package org.hibernate.metamodel.source.annotations.xml.mocker;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
|
|
@ -1,3 +1,26 @@
|
|||
/*
|
||||
* Hibernate, Relational Persistence for Idiomatic Java
|
||||
*
|
||||
* Copyright (c) 2011, Red Hat Inc. or third-party contributors as
|
||||
* indicated by the @author tags or express copyright attribution
|
||||
* statements applied by the authors. All third-party contributions are
|
||||
* distributed under license by Red Hat Inc..
|
||||
*
|
||||
* This copyrighted material is made available to anyone wishing to use, modify,
|
||||
* copy, or redistribute it subject to the terms and conditions of the GNU
|
||||
* Lesser General Public License, as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
|
||||
* for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with this distribution; if not, write to:
|
||||
* Free Software Foundation, Inc.
|
||||
* 51 Franklin Street, Fifth Floor
|
||||
* Boston, MA 02110-1301 USA
|
||||
*/
|
||||
package org.hibernate.metamodel.source.annotations.xml.mocker;
|
||||
|
||||
import org.jboss.jandex.AnnotationInstance;
|
||||
|
|
|
@ -1,3 +1,26 @@
|
|||
/*
|
||||
* Hibernate, Relational Persistence for Idiomatic Java
|
||||
*
|
||||
* Copyright (c) 2011, Red Hat Inc. or third-party contributors as
|
||||
* indicated by the @author tags or express copyright attribution
|
||||
* statements applied by the authors. All third-party contributions are
|
||||
* distributed under license by Red Hat Inc..
|
||||
*
|
||||
* This copyrighted material is made available to anyone wishing to use, modify,
|
||||
* copy, or redistribute it subject to the terms and conditions of the GNU
|
||||
* Lesser General Public License, as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
|
||||
* for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with this distribution; if not, write to:
|
||||
* Free Software Foundation, Inc.
|
||||
* 51 Franklin Street, Fifth Floor
|
||||
* Boston, MA 02110-1301 USA
|
||||
*/
|
||||
package org.hibernate.metamodel.source.annotations.xml.mocker;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
|
|
@ -1,3 +1,26 @@
|
|||
/*
|
||||
* Hibernate, Relational Persistence for Idiomatic Java
|
||||
*
|
||||
* Copyright (c) 2011, Red Hat Inc. or third-party contributors as
|
||||
* indicated by the @author tags or express copyright attribution
|
||||
* statements applied by the authors. All third-party contributions are
|
||||
* distributed under license by Red Hat Inc..
|
||||
*
|
||||
* This copyrighted material is made available to anyone wishing to use, modify,
|
||||
* copy, or redistribute it subject to the terms and conditions of the GNU
|
||||
* Lesser General Public License, as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
|
||||
* for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with this distribution; if not, write to:
|
||||
* Free Software Foundation, Inc.
|
||||
* 51 Franklin Street, Fifth Floor
|
||||
* Boston, MA 02110-1301 USA
|
||||
*/
|
||||
package org.hibernate.metamodel.source.annotations.xml.mocker;
|
||||
|
||||
import org.jboss.jandex.ClassInfo;
|
||||
|
|
|
@ -1,3 +1,26 @@
|
|||
/*
|
||||
* Hibernate, Relational Persistence for Idiomatic Java
|
||||
*
|
||||
* Copyright (c) 2011, Red Hat Inc. or third-party contributors as
|
||||
* indicated by the @author tags or express copyright attribution
|
||||
* statements applied by the authors. All third-party contributions are
|
||||
* distributed under license by Red Hat Inc..
|
||||
*
|
||||
* This copyrighted material is made available to anyone wishing to use, modify,
|
||||
* copy, or redistribute it subject to the terms and conditions of the GNU
|
||||
* Lesser General Public License, as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
|
||||
* for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with this distribution; if not, write to:
|
||||
* Free Software Foundation, Inc.
|
||||
* 51 Franklin Street, Fifth Floor
|
||||
* Boston, MA 02110-1301 USA
|
||||
*/
|
||||
package org.hibernate.metamodel.source.annotations.xml.mocker;
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,3 +1,26 @@
|
|||
/*
|
||||
* Hibernate, Relational Persistence for Idiomatic Java
|
||||
*
|
||||
* Copyright (c) 2011, Red Hat Inc. or third-party contributors as
|
||||
* indicated by the @author tags or express copyright attribution
|
||||
* statements applied by the authors. All third-party contributions are
|
||||
* distributed under license by Red Hat Inc..
|
||||
*
|
||||
* This copyrighted material is made available to anyone wishing to use, modify,
|
||||
* copy, or redistribute it subject to the terms and conditions of the GNU
|
||||
* Lesser General Public License, as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
|
||||
* for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with this distribution; if not, write to:
|
||||
* Free Software Foundation, Inc.
|
||||
* 51 Franklin Street, Fifth Floor
|
||||
* Boston, MA 02110-1301 USA
|
||||
*/
|
||||
package org.hibernate.metamodel.source.annotations.xml.mocker;
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,3 +1,26 @@
|
|||
/*
|
||||
* Hibernate, Relational Persistence for Idiomatic Java
|
||||
*
|
||||
* Copyright (c) 2011, Red Hat Inc. or third-party contributors as
|
||||
* indicated by the @author tags or express copyright attribution
|
||||
* statements applied by the authors. All third-party contributions are
|
||||
* distributed under license by Red Hat Inc..
|
||||
*
|
||||
* This copyrighted material is made available to anyone wishing to use, modify,
|
||||
* copy, or redistribute it subject to the terms and conditions of the GNU
|
||||
* Lesser General Public License, as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
|
||||
* for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with this distribution; if not, write to:
|
||||
* Free Software Foundation, Inc.
|
||||
* 51 Franklin Street, Fifth Floor
|
||||
* Boston, MA 02110-1301 USA
|
||||
*/
|
||||
package org.hibernate.metamodel.source.annotations.xml.mocker;
|
||||
|
||||
import java.util.List;
|
||||
|
@ -31,7 +54,6 @@ public class OverrideTest extends AbstractMockerTest {
|
|||
};
|
||||
}
|
||||
|
||||
|
||||
@Test
|
||||
public void testPersistenceUnitMetadataMetadataComplete() {
|
||||
XMLEntity author = new XMLEntity();
|
||||
|
@ -51,24 +73,25 @@ public class OverrideTest extends AbstractMockerTest {
|
|||
|
||||
@Test
|
||||
public void testEntityMetadataComplete() {
|
||||
Index index =getMockedIndex( "entity-metadata-complete.xml" );
|
||||
Index index = getMockedIndex( "entity-metadata-complete.xml" );
|
||||
DotName authorName = DotName.createSimple( Author.class.getName() );
|
||||
ClassInfo authorClassInfo= index.getClassByName( authorName );
|
||||
assertHasAnnotation( index,authorName,JPADotNames.ENTITY );
|
||||
ClassInfo authorClassInfo = index.getClassByName( authorName );
|
||||
assertHasAnnotation( index, authorName, JPADotNames.ENTITY );
|
||||
assertHasAnnotation( index, authorName, JPADotNames.ID_CLASS );
|
||||
assertEquals( 2, authorClassInfo.annotations().size() );
|
||||
DotName bookName = DotName.createSimple( Book.class.getName() );
|
||||
assertHasAnnotation( index,bookName,JPADotNames.ENTITY );
|
||||
assertHasAnnotation( index, bookName, JPADotNames.ENTITY );
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testOverrideToMappedSuperClass(){
|
||||
Index index =getMockedIndex( "override-to-mappedsuperclass.xml" );
|
||||
public void testOverrideToMappedSuperClass() {
|
||||
Index index = getMockedIndex( "override-to-mappedsuperclass.xml" );
|
||||
index.printAnnotations();
|
||||
DotName authorName = DotName.createSimple( Author.class.getName() );
|
||||
assertHasAnnotation( index,authorName,JPADotNames.ENTITY );
|
||||
assertHasAnnotation( index, authorName, JPADotNames.ENTITY );
|
||||
assertHasNoAnnotation( index, authorName, JPADotNames.TABLE );
|
||||
DotName bookName = DotName.createSimple( Book.class.getName() );
|
||||
assertHasAnnotation( index,bookName,JPADotNames.MAPPED_SUPERCLASS );
|
||||
assertHasAnnotation( index, bookName, JPADotNames.MAPPED_SUPERCLASS );
|
||||
assertHasNoAnnotation( index, bookName, JPADotNames.TABLE );
|
||||
|
||||
}
|
||||
|
@ -93,7 +116,7 @@ public class OverrideTest extends AbstractMockerTest {
|
|||
|
||||
@Test
|
||||
public void testPersistenceUnitDefaultsCascadePersistInXML() {
|
||||
Index index =getMockedIndex( "AttributeOverride.xml" );
|
||||
Index index = getMockedIndex( "AttributeOverride.xml" );
|
||||
DotName className = DotName.createSimple( Author.class.getName() );
|
||||
assertAnnotationValue(
|
||||
index,
|
||||
|
@ -129,7 +152,7 @@ public class OverrideTest extends AbstractMockerTest {
|
|||
*/
|
||||
@Test
|
||||
public void testAttributeOverride() {
|
||||
Index index =getMockedIndex( "AttributeOverride.xml" );
|
||||
Index index = getMockedIndex( "AttributeOverride.xml" );
|
||||
DotName className = DotName.createSimple( Book.class.getName() );
|
||||
index.printAnnotations();
|
||||
assertHasNoAnnotation(
|
||||
|
@ -140,7 +163,7 @@ public class OverrideTest extends AbstractMockerTest {
|
|||
assertAnnotationValue(
|
||||
index,
|
||||
className,
|
||||
JPADotNames.ATTRIBUTE_OVERRIDES, new AnnotationValueChecker() {
|
||||
JPADotNames.ATTRIBUTE_OVERRIDES, new AnnotationValueChecker() {
|
||||
@Override
|
||||
public void check(AnnotationInstance annotationInstance) {
|
||||
AnnotationValue value = annotationInstance.value();
|
||||
|
@ -167,7 +190,7 @@ public class OverrideTest extends AbstractMockerTest {
|
|||
|
||||
@Test
|
||||
public void testSchemaInPersistenceMetadata() {
|
||||
Index index =getMockedIndex( "default-schema.xml" );
|
||||
Index index = getMockedIndex( "default-schema.xml" );
|
||||
index.printAnnotations();
|
||||
//Global Configuration should be accessed like this, not from ClassInfo
|
||||
List<AnnotationInstance> annotationInstanceList = index.getAnnotations( JPADotNames.TABLE_GENERATOR );
|
||||
|
@ -201,7 +224,7 @@ public class OverrideTest extends AbstractMockerTest {
|
|||
|
||||
@Test
|
||||
public void testSchemaInEntityMapping() {
|
||||
Index index =getMockedIndex( "default-schema2.xml" );
|
||||
Index index = getMockedIndex( "default-schema2.xml" );
|
||||
index.printAnnotations();
|
||||
//Global Configuration should be accessed like this, not from ClassInfo
|
||||
List<AnnotationInstance> annotationInstanceList = index.getAnnotations( JPADotNames.TABLE_GENERATOR );
|
||||
|
@ -226,6 +249,4 @@ public class OverrideTest extends AbstractMockerTest {
|
|||
assertEquals( 0, annotationInstanceList.size() );
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -1,3 +1,26 @@
|
|||
/*
|
||||
* Hibernate, Relational Persistence for Idiomatic Java
|
||||
*
|
||||
* Copyright (c) 2011, Red Hat Inc. or third-party contributors as
|
||||
* indicated by the @author tags or express copyright attribution
|
||||
* statements applied by the authors. All third-party contributions are
|
||||
* distributed under license by Red Hat Inc..
|
||||
*
|
||||
* This copyrighted material is made available to anyone wishing to use, modify,
|
||||
* copy, or redistribute it subject to the terms and conditions of the GNU
|
||||
* Lesser General Public License, as published by the Free Software Foundation.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
|
||||
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
|
||||
* for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with this distribution; if not, write to:
|
||||
* Free Software Foundation, Inc.
|
||||
* 51 Franklin Street, Fifth Floor
|
||||
* Boston, MA 02110-1301 USA
|
||||
*/
|
||||
package org.hibernate.metamodel.source.annotations.xml.mocker;
|
||||
|
||||
import javax.persistence.Embeddable;
|
||||
|
|
Loading…
Reference in New Issue