-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathparams.json
1 lines (1 loc) · 4.78 KB
/
params.json
1
{"name":"Grails-smartionary","tagline":"A Grails Plugin that implements a Domain that emulates a Map or Dictionary, with a strong progremmatic interface.","body":"# Grails Smartionary Plugin\r\n\r\nA `Grails` plugin that provides a progremmatic and administrative interface\r\nfor storing information in a Domain, which can be converted to and from a\r\n`java.util.Map`.\r\n\r\n## Usage\r\n\r\nThis Plugin is designed for applications which wish to store external data in\r\na Domain, and use that data within the application as a Map. Advantages of this\r\nover a Config block is that the data can be updated in production run-time and\r\nby administrative or non-technical hats.\r\n\r\n## Limitations\r\n\r\nThe Plugin is very simple, and so it does not support arbitrary Map depth or\r\nLists. In otherwords, it should be treated like a single-level Map.\r\n\r\nAll keys and values are Strings, so complex datatypes are not directly\r\nsupported. JSON is supported in a limited fashion, as JSON uses simple\r\nDatatypes. When retrieving information, all values will be Strings. Future\r\nsupport for automatically converting the values is possible.\r\n\r\n# Quick-start Guide\r\n\r\n## Installation\r\n\r\nAdd a dependency in BuildConfig.groovy:\r\n\r\n compile 'smartionary:1.0'\r\n\r\n## Controller links (for web-interface)\r\n\r\nSmartionary: `/smartionary`\r\n\r\nSmartionaryEntry: `/smartionaryEntry` or `/smartionary/entries`\r\n\r\n## The `Smartionary` Object (for progremmatic-interface)\r\n\r\n import me.sudofu.smartionary.Smartionary\r\n\r\n // 'sample' will be dynamically created if it does not exist already in\r\n // Smartionary Domain.\r\n Smartionary.set(\r\n 'sample',\r\n 'A sample smartionary.',\r\n\r\n first: \"This gets converted into a SmartionaryEntry.\"\r\n\r\n second: 4, // Will be: \"4\"\r\n third: new Date(1000), // Will be: new Date() as String\r\n\r\n smartionaryDescriptions: [ // Special \"reserved\" key.\r\n first: \"Explanation of what happens.\", // Matches above key.\r\n fourth: \"This key does not exist.\" // Ignored, no match.\r\n ]\r\n )\r\n\r\n Map smart = Smartionary.get('sample')\r\n println smart.first // This gets converted into a SmartionaryEntry.\r\n println smart.second // 4 (as String)\r\n println smart.third // Wed Dec 31 18:00:01 CST 1969\r\n println smart.fourth // null\r\n\r\n // Update existing entries, and create additional ones.\r\n Smartionary.set(\r\n 'sample',\r\n third: new Date(2000),\r\n fourth: new UUID(1000, 2000),\r\n fifth: 'hi'\r\n )\r\n\r\n smart = Smartionary.get('sample')\r\n\r\n println smart.third // Wed Dec 31 18:00:02 CST 1969\r\n println smart.fourth // 00000000-0000-03e8-0000-0000000007d0 (as String)\r\n println smart.fifth // hi\r\n\r\n // Set a specific entry (can also be done with Map form).\r\n Smartionary.set('sample', 'fourth', new UUID(2000, 3000), 'Adding an optional description')\r\n\r\n // Delete an entry.\r\n Smartionary.delete('sample', 'fifth')\r\n\r\n // Or delete many...\r\n Smartionary.delete('sample', 'first', 'second', 'third')\r\n\r\n smart = Smartionary.get('sample')\r\n\r\n println smart.fourth // 00000000-0000-07d0-0000-000000000bb8\r\n println smart.fifth // null\r\n\r\n // Purge all entries that are null, to clean up the Domain if necessary.\r\n Smartionary.purgeNull('sample')\r\n\r\n // Or, purge all the keys to repurpose the Domain.\r\n Smartionary.purge('sample')\r\n\r\n // Create a Smartionary from JSON.\r\n //\r\n // Using anything other than a Map will result in an\r\n // IllegalArgumentException.\r\n //\r\n // Also, nested Maps are currently not supported...\r\n String json = '{\"a\": \"apple\", \"b\": \"banana\", \"c\":\"carrot\"}'\r\n\r\n Smartionary.fromJson('sample', json, 'Created from JSON.')\r\n\r\n // Convert Smartionary back to JSON.\r\n json = Smartionary.getAsJson('sample')\r\n println json // Nearly identical to the above.\r\n\r\n // Make it pretty!\r\n json = Smartionary.getAsJson('sample', true)\r\n\r\n // Some Map-interface-like functions are included.\r\n println Smartionary.size('sample') // 3, currently.\r\n println Smartionary.contains('sample', \"apple\") // true\r\n println Smartionary.containsKey('sample', \"b\") // true\r\n\r\n println Smartionary.size('nonexistant') // -1, it does not exist.\r\n println Smartionary.contains('sample', \"Durian\") // false\r\n println Smartionary.containsKey('sample', 'd') // false\r\n\r\n // Delete all the things.\r\n Smartionary.delete('sample')\r\n","google":"","note":"Don't delete this file! It's used internally to help with page regeneration."}