Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  package com.fasterxml.jackson.databind.util;
  
Simple immutable com.fasterxml.jackson.databind.introspect.BeanPropertyDefinition implementation that can be wrapped around a com.fasterxml.jackson.databind.introspect.AnnotatedMember that is a simple accessor (getter) or mutator (setter, constructor parameter) (or both, for fields).
 
     extends BeanPropertyDefinition
 {
    
Member that defines logical property. Assumption is that it should be a 'simple' accessor; meaning a zero-argument getter, single-argument setter or constructor parameter.
 
     protected final AnnotatedMember _member;
 
     protected final String _name;
     
     /*
     /**********************************************************
     /* Construction
     /**********************************************************
      */
     
     public SimpleBeanPropertyDefinition(AnnotatedMember member) {
         this(membermember.getName());
     }
 
     public SimpleBeanPropertyDefinition(AnnotatedMember memberString name) {
          = member;
          = name;
     }
 
     /*
     /**********************************************************
     /* Fluent factories
     /**********************************************************
      */
 
     @Override
     public SimpleBeanPropertyDefinition withName(String newName) {
         if (.equals(newName)) {
             return this;
         }
         return new SimpleBeanPropertyDefinition(newName);
     }
     
     /*
     /**********************************************************
     /* Basic property information, name, type
     /**********************************************************
      */
 
     @Override
     public String getName() { return ; }
 
     @Override
     public String getInternalName() { return getName(); }
 
     // hmmh. what should we claim here?
     @Override
     public boolean isExplicitlyIncluded() { return false; }
     
     /*
     /**********************************************************
     /* Access to accessors (fields, methods etc)
     /**********************************************************
      */
 
     @Override
     public boolean hasGetter() {
         return (getGetter() != null);
     }
 
     @Override
     public boolean hasSetter() {
         return (getSetter() != null);
     }
 
     @Override
     public boolean hasField() {
         return ( instanceof AnnotatedField);
     }
 
     @Override
     public boolean hasConstructorParameter() {
         return ( instanceof AnnotatedParameter);
     }
     
     @Override
     public AnnotatedMethod getGetter() {
        if (( instanceof AnnotatedMethod)
                && ((AnnotatedMethod).getParameterCount() == 0) {
            return (AnnotatedMethod;
        }
        return null;
    }
        
    @Override
    public AnnotatedMethod getSetter() {
        if (( instanceof AnnotatedMethod)
                && ((AnnotatedMethod).getParameterCount() == 1) {
            return (AnnotatedMethod;
        }
        return null;
    }
    @Override
    public AnnotatedField getField() {
        return ( instanceof AnnotatedField) ?
                (AnnotatedField : null;
    }
    @Override
        return ( instanceof AnnotatedParameter) ?
                (AnnotatedParameter : null;
    }

    
Method used to find accessor (getter, field to access) to use for accessing value of the property. Null if no such member exists.
    @Override
    public AnnotatedMember getAccessor() {
        AnnotatedMember acc = getGetter();
        if (acc == null) {
            acc = getField();
        }
        return acc;
    }

    
Method used to find mutator (constructor parameter, setter, field) to use for changing value of the property. Null if no such member exists.
    @Override
    public AnnotatedMember getMutator() {
        AnnotatedMember acc = getConstructorParameter();
        if (acc == null) {
            acc = getSetter();
            if (acc == null) {
                acc = getField();
            }
        }
        return acc;
    }
    @Override
    public AnnotatedMember getPrimaryMember() {
        return ;
    }
New to GrepCode? Check out our FAQ X