GithubHelp home page GithubHelp logo

modelgen's People

Contributors

miho avatar turpid-monkey avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

miho funysunny

modelgen's Issues

Name collision (should move implementations to impl subpackage)

Consider the following interfaces:

public class Test {
  // ...
}

and

public class TestObject {
  // ...
}

They will lead to the following impl Classes:

Test               => TestObject.java
TestObject         => TestObjectObject.java

Problem:

TestObject class from Test causes name collision with TestObject interface.

Possible Solution:

Move impl classes to implsubpackage.

Generated code for code generation based on annotations

The model will be used for representing Java/Groovy code, so a flexible way to generate code from model instances should be provided.

One idea to do so would be to introduce a nested @codegenerators(@code) annotation:

@CodeGenerators(
    @Code(lang="Java", template="java/someType.vm"),
    @Code(lang="C#", template="csharp/someType.vm")
)
interface SomeType {
     String name;
}

The annotations would generate two XyzCodeGenerator classes that would recursively call the declared velocity templates.

Add support Scroogle protobuffers for object serialization

Generate code that allows Dejabeans models to be serialized as protobuffers.

  • produce a .proto definition for a set of interfaces
  • generate serialization code
  • tbd: avoid runtime/compile-time dependency on protobuffer libraries/tooling

Velocity templates not loaded from classpath

In the current design templates are not loaded from classpath which causes problems when running from classes which are not part of the modelgen.jar (problem is caused by getResource().getFile()calls).

Instead, the velocity's classpath resource loader should be used.

Add transparent command support layer

Following requirements should be met for a commands/undo/redo support layer:

  • It should be possible to switch usage of commands on or off for an object model or part of it
  • Writable interfaces should be used as API

In pseudo-code this could look like follows:

Person p = ModelFactory.createPerson();
CommandSupport cs = new CommandSupport();
EditablePerson p = cs.register(p, EditablePerson.class);
p.setName("Elizabeth");
cs.undoLast();
assert p.getName()==null;
cs.redoLast();
assert p.getName().equals("Elizabeth")

ClassCastException

Calling

        Model model = new Model();
        model.init(MethodNode.class, ClassNode.class);

with:

public interface ClassNode {
    @Containment MethodNode getMethod();
}

public interface MethodNode extends Contained<ClassNode>{

}

results in:

Exception in thread "main" java.lang.ClassCastException: java.lang.Class cannot be cast to java.lang.reflect.ParameterizedType
    at org.mism.modelgen.Property.init(Property.java:31)
    at org.mism.modelgen.Type.initProperties(Type.java:154)
    at org.mism.modelgen.Type.init(Type.java:82)
    at org.mism.modelgen.Model.initType(Model.java:44)
    at org.mism.modelgen.Model.init(Model.java:25)

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.