com.unbound.kmip.attribute.Attributes Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of unbound-java-provider Show documentation
Show all versions of unbound-java-provider Show documentation
This is a collection of JAVA libraries that implement Unbound cryptographic classes for JAVA provider, PKCS11 wrapper, cryptoki, and advapi
package com.unbound.kmip.attribute;
import com.unbound.common.Log;
import com.unbound.kmip.KMIP;
import com.unbound.kmip.KMIPConvertException;
import com.unbound.kmip.KMIPConverter;
import java.util.*;
/**
* Created by valery.osheter on 19-Nov-15.
*/
public class Attributes extends ArrayList
{
public void convert(KMIPConverter converter) throws KMIPConvertException
{
if (converter.isWrite())
{
for (Attribute attribute : this) Attribute.convert(converter, attribute);
}
else
{
while (converter.getNextTag() == KMIP.Tag.Attribute)
{
Attribute attribute = Attribute.convert(converter, null);
add(attribute);
}
}
}
public Attribute find(int tag)
{
for (Attribute attribute : this)
{
if (attribute.tag == tag) return attribute;
}
return null;
}
public Attributes findAll(int tag)
{
Attributes attributes = new Attributes();
for (Attribute attribute : this)
{
if (attribute.tag == tag) attributes.add(attribute);
}
return attributes;
}
public void log()
{
if (size()==0) return;
Log log = Log.func("Attributes").end();
for (Attribute attribute : this) attribute.log();
log.leave();
}
}