| Classes in this File | Line Coverage | Branch Coverage | Complexity | ||||
| InterfaceFieldAliasMapping |
|
| 0.0;0 |
| 1 | /* | |
| 2 | * Licensed to the Apache Software Foundation (ASF) under one | |
| 3 | * or more contributor license agreements. See the NOTICE file | |
| 4 | * distributed with this work for additional information | |
| 5 | * regarding copyright ownership. The ASF licenses this file | |
| 6 | * to you under the Apache License, Version 2.0 (the | |
| 7 | * "License"); you may not use this file except in compliance | |
| 8 | * with the License. You may obtain a copy of the License at | |
| 9 | * | |
| 10 | * http://www.apache.org/licenses/LICENSE-2.0 | |
| 11 | * | |
| 12 | * Unless required by applicable law or agreed to in writing, | |
| 13 | * software distributed under the License is distributed on an | |
| 14 | * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | |
| 15 | * KIND, either express or implied. See the License for the | |
| 16 | * specific language governing permissions and limitations under the License. | |
| 17 | */ | |
| 18 | package org.apache.shindig.social.core.util.xstream; | |
| 19 | ||
| 20 | /** | |
| 21 | * | |
| 22 | */ | |
| 23 | public class InterfaceFieldAliasMapping { | |
| 24 | ||
| 25 | private String alias; | |
| 26 | private Class<?> type; | |
| 27 | private String fieldName; | |
| 28 | private String parent; | |
| 29 | ||
| 30 | /** | |
| 31 | * @param alias | |
| 32 | * the name of the element to be used in the xml | |
| 33 | * @param type | |
| 34 | * the type containing the field | |
| 35 | * @param fieldName | |
| 36 | * the field name. | |
| 37 | */ | |
| 38 | public InterfaceFieldAliasMapping(String alias, Class<?> type, | |
| 39 | 0 | String fieldName) { |
| 40 | 0 | this.alias = alias; |
| 41 | 0 | this.type = type; |
| 42 | 0 | this.fieldName = fieldName; |
| 43 | 0 | } |
| 44 | ||
| 45 | /** | |
| 46 | * @param alias | |
| 47 | * the name of the element to be used in the xml | |
| 48 | * @param type | |
| 49 | * the type containing the field | |
| 50 | * @param fieldName | |
| 51 | * the field name. | |
| 52 | * @param parent | |
| 53 | * the parent element | |
| 54 | */ | |
| 55 | public InterfaceFieldAliasMapping(String alias, Class<?> type, | |
| 56 | 0 | String fieldName, String parent) { |
| 57 | 0 | this.alias = alias; |
| 58 | 0 | this.type = type; |
| 59 | 0 | this.fieldName = fieldName; |
| 60 | 0 | this.parent = parent; |
| 61 | 0 | } |
| 62 | ||
| 63 | /** | |
| 64 | * @return | |
| 65 | */ | |
| 66 | public Class<?> getType() { | |
| 67 | 0 | return type; |
| 68 | } | |
| 69 | ||
| 70 | /** | |
| 71 | * @return | |
| 72 | */ | |
| 73 | public String getAlias() { | |
| 74 | 0 | return alias; |
| 75 | } | |
| 76 | ||
| 77 | /** | |
| 78 | * @return | |
| 79 | */ | |
| 80 | public String getFieldName() { | |
| 81 | 0 | return fieldName; |
| 82 | } | |
| 83 | ||
| 84 | /** | |
| 85 | * @return the parent | |
| 86 | */ | |
| 87 | public String getParent() { | |
| 88 | 0 | return parent; |
| 89 | } | |
| 90 | ||
| 91 | /** | |
| 92 | * {@inheritDoc} | |
| 93 | * | |
| 94 | * @see java.lang.Object#toString() | |
| 95 | */ | |
| 96 | @Override | |
| 97 | public String toString() { | |
| 98 | 0 | if (parent == null) { |
| 99 | 0 | return type + ".get" + fieldName + "() <-> <" + alias + ">"; |
| 100 | } else { | |
| 101 | 0 | return type + ".get" + fieldName + "() <-> <" + alias |
| 102 | + "> inside parent <" + parent + ">"; | |
| 103 | } | |
| 104 | } | |
| 105 | } |