Java 类com.fasterxml.jackson.databind.util.BeanUtil 实例源码

项目:jackson-lombok    文件:JacksonLombokAnnotationIntrospector.java   
@Override
public String findImplicitPropertyName(AnnotatedMember member) {
    JsonProperty property = member.getAnnotation(JsonProperty.class);
    if (property == null) {
        if (member instanceof AnnotatedMethod) {
            AnnotatedMethod method = (AnnotatedMethod) member;
            String fieldName = BeanUtil.okNameForGetter(method);
            return getJacksonPropertyName(member.getDeclaringClass(), fieldName);
        }
    } else if (!property.value().equals("")) {
        return property.value();
    }

    return null;
}
项目:joyplus-tv    文件:POJOPropertiesCollector.java   
protected void _addSetterMethod(AnnotatedMethod m, AnnotationIntrospector ai)
{
    String implName; // from naming convention
    boolean visible;
    PropertyName pn = (ai == null) ? null : ai.findNameForDeserialization(m);
    String explName = (pn == null) ? null : pn.getSimpleName();
    if (explName == null) { // no explicit name; must follow naming convention
        implName = BeanUtil.okNameForMutator(m, _mutatorPrefix);
        if (implName == null) { // if not, must skip
            return;
        }
        visible = _visibilityChecker.isSetterVisible(m);
    } else { // explicit indication of inclusion, but may be empty
        // we still need implicit name to link with other pieces
        implName = BeanUtil.okNameForMutator(m, _mutatorPrefix);
        // if not regular getter name, use method name as is
        if (implName == null) {
            implName = m.getName();
        }
        if (explName.length() == 0) { 
            explName = implName;
        }
        visible = true;
    }
    boolean ignore = (ai == null) ? false : ai.hasIgnoreMarker(m);
    _property(implName).addSetter(m, explName, visible, ignore);
}
项目:QuizUpWinner    文件:POJOPropertiesCollector.java   
protected void _addGetterMethod(AnnotatedMethod paramAnnotatedMethod, AnnotationIntrospector paramAnnotationIntrospector)
{
  if (paramAnnotationIntrospector != null)
  {
    if (paramAnnotationIntrospector.hasAnyGetterAnnotation(paramAnnotatedMethod))
    {
      if (this._anyGetters == null)
        this._anyGetters = new LinkedList();
      this._anyGetters.add(paramAnnotatedMethod);
      return;
    }
    if (paramAnnotationIntrospector.hasAsValueAnnotation(paramAnnotatedMethod))
    {
      if (this._jsonValueGetters == null)
        this._jsonValueGetters = new LinkedList();
      this._jsonValueGetters.add(paramAnnotatedMethod);
      return;
    }
  }
  PropertyName localPropertyName1;
  if (paramAnnotationIntrospector == null)
    localPropertyName1 = null;
  else
    localPropertyName1 = paramAnnotationIntrospector.findNameForSerialization(paramAnnotatedMethod);
  PropertyName localPropertyName2 = localPropertyName1;
  String str1;
  if (localPropertyName1 == null)
    str1 = null;
  else
    str1 = localPropertyName2.getSimpleName();
  Object localObject1 = str1;
  Object localObject2;
  boolean bool1;
  if (str1 == null)
  {
    String str3 = BeanUtil.okNameForRegularGetter(paramAnnotatedMethod, paramAnnotatedMethod.getName());
    localObject2 = str3;
    if (str3 == null)
    {
      String str4 = BeanUtil.okNameForIsGetter(paramAnnotatedMethod, paramAnnotatedMethod.getName());
      localObject2 = str4;
      if (str4 == null)
        return;
      bool1 = this._visibilityChecker.isIsGetterVisible(paramAnnotatedMethod);
    }
    else
    {
      bool1 = this._visibilityChecker.isGetterVisible(paramAnnotatedMethod);
    }
  }
  else
  {
    String str2 = BeanUtil.okNameForGetter(paramAnnotatedMethod);
    localObject2 = str2;
    if (str2 == null)
      localObject2 = paramAnnotatedMethod.getName();
    if (((String)localObject1).length() == 0)
      localObject1 = localObject2;
    bool1 = true;
  }
  boolean bool2;
  if (paramAnnotationIntrospector == null)
    bool2 = false;
  else
    bool2 = paramAnnotationIntrospector.hasIgnoreMarker(paramAnnotatedMethod);
  _property((String)localObject2).addGetter(paramAnnotatedMethod, (String)localObject1, bool1, bool2);
}
项目:QuizUpWinner    文件:POJOPropertiesCollector.java   
protected void _addSetterMethod(AnnotatedMethod paramAnnotatedMethod, AnnotationIntrospector paramAnnotationIntrospector)
{
  PropertyName localPropertyName1;
  if (paramAnnotationIntrospector == null)
    localPropertyName1 = null;
  else
    localPropertyName1 = paramAnnotationIntrospector.findNameForDeserialization(paramAnnotatedMethod);
  PropertyName localPropertyName2 = localPropertyName1;
  String str1;
  if (localPropertyName1 == null)
    str1 = null;
  else
    str1 = localPropertyName2.getSimpleName();
  Object localObject1 = str1;
  Object localObject2;
  boolean bool1;
  if (str1 == null)
  {
    String str3 = BeanUtil.okNameForMutator(paramAnnotatedMethod, this._mutatorPrefix);
    localObject2 = str3;
    if (str3 == null)
      return;
    bool1 = this._visibilityChecker.isSetterVisible(paramAnnotatedMethod);
  }
  else
  {
    String str2 = BeanUtil.okNameForMutator(paramAnnotatedMethod, this._mutatorPrefix);
    localObject2 = str2;
    if (str2 == null)
      localObject2 = paramAnnotatedMethod.getName();
    if (((String)localObject1).length() == 0)
      localObject1 = localObject2;
    bool1 = true;
  }
  boolean bool2;
  if (paramAnnotationIntrospector == null)
    bool2 = false;
  else
    bool2 = paramAnnotationIntrospector.hasIgnoreMarker(paramAnnotatedMethod);
  _property((String)localObject2).addSetter(paramAnnotatedMethod, (String)localObject1, bool1, bool2);
}
项目:joyplus-tv    文件:POJOPropertiesCollector.java   
protected void _addGetterMethod(AnnotatedMethod m, AnnotationIntrospector ai)
{
    // any getter?
    if (ai != null) {
        if (ai.hasAnyGetterAnnotation(m)) {
            if (_anyGetters == null) {
                _anyGetters = new LinkedList<AnnotatedMember>();
            }
            _anyGetters.add(m);
            return;
        }
        // @JsonValue?
        if (ai.hasAsValueAnnotation(m)) {
            if (_jsonValueGetters == null) {
                _jsonValueGetters = new LinkedList<AnnotatedMethod>();
            }
            _jsonValueGetters.add(m);
            return;
        }
    }
    String implName; // from naming convention
    boolean visible;

    PropertyName pn = (ai == null) ? null : ai.findNameForSerialization(m);
    String explName = (pn == null) ? null : pn.getSimpleName();
    if (explName == null) { // no explicit name; must follow naming convention
        implName = BeanUtil.okNameForRegularGetter(m, m.getName());
        if (implName == null) { // if not, must skip
            implName = BeanUtil.okNameForIsGetter(m, m.getName());
            if (implName == null) {
                return;
            }
            visible = _visibilityChecker.isIsGetterVisible(m);
        } else {
            visible = _visibilityChecker.isGetterVisible(m);
        }
    } else { // explicit indication of inclusion, but may be empty
        // we still need implicit name to link with other pieces
        implName = BeanUtil.okNameForGetter(m);
        // if not regular getter name, use method name as is
        if (implName == null) {
            implName = m.getName();
        }
        if (explName.length() == 0) {
            explName = implName;
        }
        visible = true;
    }
    boolean ignore = (ai == null) ? false : ai.hasIgnoreMarker(m);
    _property(implName).addGetter(m, explName, visible, ignore);
}