private void addFieldDescriptor()

in src/main/java/org/apache/jackrabbit/ocm/mapper/impl/annotation/AnnotationDescriptorReader.java [339:392]


	private void addFieldDescriptor(ClassDescriptor classDescriptor, String fieldName, Field fieldAnnotation)
	{

		FieldDescriptor fieldDescriptor = new FieldDescriptor();
		fieldDescriptor.setFieldName(fieldName);
		if ((fieldAnnotation.jcrName() != null) && (!fieldAnnotation.jcrName().equals("")))
		{
			fieldDescriptor.setJcrName(fieldAnnotation.jcrName());
		}
		else
		{
			fieldDescriptor.setJcrName(fieldName);
		}
		fieldDescriptor.setId(fieldAnnotation.id());
		fieldDescriptor.setPath(fieldAnnotation.path());
		fieldDescriptor.setUuid(fieldAnnotation.uuid());

		// It is not possible to set a null value into an annotation attribute.
		// If the converter == Object.class, it should be considered as null
		if (! fieldAnnotation.converter().equals(Object.class))
		{
		    fieldDescriptor.setConverter(fieldAnnotation.converter().getName());
		}

		// It is not possible to set a null value into an annotation attribute.
		// If the jcrDefaultValue value is an empty string => it should be considered as null
		if ((fieldAnnotation.jcrDefaultValue() != null) && (!fieldAnnotation.jcrDefaultValue().equals("")))
		{
		     fieldDescriptor.setJcrDefaultValue(fieldAnnotation.jcrDefaultValue());
		}

		// It is not possible to set a null value into an annotation attribute.
		// If the jcrValueConstraints value is an empty string => it should be considered as null
		if ((fieldAnnotation.jcrValueConstraints() != null) && (!fieldAnnotation.jcrValueConstraints().equals("")))
		{
		     fieldDescriptor.setJcrValueConstraints(fieldAnnotation.jcrValueConstraints());
		}

		// It is not possible to set a null value into an annotation attribute.
		// If the jcrProperty value is an empty string => it should be considered as null
		if ((fieldAnnotation.jcrType() != null) && (!fieldAnnotation.jcrType().equals("")))
		{
		    fieldDescriptor.setJcrType(fieldAnnotation.jcrType());
		}

		fieldDescriptor.setJcrAutoCreated(fieldAnnotation.jcrAutoCreated());
		fieldDescriptor.setJcrMandatory(fieldAnnotation.jcrMandatory());
		fieldDescriptor.setJcrOnParentVersion(fieldAnnotation.jcrOnParentVersion());
		fieldDescriptor.setJcrProtected(fieldAnnotation.jcrProtected());
		fieldDescriptor.setJcrMultiple(fieldAnnotation.jcrMultiple());

		//fieldDescriptor.setJcrType(value)
		classDescriptor.addFieldDescriptor(fieldDescriptor);
	}