SortOrder.Builder
Stay organized with collections
Save and categorize content based on your preferences.
Public Constructor Summary
Inherited Method Summary
From class java.lang.Object
Public Constructors
public
SortOrder.Builder
()
Public Methods
Adds the SortableMetadataField
to be used to sort the query results in ascending order of the values of the sortField.
Query results are sorted in the same order the fields are added.
Parameters
sortField
the field to be used to sort the query results in ascending order, see SortableField
for the list of fields that can be used to sort query results
Adds the SortableMetadataField
to be used to sort the query results in descending order of the values of the
sortField. Query results are sorted in the same order the fields are added.
Parameters
sortField
the field to be used to sort the query results in descending order, see SortableField
for the list of fields that can be used to sort query results
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License
, and code samples are licensed under the Apache 2.0 License
. For details, see the Google Developers Site Policies
. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2024-10-31 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2024-10-31 UTC."],[[["\u003cp\u003e\u003ccode\u003eSortOrder.Builder\u003c/code\u003e allows you to specify the order in which query results are sorted.\u003c/p\u003e\n"],["\u003cp\u003eYou can add \u003ccode\u003eSortableMetadataField\u003c/code\u003es to sort results in ascending or descending order using \u003ccode\u003eaddSortAscending\u003c/code\u003e and \u003ccode\u003eaddSortDescending\u003c/code\u003e methods respectively.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003ebuild\u003c/code\u003e method creates a \u003ccode\u003eSortOrder\u003c/code\u003e object based on the defined sorting criteria.\u003c/p\u003e\n"],["\u003cp\u003eQuery results are sorted based on the order in which the fields are added to the \u003ccode\u003eSortOrder.Builder\u003c/code\u003e.\u003c/p\u003e\n"]]],["The `SortOrder.Builder` class enables the creation of sort orders for query results. Key actions include: `addSortAscending`, which sorts results in ascending order based on a specified `SortableMetadataField`; `addSortDescending`, which sorts in descending order; and `build`, which finalizes the sort order. The sorting is done in the order the fields are added using those two methods, and they both receive a `SortableMetadataField` as parameter. The builder can be instantiated using the default constructor.\n"],null,["# SortOrder.Builder\n\npublic static class **SortOrder.Builder** extends [Object](//developer.android.com/reference/java/lang/Object.html) \n\n### Public Constructor Summary\n\n|---|--------------------------------------------------------------------------------------------------------------------|\n| | [SortOrder.Builder](/android/reference/com/google/android/gms/drive/query/SortOrder.Builder#SortOrder.Builder())() |\n\n### Public Method Summary\n\n|----------------------------------------------------------------------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| [SortOrder.Builder](/android/reference/com/google/android/gms/drive/query/SortOrder.Builder) | [addSortAscending](/android/reference/com/google/android/gms/drive/query/SortOrder.Builder#addSortAscending(com.google.android.gms.drive.metadata.SortableMetadataField))([SortableMetadataField](/android/reference/com/google/android/gms/drive/metadata/SortableMetadataField) sortField) Adds the [SortableMetadataField](/android/reference/com/google/android/gms/drive/metadata/SortableMetadataField) to be used to sort the query results in ascending order of the values of the sortField. |\n| [SortOrder.Builder](/android/reference/com/google/android/gms/drive/query/SortOrder.Builder) | [addSortDescending](/android/reference/com/google/android/gms/drive/query/SortOrder.Builder#addSortDescending(com.google.android.gms.drive.metadata.SortableMetadataField))([SortableMetadataField](/android/reference/com/google/android/gms/drive/metadata/SortableMetadataField) sortField) Adds the [SortableMetadataField](/android/reference/com/google/android/gms/drive/metadata/SortableMetadataField) to be used to sort the query results in descending order of the values of the sortField. |\n| [SortOrder](/android/reference/com/google/android/gms/drive/query/SortOrder) | [build](/android/reference/com/google/android/gms/drive/query/SortOrder.Builder#build())() |\n\n### Inherited Method Summary\n\nFrom class java.lang.Object \n\n|----------------------------------------------------------------------------|--------------------------------------------------------------------------------|\n| [Object](//developer.android.com/reference/java/lang/Object.html) | clone() |\n| boolean | equals([Object](//developer.android.com/reference/java/lang/Object.html) arg0) |\n| void | finalize() |\n| final [Class](//developer.android.com/reference/java/lang/Class.html)\\\u003c?\\\u003e | getClass() |\n| int | hashCode() |\n| final void | notify() |\n| final void | notifyAll() |\n| [String](//developer.android.com/reference/java/lang/String.html) | toString() |\n| final void | wait(long arg0, int arg1) |\n| final void | wait(long arg0) |\n| final void | wait() |\n\nPublic Constructors\n-------------------\n\n#### public **SortOrder.Builder** ()\n\nPublic Methods\n--------------\n\n#### public [SortOrder.Builder](/android/reference/com/google/android/gms/drive/query/SortOrder.Builder)\n**addSortAscending** ([SortableMetadataField](/android/reference/com/google/android/gms/drive/metadata/SortableMetadataField) sortField)\n\nAdds the [SortableMetadataField](/android/reference/com/google/android/gms/drive/metadata/SortableMetadataField)\nto be used to sort the query results in ascending order of the values of the sortField.\nQuery results are sorted in the same order the fields are added. \n\n##### Parameters\n\n| sortField | the field to be used to sort the query results in ascending order, see [SortableField](/android/reference/com/google/android/gms/drive/query/SortableField) for the list of fields that can be used to sort query results |\n|-----------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n\n#### public [SortOrder.Builder](/android/reference/com/google/android/gms/drive/query/SortOrder.Builder)\n**addSortDescending** ([SortableMetadataField](/android/reference/com/google/android/gms/drive/metadata/SortableMetadataField) sortField)\n\nAdds the [SortableMetadataField](/android/reference/com/google/android/gms/drive/metadata/SortableMetadataField)\nto be used to sort the query results in descending order of the values of the\nsortField. Query results are sorted in the same order the fields are added. \n\n##### Parameters\n\n| sortField | the field to be used to sort the query results in descending order, see [SortableField](/android/reference/com/google/android/gms/drive/query/SortableField) for the list of fields that can be used to sort query results |\n|-----------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n\n#### public [SortOrder](/android/reference/com/google/android/gms/drive/query/SortOrder)\n**build** ()"]]