craterdog.accounting.TransactionAttributes Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of java-digital-accounting Show documentation
Show all versions of java-digital-accounting Show documentation
This project defines a set of interfaces and classes that implement digital accounting.
/************************************************************************
* Copyright (c) Crater Dog Technologies(TM). All Rights Reserved. *
************************************************************************
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. *
* *
* This code is free software; you can redistribute it and/or modify it *
* under the terms of The MIT License (MIT), as published by the Open *
* Source Initiative. (See http://opensource.org/licenses/MIT) *
************************************************************************/
package craterdog.accounting;
import com.fasterxml.jackson.annotation.JsonAnyGetter;
import com.fasterxml.jackson.annotation.JsonAnySetter;
import craterdog.notary.DocumentCitation;
import craterdog.notary.Watermark;
import craterdog.smart.SmartObject;
import java.net.URI;
import java.util.LinkedHashMap;
import java.util.Map;
/**
* This class defines the attributes that make up a digital transaction that can be used
* to transfer a token of value.
*
* @author Derk Norton
*/
public final class TransactionAttributes extends SmartObject {
/**
* The location of this document.
*/
public URI myLocation;
/**
* The uniform reference identifier that specifies the location of the sender of the transaction.
*/
public URI senderLocation;
/**
* The uniform reference identifier that specifies the location of the receiver of the transaction.
*/
public URI receiverLocation;
/**
* The uniform reference identifier for the location of the escrow agent. If this is not set
* then no escrow agent is involved in the transaction.
*/
public URI escrowLocation;
/**
* The type of transaction (e.g. ownership transfer, money transfer, etc.).
*/
public String transactionType;
/**
* The document citation that specifies the location of the token involved in
* the transaction.
*/
public DocumentCitation tokenCitation;
/**
* The lifetime of the transaction along with the version of the algorithm used to sign it.
*/
public Watermark watermark;
/*
* This map is used to hold any JSON attributes that are not mappable to the existing attributes.
*/
private final Map additional = new LinkedHashMap<>();
/**
* This method returns the value of the additional attribute associated with the specified
* name, or null if none exists.
*
* @param name The name of the additional attribute to be returned.
* @return The value of the attribute.
*/
public Object get(String name) {
return additional.get(name);
}
/**
* This method allows the setting of additional attributes that are not explicitly defined.
*
* @param name The name of the additional attribute.
* @param value The value to be associated with this attribute name.
* @return Any previous attribute value associated with this attribute name.
*/
@JsonAnySetter
public Object put(String name, Object value) {
return additional.put(name, value);
}
/**
* This method returns a map of the additional attributes that are not explicitly defined. It
* is primarily used by the Jackson parser during deserialization of the corresponding JSON.
*
* @return A map containing the additional attributes.
*/
@JsonAnyGetter
public Map any() {
return additional;
}
}