PageRenderTime 50ms CodeModel.GetById 27ms RepoModel.GetById 0ms app.codeStats 0ms

/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. */
  23. package org.jboss.as.jpa.config;
  24. import org.jboss.as.server.parsing.PropertiesValueResolver;
  25. /**
  26. * Defines properties of the attribute.
  27. *
  28. * @author kulikov
  29. */
  30. public class AttributeDefinition {
  31. //true when this attribute allow expression
  32. private boolean allowExpression;
  33. /**
  34. * Creates new instance of this descriptor.
  35. *
  36. * @param allowExpression true if attribute's value allow expression
  37. */
  38. public AttributeDefinition(boolean allowExpression) {
  39. this.allowExpression = allowExpression;
  40. }
  41. /**
  42. * Expression support flag.
  43. *
  44. * @return true if attributes value can be an expression.
  45. */
  46. public boolean isAllowExpression() {
  47. return allowExpression;
  48. }
  49. /**
  50. * Resolves value of the attribute from text description.
  51. *
  52. * @param value textual expression
  53. * @return value.
  54. */
  55. public String resolve(String value) {
  56. return allowExpression ? PropertiesValueResolver.replaceProperties(value) : value;
  57. }
  58. }