Package javax.jdo.annotations

Examples of javax.jdo.annotations.Column


    }

    @Override
    public void process(final ProcessMethodContext processMethodContext) {

        final Column annotation = Annotations.getAnnotation(processMethodContext.getMethod(), Column.class);

        if(String.class != processMethodContext.getMethod().getReturnType()) {
            return;
        }

        if (annotation == null || annotation.length() == -1) {
            return;
        }
       
        final FacetedMethod holder = processMethodContext.getFacetHolder();
       
        MaxLengthFacet existingFacet = holder.getFacet(MaxLengthFacet.class);
       
        final MaxLengthFacet facet = new MaxLengthFacetDerivedFromJdoColumn(annotation.length(), holder);
       
        if(!existingFacet.isNoop()) {
            // will raise violation later
            facet.setUnderlyingFacet(existingFacet);
        }
View Full Code Here


       
        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);
        }
    }
View Full Code Here

        super(FeatureType.PROPERTIES_ONLY);
    }

    @Override
    public void process(final ProcessMethodContext processMethodContext) {
        final Column annotation = Annotations.getAnnotation(processMethodContext.getMethod(), Column.class);

        final FacetedMethod holder = processMethodContext.getFacetHolder();
       
        final MandatoryFacet existingFacet = holder.getFacet(MandatoryFacet.class);
        if(existingFacet != null) {
View Full Code Here

    }

    @Override
    public void process(final ProcessMethodContext processMethodContext) {

        final Column annotation = Annotations.getAnnotation(processMethodContext.getMethod(), Column.class);

        if(BigDecimal.class != processMethodContext.getMethod().getReturnType()) {
            return;
        }
        final BigDecimalValueFacet facet;
        final FacetedMethod holder = processMethodContext.getFacetHolder();
       
        if (annotation == null) {
            facet = new BigDecimalFacetFallback(holder);
        } else {
            facet = new BigDecimalFacetDerivedFromJdoColumn(holder, valueElseDefault(annotation.length(), DEFAULT_LENGTH), valueElseDefault(annotation.scale(), DEFAULT_SCALE));
        }
        FacetUtil.addFacet(facet);
    }
View Full Code Here

        super(FeatureType.PROPERTIES_ONLY);
    }

    @Override
    public void process(final ProcessMethodContext processMethodContext) {
        final Column annotation = Annotations.getAnnotation(processMethodContext.getMethod(), Column.class);

        final FacetedMethod holder = processMethodContext.getFacetHolder();
       
        final MandatoryFacet existingFacet = holder.getFacet(MandatoryFacet.class);
        if(existingFacet != null) {
View Full Code Here

       
        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);
        }
    }
View Full Code Here

    }

    @Override
    public void process(final ProcessMethodContext processMethodContext) {

        final Column annotation = Annotations.getAnnotation(processMethodContext.getMethod(), Column.class);

        if(String.class != processMethodContext.getMethod().getReturnType()) {
            return;
        }

        if (annotation == null || annotation.length() == -1) {
            return;
        }
       
        final FacetedMethod holder = processMethodContext.getFacetHolder();
       
        MaxLengthFacet existingFacet = holder.getFacet(MaxLengthFacet.class);
       
        final MaxLengthFacet facet = new MaxLengthFacetDerivedFromJdoColumn(annotation.length(), holder);
       
        if(!existingFacet.isNoop()) {
            // will raise violation later
            facet.setUnderlyingFacet(existingFacet);
        }
View Full Code Here

TOP

Related Classes of javax.jdo.annotations.Column

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.