A null or empty key path is treated as if it were a single null path element. No special action is taken even of the specified data object is a Namespace instance. See put String, Namespace for the special actions that it takes for adding a Namespace.
The specified key and data object may both be null. This method differs from the put String,Object variant in that the added Namespace has its parent link changed to point to this and its root link changed to point to the root of this Namespace. Thus, the specified Namespace will lose any previous link to a parent and root. The specified key may be null. If the specified Namespace is null , then a null value is added to this Namespace ; of course, no relinking of parent and root could happen in that case.
The namespace path must already exist before the data can be added. If the namespace path cannot be found, then this method has no effect. No special action is taken even if the specified data object is a Namespace instance. See put String[], Namespace for the special actions that it takes for adding a Namespace. The namespace path must already exist before the specified Namespace can be added. This method differs from the put String[],Object variant in that the added Namespace has its parent link changed to point to the Namespace in which it is added and its root link changed to point to the root of that Namespace 's root which is the same as this Namespace 's root.
The returned Map is a shallow copy of the data structure used internally by the Namespace. Therefore, changes to the returned Map will not affect the Namespace. However, direct changes to value objects within the Map will be reflected in the Namespace.
In particular, subclasses must be able to guarantee that calls to this method do not introduce cycles in the Namespace tree nor should the parent ever be null. Otherwise, the Namespace data structure will no longer have the correct behavior. All methods in the Namespace class are implemented to obtain the underlying Map storage from this method. In general, translation will not be necessary, so this method by default returns the specified key itself.
A subclass that requires key mappings should override this method to provide the proper key mapping behavior. All rights reserved. Object oracle. Object This class implements a data structure that uses a hierarchy of named scopes to locate data objects. The names of all objects are specified as strings. Name paths are also allowed see below , and these are expressed as string arrays. Creates a new root Namespace whose data is the specified Map.
Creates a new Namespace whose data is the specified Map and whose parent is the specified Namespace. Creates a new empty Namespace whose parent is the specified Namespace. This is a pseudo copy constructor for use by subclasses which need to take on the responsibilities of an existing Namespace.
Returns true if this Namespace contains a data object by the specified key. This method attempts to locate a data object by the given key name in this Namespace.
This method locates a data object by the given key name using the same algorithm as the find String method. Returns the data object in this Namespace whose name is the specified String. Returns the data object in this Namespace whose name path is the specified String array. This method is used to retrieve the underlying Map storage associated with this Namespace instance. Returns the Namespace that is the immediate parent of this Namespace.
Returns the root Namespace of the hierarchy containing this Namespace. Returns true if this Namespace is a root Namespace. Improve Article. Like Article. WheelCollection wheels;. Article Contributed By :. Easy Normal Medium Hard Expert. Writing code in comment? Please use ide.
Load Comments. Thus, except when you are writing simple example programs, you should always use the package directive to prevent access to your classes from totally unrelated classes that also just happen to be stored in the unnamed package.
A class in a package p can refer to any other class in p by its simple name. And, since the classes in the java. Thus, you can always type String , instead of java. By default, however, you must use the fully qualified name of all other classes. So, if you want to use the File class of the java. Specifying package names explicitly all the time quickly gets tiring, so Java includes an import directive you can use to save some typing. The import keyword can be used any number of times in a Java file, but all uses must be at the top of the file, immediately after the package directive, if there is one.
There can be comments between the package directive and the import directives, of course, but there cannot be any other Java code. The import directive is available in two forms. To specify a single class that can be referred to by its simple name, follow the import keyword with the name of the class and a semicolon:.
To import an entire package of classes, follow import with the name of the package, the characters. Thus, if you want to use several other classes from the java. This package import syntax does not apply to subpackages. If I import the java. ZipInputStream class by its fully qualified name.
0コメント