properties - Java library for extended attributes, typing and validation -


background: have object model needs extended adding several attributes few types, can vary across installations. example, 'user' objects need have few extended attributes. on sites 'users' need several identifiers whereas in other sites 'users' need other attributes phone numbers, addresses , dates. prefer avoid maintaining several object models , interfaces, , instead model "extensible object properties".

question: there java library can handle type definitions, providing typed property bags, methods list properties, enforce typing, validate values, convert values , string, , maybe related sql queries , form processing...?

i need able define types , attributes programatically. ability load type definitions configuration files desirable.

comments welcome. thank you.

if right barely possible in scala trait mechanizm, interfaces may mixin in class, may contain code, don't need rewrite abstract methods times use them.

trait stackoverflow {    val foo = "foo" }  trait metastackoverflow {    val bar = "bar" }  class user(val name: string) 

now in repl:

scala> val u = new user("jjmontes") stackoverflow metastackoverflow    //u: user stackoverflow metastackoverflow = $anon$1@8825a5  scala> u.bar   //res0: java.lang.string = bar  scala> u.foo   //res1: java.lang.string = foo 

or this:

scala> class usera(name: string) extends user(name) stackoverflow //defined class usera  scala> val u = new usera("jjmontes") //u: usera = usera@1aecf45  scala> u.foo //res8: java.lang.string = foo  scala> u.bar <console>:12: error: value bar not member of usera               u.bar 

scala has full interop java (except rare cases, still has interop, painful).


Comments

Popular posts from this blog

android - Spacing between the stars of a rating bar? -

aspxgridview - Devexpress grid - header filter does not work if column is initially hidden -

c# - How to execute a particular part of code asynchronously in a class -