com.android.ide.common.xml
Enum XmlAttributeSortOrder

java.lang.Object
  extended by java.lang.Enum<XmlAttributeSortOrder>
      extended by com.android.ide.common.xml.XmlAttributeSortOrder
All Implemented Interfaces:
java.io.Serializable, java.lang.Comparable<XmlAttributeSortOrder>

public enum XmlAttributeSortOrder
extends java.lang.Enum<XmlAttributeSortOrder>

Order to use when sorting attributes


Enum Constant Summary
ALPHABETICAL
           
LOGICAL
           
NO_SORTING
           
 
Field Summary
 java.lang.String key
           
 
Method Summary
static int compareAttributes(java.lang.String name1, java.lang.String name2)
          Returns Comparator values for ordering attributes in the following order: id style layout_width layout_height other layout params, sorted alphabetically other attributes, sorted alphabetically
static int compareAttributes(java.lang.String prefix1, java.lang.String name1, java.lang.String prefix2, java.lang.String name2)
          Returns Comparator values for ordering attributes in the following order: id style layout_width layout_height other layout params, sorted alphabetically other attributes, sorted alphabetically, first by namespace, then by name
 java.util.Comparator<org.w3c.dom.Attr> getAttributeComparator()
           
static XmlAttributeSortOrder valueOf(java.lang.String name)
          Returns the enum constant of this type with the specified name.
static XmlAttributeSortOrder[] values()
          Returns an array containing the constants of this enum type, in the order they are declared.
 
Methods inherited from class java.lang.Enum
clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Enum Constant Detail

NO_SORTING

public static final XmlAttributeSortOrder NO_SORTING

ALPHABETICAL

public static final XmlAttributeSortOrder ALPHABETICAL

LOGICAL

public static final XmlAttributeSortOrder LOGICAL
Field Detail

key

public final java.lang.String key
Method Detail

values

public static XmlAttributeSortOrder[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
for (XmlAttributeSortOrder c : XmlAttributeSortOrder.values())
    System.out.println(c);

Returns:
an array containing the constants of this enum type, in the order they are declared

valueOf

public static XmlAttributeSortOrder valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)

Parameters:
name - the name of the enum constant to be returned.
Returns:
the enum constant with the specified name
Throws:
java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
java.lang.NullPointerException - if the argument is null

getAttributeComparator

@Nullable
public java.util.Comparator<org.w3c.dom.Attr> getAttributeComparator()
Returns:
a comparator for use by this attribute sort order

compareAttributes

public static int compareAttributes(java.lang.String name1,
                                    java.lang.String name2)
Returns Comparator values for ordering attributes in the following order:

Parameters:
name1 - the first attribute name to compare
name2 - the second attribute name to compare
Returns:
a negative number if name1 should be ordered before name2

compareAttributes

public static int compareAttributes(@Nullable
                                    java.lang.String prefix1,
                                    @NonNull
                                    java.lang.String name1,
                                    @Nullable
                                    java.lang.String prefix2,
                                    @NonNull
                                    java.lang.String name2)
Returns Comparator values for ordering attributes in the following order:

Parameters:
prefix1 - the namespace prefix, if any, of name1
name1 - the first attribute name to compare
prefix2 - the namespace prefix, if any, of name2
name2 - the second attribute name to compare
Returns:
a negative number if name1 should be ordered before name2