com.google.gson.annotations.Since Java Examples

The following examples show how to use com.google.gson.annotations.Since. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source Project: letv   Author: JackChan1999   File: Excluder.java    License: Apache License 2.0 6 votes vote down vote up
public boolean excludeClass(Class<?> clazz, boolean serialize) {
    if (this.version != IGNORE_VERSIONS && !isValidVersion((Since) clazz.getAnnotation(Since.class), (Until) clazz.getAnnotation(Until.class))) {
        return true;
    }
    if (!this.serializeInnerClasses && isInnerClass(clazz)) {
        return true;
    }
    if (isAnonymousOrLocal(clazz)) {
        return true;
    }
    for (ExclusionStrategy exclusionStrategy : serialize ? this.serializationStrategies : this.deserializationStrategies) {
        if (exclusionStrategy.shouldSkipClass(clazz)) {
            return true;
        }
    }
    return false;
}
 
Example #2
Source Project: framework   Author: Odoo-mobile   File: Excluder.java    License: GNU Affero General Public License v3.0 6 votes vote down vote up
public boolean excludeClass(Class<?> clazz, boolean serialize) {
  if (version != Excluder.IGNORE_VERSIONS
      && !isValidVersion(clazz.getAnnotation(Since.class), clazz.getAnnotation(Until.class))) {
    return true;
  }

  if (!serializeInnerClasses && isInnerClass(clazz)) {
    return true;
  }

  if (isAnonymousOrLocal(clazz)) {
    return true;
  }

  List<ExclusionStrategy> list = serialize ? serializationStrategies : deserializationStrategies;
  for (ExclusionStrategy exclusionStrategy : list) {
    if (exclusionStrategy.shouldSkipClass(clazz)) {
      return true;
    }
  }

  return false;
}
 
Example #3
Source Project: letv   Author: JackChan1999   File: Excluder.java    License: Apache License 2.0 5 votes vote down vote up
public boolean excludeField(Field field, boolean serialize) {
    if ((this.modifiers & field.getModifiers()) != 0) {
        return true;
    }
    if (this.version != IGNORE_VERSIONS && !isValidVersion((Since) field.getAnnotation(Since.class), (Until) field.getAnnotation(Until.class))) {
        return true;
    }
    if (field.isSynthetic()) {
        return true;
    }
    if (this.requireExpose) {
        Expose annotation = (Expose) field.getAnnotation(Expose.class);
        if (annotation == null || (serialize ? !annotation.serialize() : !annotation.deserialize())) {
            return true;
        }
    }
    if (!this.serializeInnerClasses && isInnerClass(field.getType())) {
        return true;
    }
    if (isAnonymousOrLocal(field.getType())) {
        return true;
    }
    List<ExclusionStrategy> list = serialize ? this.serializationStrategies : this.deserializationStrategies;
    if (!list.isEmpty()) {
        FieldAttributes fieldAttributes = new FieldAttributes(field);
        for (ExclusionStrategy exclusionStrategy : list) {
            if (exclusionStrategy.shouldSkipField(fieldAttributes)) {
                return true;
            }
        }
    }
    return false;
}
 
Example #4
Source Project: MiBandDecompiled   Author: vishnudevk   File: Excluder.java    License: Apache License 2.0 5 votes vote down vote up
public boolean excludeClass(Class class1, boolean flag)
{
    if (b != -1D && !a((Since)class1.getAnnotation(com/google/gson/annotations/Since), (Until)class1.getAnnotation(com/google/gson/annotations/Until)))
    {
        return true;
    }
    if (!d && b(class1))
    {
        return true;
    }
    if (a(class1))
    {
        return true;
    }
    List list;
    Iterator iterator;
    if (flag)
    {
        list = f;
    } else
    {
        list = g;
    }
    for (iterator = list.iterator(); iterator.hasNext();)
    {
        if (((ExclusionStrategy)iterator.next()).shouldSkipClass(class1))
        {
            return true;
        }
    }

    return false;
}
 
Example #5
Source Project: gson   Author: google   File: Excluder.java    License: Apache License 2.0 5 votes vote down vote up
private boolean excludeClassChecks(Class<?> clazz) {
    if (version != Excluder.IGNORE_VERSIONS && !isValidVersion(clazz.getAnnotation(Since.class), clazz.getAnnotation(Until.class))) {
        return true;
    }

    if (!serializeInnerClasses && isInnerClass(clazz)) {
        return true;
    }

    if (isAnonymousOrLocal(clazz)) {
        return true;
    }

    return false;
}
 
Example #6
Source Project: gson   Author: google   File: Excluder.java    License: Apache License 2.0 5 votes vote down vote up
private boolean isValidSince(Since annotation) {
  if (annotation != null) {
    double annotationVersion = annotation.value();
    if (annotationVersion > version) {
      return false;
    }
  }
  return true;
}
 
Example #7
Source Project: framework   Author: Odoo-mobile   File: Excluder.java    License: GNU Affero General Public License v3.0 5 votes vote down vote up
private boolean isValidSince(Since annotation) {
  if (annotation != null) {
    double annotationVersion = annotation.value();
    if (annotationVersion > version) {
      return false;
    }
  }
  return true;
}
 
Example #8
Source Project: letv   Author: JackChan1999   File: Excluder.java    License: Apache License 2.0 4 votes vote down vote up
private boolean isValidVersion(Since since, Until until) {
    return isValidSince(since) && isValidUntil(until);
}
 
Example #9
Source Project: letv   Author: JackChan1999   File: Excluder.java    License: Apache License 2.0 4 votes vote down vote up
private boolean isValidSince(Since annotation) {
    if (annotation == null || annotation.value() <= this.version) {
        return true;
    }
    return false;
}
 
Example #10
Source Project: MiBandDecompiled   Author: vishnudevk   File: Excluder.java    License: Apache License 2.0 4 votes vote down vote up
private boolean a(Since since)
{
    return since == null || since.value() <= b;
}
 
Example #11
Source Project: MiBandDecompiled   Author: vishnudevk   File: Excluder.java    License: Apache License 2.0 4 votes vote down vote up
private boolean a(Since since, Until until)
{
    return a(since) && a(until);
}
 
Example #12
Source Project: gson   Author: google   File: Excluder.java    License: Apache License 2.0 4 votes vote down vote up
public boolean excludeField(Field field, boolean serialize) {
  if ((modifiers & field.getModifiers()) != 0) {
    return true;
  }

  if (version != Excluder.IGNORE_VERSIONS
      && !isValidVersion(field.getAnnotation(Since.class), field.getAnnotation(Until.class))) {
    return true;
  }

  if (field.isSynthetic()) {
    return true;
  }

  if (requireExpose) {
    Expose annotation = field.getAnnotation(Expose.class);
    if (annotation == null || (serialize ? !annotation.serialize() : !annotation.deserialize())) {
      return true;
    }
  }

  if (!serializeInnerClasses && isInnerClass(field.getType())) {
    return true;
  }

  if (isAnonymousOrLocal(field.getType())) {
    return true;
  }

  List<ExclusionStrategy> list = serialize ? serializationStrategies : deserializationStrategies;
  if (!list.isEmpty()) {
    FieldAttributes fieldAttributes = new FieldAttributes(field);
    for (ExclusionStrategy exclusionStrategy : list) {
      if (exclusionStrategy.shouldSkipField(fieldAttributes)) {
        return true;
      }
    }
  }

  return false;
}
 
Example #13
Source Project: gson   Author: google   File: Excluder.java    License: Apache License 2.0 4 votes vote down vote up
private boolean isValidVersion(Since since, Until until) {
  return isValidSince(since) && isValidUntil(until);
}
 
Example #14
Source Project: framework   Author: Odoo-mobile   File: Excluder.java    License: GNU Affero General Public License v3.0 4 votes vote down vote up
public boolean excludeField(Field field, boolean serialize) {
  if ((modifiers & field.getModifiers()) != 0) {
    return true;
  }

  if (version != Excluder.IGNORE_VERSIONS
      && !isValidVersion(field.getAnnotation(Since.class), field.getAnnotation(Until.class))) {
    return true;
  }

  if (field.isSynthetic()) {
    return true;
  }

  if (requireExpose) {
    Expose annotation = field.getAnnotation(Expose.class);
    if (annotation == null || (serialize ? !annotation.serialize() : !annotation.deserialize())) {
      return true;
    }
  }

  if (!serializeInnerClasses && isInnerClass(field.getType())) {
    return true;
  }

  if (isAnonymousOrLocal(field.getType())) {
    return true;
  }

  List<ExclusionStrategy> list = serialize ? serializationStrategies : deserializationStrategies;
  if (!list.isEmpty()) {
    FieldAttributes fieldAttributes = new FieldAttributes(field);
    for (ExclusionStrategy exclusionStrategy : list) {
      if (exclusionStrategy.shouldSkipField(fieldAttributes)) {
        return true;
      }
    }
  }

  return false;
}
 
Example #15
Source Project: framework   Author: Odoo-mobile   File: Excluder.java    License: GNU Affero General Public License v3.0 4 votes vote down vote up
private boolean isValidVersion(Since since, Until until) {
  return isValidSince(since) && isValidUntil(until);
}