Class EclibItem

java.lang.Object
jp.ecuacion.lib.core.record.item.EclibItem

public class EclibItem extends Object
Stores item attributes.

To understand details on item, see naming-convention.md

  • Field Details

    • itemPropertyPath

      @Nonnull protected String itemPropertyPath
      Is the ID string of an item.

      rootRecordName part (= far left part) can be omitted. Namely it can be "name" or "dept.name" when the propertyPath with rootRecordName (= also called "recordPropertyPath") is "acc.name" or "acc.dept.name" where "acc" is the rootRecordName.

    • itemNameKeyClass

      protected String itemNameKeyClass
      Is a class part (= left part) of itemNameKey. (like "acc" from itemNameKey: "acc.name")
    • itemNameKeyField

      protected String itemNameKeyField
      Is a field part (= right part) of itemNameKey. (like "name" from itemNameKey: "acc.name")
  • Constructor Details

    • EclibItem

      public EclibItem(@RequireNonempty String itemPropertyPath)
      Constructs a new instance with itemPropertyPath.

      You cannot set recordPropertyPath here. Setting it caauses a duplication of rootRecordName and it cannot be found.

      Parameters:
      itemPropertyPath - itemPropertyPath
  • Method Details

    • itemNameKey

      public EclibItem itemNameKey(@RequireNonempty String itemNameKey)
      Sets itemNameKey and returns this for method chain.

      The format of itemNameKey is the same as itemNameKey, which is like "acc.name", always has one dot (not more than one) in the middle of the string.
      But the argument of the method can be like "name", itemNameKeyField only. In that case the value of itemnameKeyClass is determined by the rule written at getItemNameKey(rootRecordName) javadoc.

      Parameters:
      itemNameKey - itemNameKey
      Returns:
      Item
    • getItemPropertyPath

      public String getItemPropertyPath()
    • setsItemNameKeyClassExplicitly

      public boolean setsItemNameKeyClassExplicitly()
      Returns whether the itemNameKeyClass is set explicitly.
      Returns:
      boolean
    • getItemNameKey

      public String getItemNameKey(String defaultItemNameKeyClass)
      Returns itemNameKey value.

      There can be 3 candidates for itemNameKeyClass,
      1: itemNameKeyClass part of itemNameKey set by itemNameKey(itemNameKey)
      2: part of itemPropertyPath
      3: rootRecordName set to getItemNameKey(rootRecordName)

      When 1 exists, 1 is always used.
      When 1 does not exist, if 2. contains "." the second last part of it
      (if the string is 1.2.3.4, second last part is "3").
      When 1 does not exist and 2. does not contain ".", 3. is used.

      Notice that the return value of this method does not consider @ItemNameKeyClass annotations, which means the return value should not be used for resolution of itemName directly. Use EclibRecord#getItemNameKey() for it.

      Returns:
      itemNameKeyFieldForName