Example usage for com.google.gson FieldAttributes getAnnotation

List of usage examples for com.google.gson FieldAttributes getAnnotation

Introduction

In this page you can find the example usage for com.google.gson FieldAttributes getAnnotation.

Prototype

public <T extends Annotation> T getAnnotation(Class<T> annotation) 

Source Link

Document

Return the T annotation object from this field if it exist; otherwise returns null .

Usage

From source file:com.google.caliper.json.AnnotationExclusionStrategy.java

License:Apache License

@Override
public boolean shouldSkipField(FieldAttributes f) {
    return f.getAnnotation(ExcludeFromJson.class) != null;
}

From source file:com.itametis.jsonconverter.ignorestrategy.ReadIgnoreStrategy.java

License:Open Source License

@Override
public boolean shouldSkipField(FieldAttributes f) {
    JsonField annotation = f.getAnnotation(JsonField.class);
    return annotation == null || annotation.useType() == JsonField.UseType.WRITE;
}

From source file:com.itametis.jsonconverter.ignorestrategy.WriteIgnoreStrategy.java

License:Open Source License

@Override
public boolean shouldSkipField(FieldAttributes f) {
    JsonField annotation = f.getAnnotation(JsonField.class);
    return annotation == null || annotation.useType() == JsonField.UseType.READ;
}

From source file:com.jinais.gnlib.android.state.GNStateGsonExclusionStrategy.java

License:Apache License

public boolean shouldSkipField(FieldAttributes f) {
    return f.getAnnotation(GNState.class) == null;
}

From source file:com.katsu.gson.exclusionstrategy.MvcExclusionStrategy.java

License:Open Source License

@Override
public boolean shouldSkipField(FieldAttributes fa) {
    boolean result = fa.getAnnotation(JsonIgnore.class) != null;
    //System.out.println(fa.getDeclaringClass()+" "+fa.getDeclaredType()+" "+fa.getName()+"-->"+result);
    return result;
}

From source file:com.linuxrouter.netcool.json.EntitySerializationExclusitionStrategy.java

@Override
public boolean shouldSkipField(FieldAttributes fa) {

    Expose expose = fa.getAnnotation(Expose.class);
    HideFromJson hide = fa.getAnnotation(HideFromJson.class);

    if (hide != null) {

        return true;
    }//from   www  . ja  va2  s .  co  m

    if (expose != null) {
        //  logger.debug("Skiping " + fa.getName() + " ::" + expose.serialize());
        return !expose.serialize();
    } else {
        return false;
    }
}

From source file:com.nimbits.server.gson.NimbitsExclusionStrategy.java

License:Apache License

public boolean shouldSkipField(FieldAttributes f) {
    return f.getAnnotation(DoNotSerializePolicy.class) != null;
}

From source file:com.postmark.java.SkipMeExclusionStrategy.java

License:Open Source License

public boolean shouldSkipField(FieldAttributes f) {
    return f.getAnnotation(SkipMe.class) != null;
}

From source file:com.solace.support.json.DefaultJsonExclusionStrategy.java

License:Open Source License

public boolean shouldSkipField(FieldAttributes f) {
    return f.getAnnotation(JsonIgnore.class) != null;
}

From source file:com.stoneapp.ourvlemoodle2.util.GsonExclude.java

License:Open Source License

@Override
public boolean shouldSkipField(FieldAttributes field) {
    SerializedName sname = field.getAnnotation(SerializedName.class);
    if (sname != null)
        return false;

    return true;//from   w ww  .  ja v a2 s  .  com
}