类 DatabaseResource

java.lang.Object
org.ssssssss.magicapi.core.resource.KeyValueResource
org.ssssssss.magicapi.core.resource.DatabaseResource
所有已实现的接口:
Resource

public class DatabaseResource extends KeyValueResource
数据库资源存储
作者:
mxd
  • 字段详细资料

    • logger

      private static final org.slf4j.Logger logger
    • template

      private final org.springframework.jdbc.core.JdbcTemplate template
    • tableName

      private final String tableName
    • cachedContent

      private Map<String,String> cachedContent
  • 构造器详细资料

    • DatabaseResource

      public DatabaseResource(org.springframework.jdbc.core.JdbcTemplate template, String tableName)
    • DatabaseResource

      public DatabaseResource(org.springframework.jdbc.core.JdbcTemplate template, String tableName, boolean readonly)
    • DatabaseResource

      public DatabaseResource(org.springframework.jdbc.core.JdbcTemplate template, String tableName, String path, boolean readonly)
    • DatabaseResource

      public DatabaseResource(org.springframework.jdbc.core.JdbcTemplate template, String tableName, String path, boolean readonly, KeyValueResource parent)
    • DatabaseResource

      public DatabaseResource(org.springframework.jdbc.core.JdbcTemplate template, String tableName, String path, boolean readonly, Map<String,String> cachedContent, KeyValueResource parent)
  • 方法详细资料

    • read

      public byte[] read()
      从接口复制的说明: Resource
      读取
      返回:
      读取的资源内容
    • readAll

      public void readAll()
      从接口复制的说明: Resource
      读取当前资源下的所有内容,主要是缓存作用。
    • exists

      public boolean exists()
      从接口复制的说明: Resource
      判断是否存在
      返回:
      返回资源是否存在
    • write

      public boolean write(String content)
      从接口复制的说明: Resource
      写入
      参数:
      content - 写入的内容
      返回:
      是否写入成功
    • keys

      public Set<String> keys()
      从类复制的说明: KeyValueResource
      该资源下的keys
      指定者:
      keys 在类中 KeyValueResource
      返回:
      返回该资源下的keys
    • renameTo

      public boolean renameTo(Map<String,String> renameKeys)
      从类复制的说明: KeyValueResource
      需要做修改的key,原key: 新key
      指定者:
      renameTo 在类中 KeyValueResource
      参数:
      renameKeys - 需重命名的key
      返回:
      是否修改成功
    • delete

      public boolean delete()
      从接口复制的说明: Resource
      删除
      指定者:
      delete 在接口中 Resource
      覆盖:
      delete 在类中 KeyValueResource
      返回:
      返回是否删除成功
    • mappedFunction

      public Function<String,Resource> mappedFunction()
      从类复制的说明: KeyValueResource
      mapped函数,用于根据路径创建资源对象
      指定者:
      mappedFunction 在类中 KeyValueResource
      返回:
      mapped函数
    • toString

      public String toString()
      覆盖:
      toString 在类中 Object