Coder Social home page Coder Social logo

ason's Introduction

Ason

Ason is a dynamic object notation by using Array. the definition is simple, if the first element of the Array ends with ':', this Array is a representation of Key-Value pairs.

Getting Started

import static iboxdb.localserver.Ason.*;

public class AsonExample {
     
    public static void main(String[] args)
    {
        var obj = ason("Name:", "Andy", "Value:", 100);
                
        System.out.println(obj.getClass());
        System.out.println(obj);
    }
}

Output

class java.util.HashMap
{Value=100, Name=Andy}
Hiberarchy
var obj = ason("Name:", "Andy", "Value:", ason( "SubName:", "SubAndy" ) );

Output

{Value={SubName=SubAndy}, Name=Andy}
Use class Ason can call a function
import iboxdb.localserver.*;
import static iboxdb.localserver.Ason.*;
import static iboxdb.localserver.IFunction.*;

public class AsonExample {

    public static void main(String[] args) {
        var obj = new Ason("Name:", "Andy", "Add:", func((inputs) -> {
            return (Integer) inputs[0] + (Integer) inputs[1];
        }));
 
        System.out.println(obj.invoke("Add", 100, 200));
    }
}

the Array passed through "new Ason(array)" always dynamic object array, it doesn't check the ':' flag.

if the first element not ends with ':' , it will back to Array , as "new Object[]"

var obj = new Ason("Name:", "Andy", "Addresses:", ason("Addr_01", "Addr_02"));

Object[] os = (Object[]) obj.get("Addresses");
System.out.println(os[0] + " , " + os[1]);

if an Array ends with ':', but it isn't dynamic object, just new an Array,

var obj = new Object[]{ "ABC:", "DEF:"};

ason's People

Contributors

iboxdb avatar

Stargazers

 avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.