All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.ujoframework.extensions.UjoExt Maven / Gradle / Ivy

There is a newer version: 1.22
Show newest version
/*
 *  Copyright 2007 Paul Ponec
 *
 *  Licensed under the Apache License, Version 2.0 (the "License");
 *  you may not use this file except in compliance with the License.
 *  You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 *  Unless required by applicable law or agreed to in writing, software
 *  distributed under the License is distributed on an "AS IS" BASIS,
 *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *  See the License for the specific language governing permissions and
 *  limitations under the License.
 */

package org.ujoframework.extensions;

import java.util.List;
import org.ujoframework.Ujo;
import org.ujoframework.UjoProperty;

/**
 * This is an extended Ujo interface designed for a more conventional property access evaluated by developers.
 * Most of the functions have been a similar reason like methods in the UjoProperty class. 
 * The new solution allows to the developers to chain more properties according to 
 * a model of a some new popular languages.
 * All methods are type safe likewise the usage of the Ujo interface - exclude two methods with an unlimited count of properties: setVal(...) and getVal(...).
 * 
 *
Sample of usage: *
public class Person extends MapUjo implements UjoMiddle {
 *
 *  public static final UjoProperty<Person, String > NAME = newProperty("Name", String.class);
 *  public static final UjoProperty<Person, Double > CASH = newProperty("Cash", Double.class);
 *  public static final UjoProperty<Person, Person> CHILD = newProperty("Child", Person.class);
 *    
 *  public void init() {
 *    set(NAME, "George");
 *    set(CHILD, new Person());
 *    set(CHILD, NAME, "Jane");
 *    set(CHILD, CASH, 200d);
 *        
 *    String name = get(CHILD, NAME);
 *    double cash = get(CHILD, CASH);
 *  }
 *}
* @author Paul Ponec * @since UJO release 0.80 */ public interface UjoExt extends UjoMiddle { /** Getter based on two properties */ public VALUE get ( UjoProperty property1 , UjoProperty property2); /** Getter based on three properties */ public VALUE get ( UjoProperty property1 , UjoProperty property2 , UjoProperty property3 ); /** Setter based on two properties. Type of value is checked in the runtime. */ public void set ( UjoProperty property1 , UjoProperty property2 , VALUE value); /** Setter based on three properties. Type of value is checked in the runtime. */ public void set ( UjoProperty property1 , UjoProperty property2 , UjoProperty property3 , VALUE value); // ------ LIST ---------- /** Returns a count of Items. If the property is null, method returns 0. *
Inside is called a method ListUjoPropertyCommon.getItemCount() . */ public int getItemCount ( ListUjoProperty property); /** Add Value, if the List is null then the list will be created. *
Inside is called a method ListUjoPropertyCommon.addItem(...) . */ public Ujo add ( ListUjoProperty property , ITEM value); /** Add Value, if the List is null then the list will be created. *
Inside is called a method ListUjoPropertyCommon.setItem(...) . */ public Ujo set ( ListUjoProperty property , int index , ITEM value); /** Get Value *
Inside is called a method ListUjoPropertyCommon.getItem(...) . */ public ITEM get ( ListUjoProperty property , int index); /** Get Value */ public ITEM remove ( ListUjoProperty property , int index); /** Returns a not null List. If original list value is empty, the new List is created. *
Inside is called a method ListUjoPropertyCommon.getList() . */ public ,ITEM> LIST list ( ListUjoProperty property ); /** Indicates whether a parameter value "equal to" property default value. */ public boolean isDefault ( UjoProperty property); }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy