/** * INTERNAL: * initialize the Policy */ public void initialize(AbstractSession session, ClassDescriptor descriptor) { //3934266 If changePolicy is ObjectChangeTrackingPolicy or AttributeChangeTrackingPolicy, the class represented //by the descriptor must implement ChangeTracker interface. Otherwise throw an exception. Class javaClass = descriptor.getJavaClass(); if (!ChangeTracker.class.isAssignableFrom(javaClass)) { session.getIntegrityChecker().handleError(DescriptorException.needToImplementChangeTracker(descriptor)); } }
/** * INTERNAL: * initialize the Policy */ public void initialize(AbstractSession session, ClassDescriptor descriptor) { //3934266 If changePolicy is ObjectChangeTrackingPolicy or AttributeChangeTrackingPolicy, the class represented //by the descriptor must implement ChangeTracker interface. Otherwise throw an exception. Class javaClass = descriptor.getJavaClass(); if (!ChangeTracker.class.isAssignableFrom(javaClass)) { session.getIntegrityChecker().handleError(DescriptorException.needToImplementChangeTracker(descriptor)); } }
/** * INTERNAL: * Verify that the parameter type of the attribute's set method is correct for the indirection policy. If it is * incorrect, add an exception to the integrity checker. In this case, the parameter type must be a * public interface. */ public void validateSetMethodParameterType(Class parameterType, IntegrityChecker checker) throws DescriptorException { if (!isValidType(parameterType)) { checker.handleError(DescriptorException.invalidSetMethodParameterTypeForProxyIndirection(parameterType, targetInterfaces, getMapping())); } }
/** * INTERNAL: * Verify that attribute type is correct for the indirection policy. If it is incorrect, add an exception to the * integrity checker. In this case, the attribute type must be contained in targetInterfaces. */ public void validateDeclaredAttributeType(Class attributeType, IntegrityChecker checker) throws DescriptorException { if (!isValidType(attributeType)) { checker.handleError(DescriptorException.invalidAttributeTypeForProxyIndirection(attributeType, targetInterfaces, getMapping())); } }
/** * INTERNAL: * Allow for subclasses to perform validation. */ @Override public void validateBeforeInitialization(AbstractSession session) throws DescriptorException { if ((getFieldName() == null) || (getFieldName().length() == 0)) { session.getIntegrityChecker().handleError(DescriptorException.noFieldNameForMapping(this)); } }
/** * INTERNAL: * Verify that attribute type is correct for the indirection policy. If it is incorrect, add an exception to the * integrity checker. In this case, the attribute type must be contained in targetInterfaces. */ public void validateDeclaredAttributeType(Class attributeType, IntegrityChecker checker) throws DescriptorException { if (!isValidType(attributeType)) { checker.handleError(DescriptorException.invalidAttributeTypeForProxyIndirection(attributeType, targetInterfaces, getMapping())); } }
/** * INTERNAL: * Verify that attributeType is correct for the * indirection policy. If it is incorrect, add an exception to the * integrity checker. * In this case, the attribute type MUST be ValueHolderInterface. */ public void validateDeclaredAttributeType(Class attributeType, IntegrityChecker checker) throws DescriptorException { super.validateDeclaredAttributeType(attributeType, checker); if (!this.typeIsValid(attributeType)) { checker.handleError(DescriptorException.attributeAndMappingWithIndirectionMismatch(this.mapping)); } }
/** * INTERNAL: * Verify that attributeType is correct for the * indirection policy. If it is incorrect, add an exception to the * integrity checker. * In this case, the attribute type CANNOT be ValueHolderInterface. */ public void validateDeclaredAttributeType(Class attributeType, IntegrityChecker checker) throws DescriptorException { super.validateDeclaredAttributeType(attributeType, checker); if (!this.typeIsValid(attributeType)) { checker.handleError(DescriptorException.attributeAndMappingWithoutIndirectionMismatch(this.mapping)); } }
/** * INTERNAL: * Verify that getter returnType is correct for the * indirection policy. If it is incorrect, add an exception * to the integrity checker. * In this case, the return type CANNOT be ValueHolderInterface. */ public void validateGetMethodReturnType(Class returnType, IntegrityChecker checker) throws DescriptorException { super.validateGetMethodReturnType(returnType, checker); if (!this.typeIsValid(returnType)) { checker.handleError(DescriptorException.returnAndMappingWithoutIndirectionMismatch(this.mapping)); } }
/** * INTERNAL: * Verify that getter returnType is correct for the * indirection policy. If it is incorrect, add an exception * to the integrity checker. * In this case, the return type MUST be ValueHolderInterface. */ public void validateGetMethodReturnType(Class returnType, IntegrityChecker checker) throws DescriptorException { super.validateGetMethodReturnType(returnType, checker); if (!this.typeIsValid(returnType)) { checker.handleError(DescriptorException.returnAndMappingWithIndirectionMismatch(this.mapping)); } }
/** * INTERNAL: * Verify that attribute type is correct for the indirection policy. If it is incorrect, add an exception to the * integrity checker. In this case, the attribute type must be contained in targetInterfaces. */ public void validateDeclaredAttributeType(Class attributeType, IntegrityChecker checker) throws DescriptorException { if (!isValidType(attributeType)) { checker.handleError(DescriptorException.invalidAttributeTypeForProxyIndirection(attributeType, targetInterfaces, getMapping())); } }
/** * INTERNAL: * Verify that getter returnType is correct for the * indirection policy. If it is incorrect, add an exception * to the integrity checker. * In this case, the return type CANNOT be ValueHolderInterface. */ public void validateGetMethodReturnType(Class returnType, IntegrityChecker checker) throws DescriptorException { super.validateGetMethodReturnType(returnType, checker); if (!this.typeIsValid(returnType)) { checker.handleError(DescriptorException.returnAndMappingWithoutIndirectionMismatch(this.mapping)); } }
/** * INTERNAL: * Verify that setter parameterType is an appropriate collection type for the * indirection policy. If it is incorrect, add an exception to the integrity checker. * In this case, the type MUST be a Vector (or, in the case of jdk1.2, * Collection or Map). */ public void validateSetMethodParameterTypeForCollection(Class parameterType, IntegrityChecker checker) throws DescriptorException { super.validateSetMethodParameterTypeForCollection(parameterType, checker); if (!this.collectionTypeIsValid(parameterType)) { checker.handleError(DescriptorException.setMethodParameterTypeNotValid(getCollectionMapping())); } }
/** * INTERNAL: * Verify that getter returnType is an appropriate collection type for the * indirection policy. If it is incorrect, add an exception to the integrity checker. * In this case, the type MUST be a Vector (or, in the case of jdk1.2, * Collection or Map). */ public void validateGetMethodReturnTypeForCollection(Class returnType, IntegrityChecker checker) throws DescriptorException { super.validateGetMethodReturnTypeForCollection(returnType, checker); if (!this.collectionTypeIsValid(returnType)) { checker.handleError(DescriptorException.getMethodReturnTypeNotValid(getCollectionMapping())); } }
/** * INTERNAL: * Verify that attributeType is correct for the * indirection policy. If it is incorrect, add an exception to the * integrity checker. * In this case, the attribute type MUST be ValueHolderInterface. */ public void validateDeclaredAttributeType(Class attributeType, IntegrityChecker checker) throws DescriptorException { super.validateDeclaredAttributeType(attributeType, checker); if (!this.typeIsValid(attributeType)) { checker.handleError(DescriptorException.attributeAndMappingWithIndirectionMismatch(this.getMapping())); } }
/** * INTERNAL: * Verify that setter parameterType is correct for the * indirection policy. If it is incorrect, add an exception * to the integrity checker. * In this case, the parameter type MUST be ValueHolderInterface. */ public void validateSetMethodParameterType(Class parameterType, IntegrityChecker checker) throws DescriptorException { super.validateSetMethodParameterType(parameterType, checker); if (!this.typeIsValid(parameterType)) { checker.handleError(DescriptorException.parameterAndMappingWithIndirectionMismatch(this.getMapping())); } }
/** * Verify that an aggregate descriptor's inheritance tree * is full of aggregate descriptors, cont. */ private void checkInheritanceTreeAggregateSettingsForChildren(AbstractSession session, AggregateMapping mapping) throws DescriptorException { if (!this.isAggregateDescriptor()) { session.getIntegrityChecker().handleError(DescriptorException.referenceDescriptorIsNotAggregate(this.getJavaClass().getName(), mapping)); } for (ClassDescriptor childDescriptor : this.getInheritancePolicy().getChildDescriptors()) { // recurse down the inheritance tree to its leaves childDescriptor.checkInheritanceTreeAggregateSettingsForChildren(session, mapping); } }
/** * INTERNAL: * Allow for initialization of properties and validation. */ public void preInitialize(AbstractSession session) throws DescriptorException { try { getAttributeAccessor().initializeAttributes(getDescriptor().getJavaClass()); } catch (DescriptorException exception) { exception.setMapping(this); session.getIntegrityChecker().handleError(exception); } }
/** * INTERNAL: * Allow for initialization of properties and validation. */ public void preInitialize(AbstractSession session) throws DescriptorException { try { getAttributeAccessor().initializeAttributes(getDescriptor().getJavaClass()); } catch (DescriptorException exception) { exception.setMapping(this); session.getIntegrityChecker().handleError(exception); } }
/** * INTERNAL: * Allow for initialization of properties and validation. */ public void preInitialize(AbstractSession session) throws DescriptorException { try { getAttributeAccessor().initializeAttributes(getDescriptor().getJavaClass()); } catch (DescriptorException exception) { exception.setMapping(this); session.getIntegrityChecker().handleError(exception); } }