📄 metadataid.java
字号:
package com.esri.solutions.jitk.common.metadata;
/**
* Barebones implementation of {@link IMetadataID}
*/
public class MetadataID implements IMetadataID {
/**
* {@link IMetadataCatalog} representing the catalog from which the metadata was retrieved.
*/
private IMetadataCatalog _metadataCatalog = null;
/**
* {@link IMetadataDocument} representing the metadata document.
*/
private IMetadataDocument _metadataDocument = null;
/**
* {@link String} containing the ID for this document.
*/
private String _id = null;
/**
* Default constructor; does nothing other than instantiate the object
*/
public MetadataID() {
}
/**
* Sets a reference to the metadata catalog from which the document that this {@code MetadataID} refers to was retrieved.
* @param catalog The {@link IMetadataCatalog}; cannot be {@code null}.
*/
public void setCatalog(IMetadataCatalog catalog) {
if(catalog == null) {
throw new NullPointerException("catalog cannot be null");
}
_metadataCatalog = catalog;
}
/*
* (non-Javadoc)
*
* @see com.esri.solutions.jitk.common.metadata.IMetadataID#getCatalog()
*/
public IMetadataCatalog getCatalog() {
return _metadataCatalog;
}
/**
* Sets a reference to the document to which this {@code MetadataID} refers.
* @param document The {@link IMetadataDocument}; cannot be {@code null}.
*/
public void setDocument(IMetadataDocument document) {
if(document == null) {
throw new NullPointerException("document cannot be null");
}
_metadataDocument = document;
}
/*
* (non-Javadoc)
*
* @see com.esri.solutions.jitk.common.metadata.IMetadataID#getDocument()
*/
public IMetadataDocument getDocument() {
return _metadataDocument;
}
/*
* (non-Javadoc)
*
* @see com.esri.solutions.jitk.common.metadata.IMetadataID#getId()
*/
public String getId() {
return _id;
}
/**
* @param id {@link String} containing the ID to set; cannot be {@code null}.
*/
public void setId(String id) {
if(id == null) {
throw new NullPointerException("id cannot be null");
}
_id = id;
}
/* (non-Javadoc)
* @see java.lang.Object#equals(java.lang.Object)
*/
@Override
public boolean equals(Object another) {
if(another == null) {
return false;
}
if(!(another instanceof IMetadataID)) {
return false;
}
if(another==this) {
return true;
}
IMetadataID anotherID = (IMetadataID)another;
boolean isEqual = this.getId() == anotherID.getId();
return isEqual;
}
/* (non-Javadoc)
* @see java.lang.Object#hashCode()
*/
@Override
public int hashCode() {
return super.hashCode();
}
/* (non-Javadoc)
* @see java.lang.Object#toString()
*/
@Override
public String toString() {
StringBuffer sb = new StringBuffer();
sb.append("MetadataID: ");
sb.append("ID: ");
sb.append(_id);
sb.append("Catalog: ");
sb.append(_metadataCatalog);
sb.append("Document: ");
sb.append(_metadataDocument);
String value = sb.toString();
return value;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -