Package org.eclipse.aether.metadata
Class AbstractMetadata
- java.lang.Object
-
- org.eclipse.aether.metadata.AbstractMetadata
-
- All Implemented Interfaces:
Metadata
- Direct Known Subclasses:
DefaultMetadata
public abstract class AbstractMetadata extends java.lang.Object implements Metadata
A skeleton class for metadata.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.eclipse.aether.metadata.Metadata
Metadata.Nature
-
-
Constructor Summary
Constructors Constructor Description AbstractMetadata()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected static java.util.Map<java.lang.String,java.lang.String>
copyProperties(java.util.Map<java.lang.String,java.lang.String> properties)
Copies the specified metadata properties.boolean
equals(java.lang.Object obj)
Compares this metadata with the specified object.java.lang.String
getProperty(java.lang.String key, java.lang.String defaultValue)
Gets the specified property.private static int
hash(java.lang.Object obj)
int
hashCode()
Returns a hash code for this metadata.private Metadata
newInstance(java.util.Map<java.lang.String,java.lang.String> properties, java.io.File file)
Metadata
setFile(java.io.File file)
Sets the file of the metadata.Metadata
setProperties(java.util.Map<java.lang.String,java.lang.String> properties)
Sets the properties for the metadata.java.lang.String
toString()
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.eclipse.aether.metadata.Metadata
getArtifactId, getFile, getGroupId, getNature, getProperties, getType, getVersion
-
-
-
-
Method Detail
-
newInstance
private Metadata newInstance(java.util.Map<java.lang.String,java.lang.String> properties, java.io.File file)
-
setFile
public Metadata setFile(java.io.File file)
Description copied from interface:Metadata
Sets the file of the metadata.
-
setProperties
public Metadata setProperties(java.util.Map<java.lang.String,java.lang.String> properties)
Description copied from interface:Metadata
Sets the properties for the metadata.- Specified by:
setProperties
in interfaceMetadata
- Parameters:
properties
- The properties for the metadata, may benull
.- Returns:
- The new metadata, never
null
.
-
getProperty
public java.lang.String getProperty(java.lang.String key, java.lang.String defaultValue)
Description copied from interface:Metadata
Gets the specified property.- Specified by:
getProperty
in interfaceMetadata
- Parameters:
key
- The name of the property, must not benull
.defaultValue
- The default value to return in case the property is not set, may benull
.- Returns:
- The requested property value or
null
if the property is not set and no default value was provided.
-
copyProperties
protected static java.util.Map<java.lang.String,java.lang.String> copyProperties(java.util.Map<java.lang.String,java.lang.String> properties)
Copies the specified metadata properties. This utility method should be used when creating new metadata instances with caller-supplied properties.- Parameters:
properties
- The properties to copy, may benull
.- Returns:
- The copied and read-only properties, never
null
.
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
equals
public boolean equals(java.lang.Object obj)
Compares this metadata with the specified object.- Overrides:
equals
in classjava.lang.Object
- Parameters:
obj
- The object to compare this metadata against, may benull
.- Returns:
true
if and only if the specified object is anotherMetadata
with equal coordinates, type, nature, properties and file,false
otherwise.
-
hashCode
public int hashCode()
Returns a hash code for this metadata.- Overrides:
hashCode
in classjava.lang.Object
- Returns:
- A hash code for the metadata.
-
hash
private static int hash(java.lang.Object obj)
-
-