congrats Icon
New! Announcing Tabnine Chat Beta
Learn More
Tabnine Logo
GsonBuilder.excludeFieldsWithoutExposeAnnotation
Code IndexAdd Tabnine to your IDE (free)

How to use
excludeFieldsWithoutExposeAnnotation
method
in
com.google.gson.GsonBuilder

Best Java code snippets using com.google.gson.GsonBuilder.excludeFieldsWithoutExposeAnnotation (Showing top 20 results out of 504)

origin: gocd/gocd

  public static <T> T safeFromJson(final String jsonString, final Class<T> clazz) {
    GsonBuilder builder = new GsonBuilder();
    Gson gson = builder.excludeFieldsWithoutExposeAnnotation().create();
    try {
      return gson.fromJson(jsonString, clazz);
    } catch (Exception e) {
      return null;
    }
  }
}
origin: gocd/gocd

public static String toJsonString(Object object) {
  Gson gson = new GsonBuilder().excludeFieldsWithoutExposeAnnotation().create();
  return gson.toJson(object);
}
origin: gocd/gocd

private static String toJsonString(Object object) {
  Gson gson = new GsonBuilder().excludeFieldsWithoutExposeAnnotation().create();
  return gson.toJson(object);
}
origin: gocd/gocd

private static String toJsonString(Object object) {
  Gson gson = new GsonBuilder().excludeFieldsWithoutExposeAnnotation().create();
  return gson.toJson(object);
}
origin: gocd/gocd

@Autowired
public FeatureToggleRepository(SystemEnvironment environment) {
  this.environment = environment;
  gson = new GsonBuilder().setPrettyPrinting().excludeFieldsWithoutExposeAnnotation().create();
}
origin: gocd/gocd

public static <T> T fromJson(final String jsonString, final Class<T> clazz) {
  return new GsonBuilder().excludeFieldsWithoutExposeAnnotation().create().fromJson(jsonString, clazz);
}
origin: gocd/gocd

  public String createRequest() {
    Gson gson = new GsonBuilder().excludeFieldsWithoutExposeAnnotation().serializeNulls().create();
    return gson.toJson(this.transformData());
  }
}
origin: stackoverflow.com

 static {
  GsonBuilder builder = new GsonBuilder();

  ...

  builder.excludeFieldsWithModifiers(Modifier.FINAL, Modifier.TRANSIENT, Modifier.STATIC);**
  builder.excludeFieldsWithoutExposeAnnotation();
  sExposeGson = builder.create();
}
origin: bwssytems/ha-bridge

public DeviceRepository(String deviceDb) {
  super();
  gson =
      new GsonBuilder()
      .excludeFieldsWithoutExposeAnnotation()
      .create();
  repositoryPath = null;
  repositoryPath = Paths.get(deviceDb);
  setupParams(repositoryPath, ".bk", "device.db-");
  nextId = 0;
  _loadRepository(repositoryPath);
}

origin: bwssytems/ha-bridge

public GroupRepository(String groupDb) {
  super();
  gson =
      new GsonBuilder()
      .excludeFieldsWithoutExposeAnnotation()
      .create();
  nextId = 0;
  try {
    repositoryPath = null;
    repositoryPath = Paths.get(groupDb);
    setupParams(repositoryPath, ".bk", "group.db-");
    _loadRepository(repositoryPath);
  } catch (Exception ex) {
    groups = new HashMap<String, GroupDescriptor>();
  }
}

origin: MindorksOpenSource/android-mvp-architecture

@Override
public Observable<Boolean> seedDatabaseOptions() {
  GsonBuilder builder = new GsonBuilder().excludeFieldsWithoutExposeAnnotation();
  final Gson gson = builder.create();
  return mDbHelper.isOptionEmpty()
      .concatMap(new Function<Boolean, ObservableSource<? extends Boolean>>() {
        @Override
        public ObservableSource<? extends Boolean> apply(Boolean isEmpty)
            throws Exception {
          if (isEmpty) {
            Type type = new TypeToken<List<Option>>() {
            }
                .getType();
            List<Option> optionList = gson.fromJson(
                CommonUtils.loadJSONFromAsset(mContext,
                    AppConstants.SEED_DATABASE_OPTIONS),
                type);
            return saveOptionList(optionList);
          }
          return Observable.just(false);
        }
      });
}
origin: MindorksOpenSource/android-mvp-architecture

@Override
public Observable<Boolean> seedDatabaseQuestions() {
  GsonBuilder builder = new GsonBuilder().excludeFieldsWithoutExposeAnnotation();
  final Gson gson = builder.create();
  return mDbHelper.isQuestionEmpty()
      .concatMap(new Function<Boolean, ObservableSource<? extends Boolean>>() {
        @Override
        public ObservableSource<? extends Boolean> apply(Boolean isEmpty)
            throws Exception {
          if (isEmpty) {
            Type type = $Gson$Types
                .newParameterizedTypeWithOwner(null, List.class,
                    Question.class);
            List<Question> questionList = gson.fromJson(
                CommonUtils.loadJSONFromAsset(mContext,
                    AppConstants.SEED_DATABASE_QUESTIONS),
                type);
            return saveQuestionList(questionList);
          }
          return Observable.just(false);
        }
      });
}
origin: MindorksOpenSource/android-mvp-architecture

final GsonBuilder builder = new GsonBuilder().excludeFieldsWithoutExposeAnnotation();
final Gson gson = builder.create();
origin: magefree/mage

public String toJson() {
  Gson gson = new GsonBuilder()
      .excludeFieldsWithoutExposeAnnotation()
      .create();
  return gson.toJson(this);
}
origin: NightscoutFoundation/xDrip

public String toS() {
  final Gson gson = new GsonBuilder()
      .excludeFieldsWithoutExposeAnnotation()
      .create();
  return gson.toJson(this);
}
origin: AppLozic/Applozic-Android-SDK

public static String getJsonWithExposeFromObject(Object object, Type type) {
  Gson gson = new GsonBuilder()
      .excludeFieldsWithoutExposeAnnotation()
      .create();
  return gson.toJson(object, type);
}
origin: NightscoutFoundation/xDrip

public String toS() {
  Gson gson = new GsonBuilder()
      .excludeFieldsWithoutExposeAnnotation()
      .registerTypeAdapter(Date.class, new DateTypeAdapter())
      .serializeSpecialFloatingPointValues()
      .create();
  return gson.toJson(this);
}
origin: NightscoutFoundation/xDrip

public static Treatments fromJSON(String json) {
  try {
    return new GsonBuilder().excludeFieldsWithoutExposeAnnotation().create().fromJson(json, Treatments.class);
  } catch (Exception e) {
    Log.d(TAG, "Got exception parsing treatment json: " + e.toString());
    Home.toaststatic("Error on treatment, probably decryption key mismatch");
    return null;
  }
}
origin: NightscoutFoundation/xDrip

public static RollCall fromJson(String json) {
  final Gson gson = new GsonBuilder()
      .excludeFieldsWithoutExposeAnnotation()
      .create();
  try {
    return gson.fromJson(json, RollCall.class);
  } catch (Exception e) {
    UserError.Log.e(TAG, "Got exception processing fromJson() " + e);
    UserError.Log.e(TAG, "json = "  + json);
    return null;
  }   
}
origin: org.apache.tajo/tajo-algebra

private void initBuilder() {
 builder = new GsonBuilder().setPrettyPrinting().
   excludeFieldsWithoutExposeAnnotation();
 builder.registerTypeAdapter(OpType.class, new OpType.JsonSerDer());
 builder.registerTypeAdapter(Expr.class, new Expr.JsonSerDer());
 builder.registerTypeAdapter(PartitionMethodDescExpr.class, new PartitionMethodDescExpr.JsonSerDer());
}
com.google.gsonGsonBuilderexcludeFieldsWithoutExposeAnnotation

Javadoc

Configures Gson to exclude all fields from consideration for serialization or deserialization that do not have the com.google.gson.annotations.Expose annotation.

Popular methods of GsonBuilder

  • create
    Creates a Gson instance based on the current configuration. This method is free of side-effects to t
  • <init>
    Creates a GsonBuilder instance that can be used to build Gson with various configuration settings. G
  • registerTypeAdapter
    Configures Gson for custom serialization or deserialization. This method combines the registration o
  • setPrettyPrinting
    Configures Gson to output Json that fits in a page for pretty printing. This option only affects Jso
  • serializeNulls
    Configure Gson to serialize null fields. By default, Gson omits all fields that are null during seri
  • disableHtmlEscaping
    By default, Gson escapes HTML characters such as < > etc. Use this option to configure Gson to pass-
  • setDateFormat
    Configures Gson to serialize Date objects according to the pattern provided. You can call this metho
  • registerTypeAdapterFactory
    Register a factory for type adapters. Registering a factory is useful when the type adapter needs to
  • setFieldNamingPolicy
    Configures Gson to apply a specific naming policy to an object's field during serialization and dese
  • registerTypeHierarchyAdapter
    Configures Gson for custom serialization or deserialization for an inheritance type hierarchy. This
  • setExclusionStrategies
    Configures Gson to apply a set of exclusion strategies during both serialization and deserialization
  • enableComplexMapKeySerialization
    Enabling this feature will only change the serialized form if the map key is a complex type (i.e. no
  • setExclusionStrategies,
  • enableComplexMapKeySerialization,
  • setLenient,
  • addSerializationExclusionStrategy,
  • excludeFieldsWithModifiers,
  • serializeSpecialFloatingPointValues,
  • setVersion,
  • setFieldNamingStrategy,
  • addTypeAdaptersForDate

Popular in Java

  • Reactive rest calls using spring rest template
  • getResourceAsStream (ClassLoader)
  • getSupportFragmentManager (FragmentActivity)
  • getExternalFilesDir (Context)
  • Rectangle (java.awt)
    A Rectangle specifies an area in a coordinate space that is enclosed by the Rectangle object's top-
  • ServerSocket (java.net)
    This class represents a server-side socket that waits for incoming client connections. A ServerSocke
  • Path (java.nio.file)
  • Connection (java.sql)
    A connection represents a link from a Java application to a database. All SQL statements and results
  • Annotation (javassist.bytecode.annotation)
    The annotation structure.An instance of this class is returned bygetAnnotations() in AnnotationsAttr
  • Servlet (javax.servlet)
    Defines methods that all servlets must implement. A servlet is a small Java program that runs within
  • CodeWhisperer alternatives
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now