Java class attribute name

Содержание
  1. Java class attribute name
  2. Field Summary
  3. Constructor Summary
  4. Method Summary
  5. Methods declared in class java.lang.Object
  6. Field Detail
  7. MANIFEST_VERSION
  8. SIGNATURE_VERSION
  9. CONTENT_TYPE
  10. CLASS_PATH
  11. MAIN_CLASS
  12. SEALED
  13. EXTENSION_LIST
  14. EXTENSION_NAME
  15. EXTENSION_INSTALLATION
  16. IMPLEMENTATION_TITLE
  17. IMPLEMENTATION_VERSION
  18. IMPLEMENTATION_VENDOR
  19. IMPLEMENTATION_VENDOR_ID
  20. IMPLEMENTATION_URL
  21. SPECIFICATION_TITLE
  22. SPECIFICATION_VERSION
  23. SPECIFICATION_VENDOR
  24. MULTI_RELEASE
  25. Constructor Detail
  26. Name
  27. Method Detail
  28. equals
  29. hashCode
  30. toString
  31. Java Class Attributes
  32. Example
  33. Accessing Attributes
  34. Example
  35. Modify Attributes
  36. Example
  37. Example
  38. Example
  39. Multiple Objects
  40. Example
  41. Multiple Attributes
  42. Example
  43. Class Attributes.Name
  44. Field Summary
  45. Constructor Summary
  46. Method Summary
  47. Methods declared in class java.lang.Object
  48. Field Details
  49. MANIFEST_VERSION
  50. SIGNATURE_VERSION
  51. CONTENT_TYPE
  52. CLASS_PATH
  53. MAIN_CLASS
  54. SEALED
  55. EXTENSION_LIST
  56. EXTENSION_NAME
  57. EXTENSION_INSTALLATION
  58. IMPLEMENTATION_TITLE
  59. IMPLEMENTATION_VERSION
  60. IMPLEMENTATION_VENDOR
  61. IMPLEMENTATION_VENDOR_ID
  62. IMPLEMENTATION_URL
  63. SPECIFICATION_TITLE
  64. SPECIFICATION_VERSION
  65. SPECIFICATION_VENDOR
  66. MULTI_RELEASE
  67. Constructor Details
  68. Name
  69. Method Details
  70. equals
  71. hashCode
  72. toString
  73. Java class attribute name
  74. Nested Class Summary
  75. Nested classes/interfaces inherited from interface java.util.Map
  76. Field Summary
  77. Constructor Summary
  78. Method Summary
  79. Methods inherited from class java.lang.Object
  80. Methods inherited from interface java.util.Map
  81. Field Detail
  82. map
  83. Constructor Detail
  84. Attributes
  85. Attributes
  86. Attributes
  87. Method Detail
  88. get
  89. getValue
  90. getValue
  91. put
  92. putValue
  93. remove
  94. containsValue
  95. containsKey
  96. putAll
  97. clear
  98. size
  99. isEmpty
  100. keySet
  101. values
  102. entrySet
  103. equals
  104. hashCode
  105. clone

Java class attribute name

The Attributes.Name class represents an attribute name stored in this Map. Valid attribute names are case-insensitive, are restricted to the ASCII characters in the set [0-9a-zA-Z_-], and cannot exceed 70 characters in length. Attribute values can contain any characters and will be UTF8-encoded when written to the output stream. See the JAR File Specification for more information about valid attribute names and values.

Field Summary

Name object for Extension-List manifest attribute used for the extension mechanism that is no longer supported.

Constructor Summary

Method Summary

Methods declared in class java.lang.Object

Field Detail

MANIFEST_VERSION

Name object for Manifest-Version manifest attribute. This attribute indicates the version number of the manifest standard to which a JAR file’s manifest conforms.

Читайте также:  Троичная система счисления питон

SIGNATURE_VERSION

CONTENT_TYPE

CLASS_PATH

MAIN_CLASS

Name object for Main-Class manifest attribute used for launching applications packaged in JAR files. The Main-Class attribute is used in conjunction with the -jar command-line option of the java application launcher.

SEALED

EXTENSION_LIST

Name object for Extension-List manifest attribute used for the extension mechanism that is no longer supported.

EXTENSION_NAME

Name object for Extension-Name manifest attribute. used for the extension mechanism that is no longer supported.

EXTENSION_INSTALLATION

@Deprecated public static final Attributes.Name EXTENSION_INSTALLATION

IMPLEMENTATION_TITLE

IMPLEMENTATION_VERSION

IMPLEMENTATION_VENDOR

IMPLEMENTATION_VENDOR_ID

@Deprecated public static final Attributes.Name IMPLEMENTATION_VENDOR_ID

IMPLEMENTATION_URL

@Deprecated public static final Attributes.Name IMPLEMENTATION_URL

SPECIFICATION_TITLE

SPECIFICATION_VERSION

SPECIFICATION_VENDOR

MULTI_RELEASE

Constructor Detail

Name

Method Detail

equals

hashCode

toString

Report a bug or suggest an enhancement
For further API reference and developer documentation see the Java SE Documentation, which contains more detailed, developer-targeted descriptions with conceptual overviews, definitions of terms, workarounds, and working code examples.
Java is a trademark or registered trademark of Oracle and/or its affiliates in the US and other countries.
Copyright © 1993, 2023, Oracle and/or its affiliates, 500 Oracle Parkway, Redwood Shores, CA 94065 USA.
All rights reserved. Use is subject to license terms and the documentation redistribution policy.

Источник

Java Class Attributes

In the previous chapter, we used the term «variable» for x in the example (as shown below). It is actually an attribute of the class. Or you could say that class attributes are variables within a class:

Example

Create a class called » Main » with two attributes: x and y :

Another term for class attributes is fields.

Accessing Attributes

You can access attributes by creating an object of the class, and by using the dot syntax ( . ):

The following example will create an object of the Main class, with the name myObj . We use the x attribute on the object to print its value:

Example

Create an object called » myObj » and print the value of x :

Modify Attributes

You can also modify attribute values:

Example

Or override existing values:

Example

Change the value of x to 25:

If you don’t want the ability to override existing values, declare the attribute as final :

Example

The final keyword is useful when you want a variable to always store the same value, like PI (3.14159. ).

The final keyword is called a «modifier». You will learn more about these in the Java Modifiers Chapter.

Multiple Objects

If you create multiple objects of one class, you can change the attribute values in one object, without affecting the attribute values in the other:

Example

Change the value of x to 25 in myObj2 , and leave x in myObj1 unchanged:

Multiple Attributes

You can specify as many attributes as you want:

Example

The next chapter will teach you how to create class methods and how to access them with objects.

Источник

Class Attributes.Name

The Attributes.Name class represents an attribute name stored in this Map. Valid attribute names are case-insensitive, are restricted to the ASCII characters in the set [0-9a-zA-Z_-], and cannot exceed 70 characters in length. Attribute values can contain any characters and will be UTF8-encoded when written to the output stream. See the JAR File Specification for more information about valid attribute names and values.

Field Summary

Name object for Extension-List manifest attribute used for the extension mechanism that is no longer supported.

Name object for Extension-Name manifest attribute used for the extension mechanism that is no longer supported.

Constructor Summary

Method Summary

Methods declared in class java.lang.Object

Field Details

MANIFEST_VERSION

Name object for Manifest-Version manifest attribute. This attribute indicates the version number of the manifest standard to which a JAR file’s manifest conforms.

SIGNATURE_VERSION

CONTENT_TYPE

CLASS_PATH

MAIN_CLASS

Name object for Main-Class manifest attribute used for launching applications packaged in JAR files. The Main-Class attribute is used in conjunction with the -jar command-line option of the java application launcher.

SEALED

EXTENSION_LIST

Name object for Extension-List manifest attribute used for the extension mechanism that is no longer supported.

EXTENSION_NAME

Name object for Extension-Name manifest attribute used for the extension mechanism that is no longer supported.

EXTENSION_INSTALLATION

IMPLEMENTATION_TITLE

IMPLEMENTATION_VERSION

IMPLEMENTATION_VENDOR

IMPLEMENTATION_VENDOR_ID

IMPLEMENTATION_URL

SPECIFICATION_TITLE

SPECIFICATION_VERSION

SPECIFICATION_VENDOR

MULTI_RELEASE

Constructor Details

Name

Method Details

equals

hashCode

toString

Report a bug or suggest an enhancement
For further API reference and developer documentation see the Java SE Documentation, which contains more detailed, developer-targeted descriptions with conceptual overviews, definitions of terms, workarounds, and working code examples. Other versions.
Java is a trademark or registered trademark of Oracle and/or its affiliates in the US and other countries.
Copyright © 1993, 2023, Oracle and/or its affiliates, 500 Oracle Parkway, Redwood Shores, CA 94065 USA.
All rights reserved. Use is subject to license terms and the documentation redistribution policy.

Источник

Java class attribute name

The Attributes class maps Manifest attribute names to associated string values. Valid attribute names are case-insensitive, are restricted to the ASCII characters in the set [0-9a-zA-Z_-], and cannot exceed 70 characters in length. Attribute values can contain any characters and will be UTF8-encoded when written to the output stream. See the JAR File Specification for more information about valid attribute names and values.

Nested Class Summary

Nested classes/interfaces inherited from interface java.util.Map

Field Summary

Constructor Summary

Constructs a new Attributes object with the same attribute name-value mappings as in the specified Attributes.

Method Summary

Returns the value of the specified attribute name, specified as a string, or null if the attribute was not found.

Methods inherited from class java.lang.Object

Methods inherited from interface java.util.Map

Field Detail

map

Constructor Detail

Attributes

Attributes

public Attributes(int size)

Attributes

Constructs a new Attributes object with the same attribute name-value mappings as in the specified Attributes.

Method Detail

get

getValue

Returns the value of the specified attribute name, specified as a string, or null if the attribute was not found. The attribute name is case-insensitive. This method is defined as:

return (String)get(new Attributes.Name((String)name));

getValue

public String getValue(Attributes.Name name)

Returns the value of the specified Attributes.Name, or null if the attribute was not found. This method is defined as:

put

public Object put(Object name, Object value)

Associates the specified value with the specified attribute name (key) in this Map. If the Map previously contained a mapping for the attribute name, the old value is replaced.

putValue

public String putValue(String name, String value)

Associates the specified value with the specified attribute name, specified as a String. The attributes name is case-insensitive. If the Map previously contained a mapping for the attribute name, the old value is replaced. This method is defined as:

return (String)put(new Attributes.Name(name), value);

remove

Removes the attribute with the specified name (key) from this Map. Returns the previous attribute value, or null if none.

containsValue

containsKey

putAll

Copies all of the attribute name-value mappings from the specified Attributes to this Map. Duplicate mappings will be replaced.

clear

size

isEmpty

keySet

values

entrySet

public SetMap.EntryObject,Object>> entrySet()

equals

Compares the specified Attributes object with this Map for equality. Returns true if the given object is also an instance of Attributes and the two Attributes objects represent the same mappings.

hashCode

clone

Since the attribute names and values are themselves immutable, the Attributes returned can be safely modified without affecting the original.

Submit a bug or feature
For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.
Copyright © 1993, 2023, Oracle and/or its affiliates. All rights reserved. Use is subject to license terms. Also see the documentation redistribution policy.

Источник

Оцените статью