final FacetedMethod holder = processMethodContext.getFacetHolder();
BigDecimalValueFacet existingFacet = (BigDecimalValueFacet) holder.getFacet(BigDecimalValueFacet.class);
final Column jdoColumnAnnotation = Annotations.getAnnotation(processMethodContext.getMethod(), Column.class);
if (jdoColumnAnnotation == null) {
if(existingFacet != null && !existingFacet.isNoop()) {
// do nothing
} else {
final BigDecimalValueFacet facet = new BigDecimalFacetFallback(holder);
FacetUtil.addFacet(facet);
}
} else {
// obtain the existing facet's length and scale, to use as defaults if none are specified on the @Column
// this will mean a metamodel validation exception will only be fired later (see #refineMetaModelValidator)
// if there was an *explicit* value defined on the @Column annotation that is incompatible with existing.
Integer existingLength = null;
Integer existingScale = null;
if(existingFacet != null && !existingFacet.isNoop()) {
existingLength = existingFacet.getLength();
existingScale = existingFacet.getScale();
}
Integer length = valueElseDefaults(jdoColumnAnnotation.length(), existingLength, DEFAULT_LENGTH);
Integer scale = valueElseDefaults(jdoColumnAnnotation.scale(), existingScale, DEFAULT_SCALE);
final BigDecimalValueFacet facet = new BigDecimalFacetDerivedFromJdoColumn(holder, length, scale);
FacetUtil.addFacet(facet);
}
}