Coder Social home page Coder Social logo

emurano / ding Goto Github PK

View Code? Open in Web Editor NEW

This project forked from marcelog/ding

0.0 0.0 0.0 18.4 MB

DI ( Dependency Injection: Setter, Constructor, Method), AOP ( Aspect Oriented Programming ), Events support, xml, yaml, and annotations (including some JSR 250 and JSR 330, like @Configuration and @Bean ala java configuration) , lightweight, simple, and quick MVC ( Model View Controller ), syslog, tcp client and server, with non blocking sockets, custom error, signal, and exception handling through events. Needs PHP 5.3, very similar to seasar, spring ( java ) . Can be deployed as a PHAR file.

Home Page: http://marcelog.github.com/Ding

License: Apache License 2.0

XSLT 3.85% PHP 96.13% HTML 0.02% Smarty 0.01%

ding's People

Contributors

agvstin avatar jaehoo avatar marcelog avatar

Watchers

 avatar

ding's Issues

Allow @Value annotations to work on setter methods

Currently if you want to inject a property value into your bean's member variable with the @value annotation, you need to put the @value annotation on the private member variable's declaration:

class MyBean { /** * @Value(value=${app.properties.name} */ protected $name; }

If you want Ding to inject the value using a setter method you create the setter method with a name that matches the setter format set, with 's first character being uppercase:

`class MyBean {
/**
* @value(value=${app.properties.name}
*/
protected $name;

public function setName($name) {
	$this->name = $name;
}

}`

I would like it if Ding could inject property values if the @value annotation is on the setter method and not on the member variable declaration, like this:

`class MyBean {

protected $name;

/**
 * @Value(value=${app.properties.name}
 */
public function setName($name) {
	$this->name = $name;
}

}`

There are two justifications for this:

  1. Consistency: When you inject resources using setter methods you can specify the @resource annotation on the setter instead of the member variable. Because of this I made the assumption that you could inject values using @value on the setter method and burned some time figuring out what was wrong.

  2. Flexibility: There will be times when I don't want to save the value to a property. I might want to use the value as the input data for a more complex process. E.g. if I inject a comma separated string I might want to do something like this:

`class MyBean {

protected $nameList = [];

/**
 * @Value(value=${app.properties.names}
 */
public function setNamesFromCsv($names) {
	$this->nameList = explode(',', $names);
}

}`

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.