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

org.apache.juneau.dto.cognos.Column Maven / Gradle / Ivy

There is a newer version: 9.0.1
Show newest version
// ***************************************************************************************************************************
// * Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements.  See the NOTICE file *
// * distributed with this work for additional information regarding copyright ownership.  The ASF licenses this file        *
// * to you 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.apache.juneau.dto.cognos;

import org.apache.juneau.annotation.*;
import org.apache.juneau.transform.*;
import org.apache.juneau.xml.annotation.*;

/**
 * Represents a meta-data column in a Cognos dataset.
 *
 * 

* When serialized to XML, creates the following construct: *

* <item name='name' type='xs:String' length='255'/> *

*/ @SuppressWarnings({"rawtypes"}) @Bean(typeName="item", properties="name,type,length") public class Column { private String name, type; private Integer length; PojoSwap pojoSwap; /** Bean constructor. */ public Column() {} /** * Constructor. * * @param name The column name. * @param type The column type (e.g. "xs:String"). */ public Column(String name, String type) { this(name, type, null); } /** * Constructor. * * @param name The column name. * @param type The column type (e.g. "xs:String"). * @param length The column length (e.g. 255). */ public Column(String name, String type, Integer length) { this.name = name; this.type = type; this.length = length; } /** * Associates a POJO swap with this column. * *

* Typically used to define columns that don't exist on the underlying beans being serialized. * *

* For example, the AddressBookResource sample defined the following POJO swap to define an additional * "numAddresses" column even though no such property exists on the serialized beans. *

* Column c = new Column("numAddresses", "xs:int") * .addPojoSwaps( * new PojoSwap<Person,Integer>() { * @Override * public Integer swap(Person p) { * return p.addresses.size(); * } * } * ); *

* * @param pojoSwap The POJO swap to associate with the column. * @return This object (for method chaining). */ public Column addPojoSwap(PojoSwap pojoSwap) { this.pojoSwap = pojoSwap; return this; } //----------------------------------------------------------------------------------------------------------------- // Bean properties //----------------------------------------------------------------------------------------------------------------- /** * Bean property getter: name. * * @return The value of the name property on this bean, or null if it is not set. */ @Xml(format=XmlFormat.ATTR) public String getName() { return name; } /** * Bean property setter: name. * * @param name The new value for the name property on this bean. * @return This object (for method chaining). */ public Column setName(String name) { this.name = name; return this; } /** * Bean property getter: type. * * @return The value of the type property on this bean, or null if it is not set. */ @Xml(format=XmlFormat.ATTR) public String getType() { return type; } /** * Bean property setter: type. * * @param type The new value for the type property on this bean. * @return This object (for method chaining). */ public Column setType(String type) { this.type = type; return this; } /** * Bean property getter: length. * * @return The value of the length property on this bean, or null if length is not * applicable for the specified type. */ @Xml(format=XmlFormat.ATTR) public Integer getLength() { return length; } /** * Bean property setter: length. * * @param length The new value for the length property on this bean. * Can be null if length is not applicable for the specified type. * @return This object (for method chaining). */ public Column setLength(Integer length) { this.length = length; return this; } }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy