All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.hyperscala.AttributeContainer.scala Maven / Gradle / Ivy

There is a newer version: 2.1.10
Show newest version
package org.hyperscala

import scala.collection.immutable.ListMap

/**
 * @author Matt Hicks 
 */
trait AttributeContainer[A <: PropertyAttribute[_]] {
  protected var _attributes: ListMap[String, A] = _

  def addAttribute(attribute: A) = synchronized {
    if (_attributes == null) {
      _attributes = ListMap.empty
    }
    _attributes += attribute.name -> attribute
  }
  def getAttribute(name: String) = if (_attributes != null) {
    _attributes.get(name)
  } else {
    None
  }

  def attributes: Map[String, A] = if (_attributes != null) {
    _attributes
  } else {
    Map.empty
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy