/jboss-as-7.1.1.Final/jpa/core/src/main/java/org/jboss/as/jpa/config/AttributeDefinition.java
Java | 64 lines | 14 code | 6 blank | 44 comment | 0 complexity | e795262ee4b5d5dbb1d5e7509fa161ef MD5 | raw file
Possible License(s): LGPL-2.1, Apache-2.0
1// $Id$
2/*
3 * Copyright (c) 2011, Red Hat Middleware LLC or third-party contributors as
4 * indicated by the @author tags or express copyright attribution
5 * statements applied by the authors. All third-party contributions are
6 * distributed under license by Red Hat Middleware LLC.
7 *
8 * This copyrighted material is made available to anyone wishing to use, modify,
9 * copy, or redistribute it subject to the terms and conditions of the GNU
10 * Lesser General Public License, as published by the Free Software Foundation.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
14 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License
15 * for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public License
18 * along with this distribution; if not, write to:
19 * Free Software Foundation, Inc.
20 * 51 Franklin Street, Fifth Floor
21 * Boston, MA 02110-1301 USA
22 */
23package org.jboss.as.jpa.config;
24
25import org.jboss.as.server.parsing.PropertiesValueResolver;
26
27/**
28 * Defines properties of the attribute.
29 *
30 * @author kulikov
31 */
32public class AttributeDefinition {
33 //true when this attribute allow expression
34
35 private boolean allowExpression;
36
37 /**
38 * Creates new instance of this descriptor.
39 *
40 * @param allowExpression true if attribute's value allow expression
41 */
42 public AttributeDefinition(boolean allowExpression) {
43 this.allowExpression = allowExpression;
44 }
45
46 /**
47 * Expression support flag.
48 *
49 * @return true if attributes value can be an expression.
50 */
51 public boolean isAllowExpression() {
52 return allowExpression;
53 }
54
55 /**
56 * Resolves value of the attribute from text description.
57 *
58 * @param value textual expression
59 * @return value.
60 */
61 public String resolve(String value) {
62 return allowExpression ? PropertiesValueResolver.replaceProperties(value) : value;
63 }
64}