Use the member functions

A lot of enhancements have been made to the core CFML syntax that will aid in developing ColdFusion-based applications elegantly. One of the primary enhancements is the introduction of member functions for data structure and data objects. You can now start coding in a true object oriented style. 

For instance, consider the following headless function:

ArrayAppend (empArr, emp)

It can now be written as:

empArr.append(emp)

where 'arrayObj' is a reference to the CFArray class.

The following example depicts the new usage of member functions:

//The old way
var myArray = ArrayNew(1);
ArrayAppend(myArray, "objec_new");
ArraySort(myArray, "ASC");

// The new way
myArray.append("objec_new");
myArray.sort("ASC");

// The new way
var myProductObject = createObject("java", "myJavaclass");
myjavaList = myProductObject.getProductList();
myjavaList.add("newProduct"); // Java API

myjavaList.append("newProduct"); // CF API
myjavaList.sort("ASC");
</cfscript>

Member function for the following data types are supported:

  • Array
  • String
  • List
  • Struct
  • Date
  • Spreadsheet
  • XML
  • Query
  • Image                                                             

In the 2016 release of ColdFusion, there is a change in the return type for append member functions. For example,

  • anystruct.append() returns appended structure
  • anyarray.append() returns appended array

Supported Array member functions

The following Array member functions are supported:

ArrayAppend someVar.append()
ArrayAvg someVar.avg()
ArrayClear someVar.clear()
ArrayContains someVar.contains()
ArrayContainsNoCase
someVar.containsNoCase()
ArrayDelete someVar.delete()
ArrayDeleteAt someVar.deleteAt()
ArrayDeleteNoCase someVar.deleteNoCase()
ArrayEach someVar.each()
ArrayEvery someVar.every()
ArrayFilter someVar.filter()
ArrayFind someVar.find()
ArrayFindAll someVar.findAll()
ArrayFindAllNoCase someVar.findAllNoCase()
ArrayFindNoCase someVar.findNoCase()
ArrayFirst someVar.first()
ArrayGetMetaData someVar.getMetaData()
ArrayInsertAt someVar.insertAt()
ArrayIsDefined someVar.isDefined()
ArrayIsEmpty someVar.isEmpty()
ArrayLast someVar.last()
ArrayLen someVar.len()
ArrayMap someVar.map()
ArrayMax someVar.max()
ArrayMin someVar.min()
ArrayPrepend someVar.prepend()
ArrayReduceRight someVar.reduceRight()
ArrayResize someVar.resize()
ArraySet someVar.set()
ArraySlice someVar.slice()
ArraySort someVar.sort()
ArraySplice someVar.splice()
ArraySome someVar.some()
ArraySum someVar.sum()
ArraySwap someVar.swap()
ArrayToList someVar.toList()
ArrayReduce someVar.reduce()

Supported String member functions

The following String member functions are supported:

Function Member function
decodeForHTML someVar.decodeForHTML()
decodeFromURL someVar.decodeFromURL()
EncodeForCSS someVar.encodeforCSS()
EncodeForHTML someVar.encodeforHTML()
EncodeForHTMLAttribute someVar.encodeforHTMLAttribute()
EncodeForJavaScript someVar.encodeforJavaScript()
EncodeForURL someVar.encodeforURL()
EncodeForXML someVar.encodeforXML()
EncodeForXMLAttribute someVar.encodeforXMLAttribute()
EncodeForXPath someVar.encodeforXPath()
Encrypt someVar.encrypt()
getSafeHTML someVar.getSafeHTML()
isSafeHTML someVar.isSafeHTML()
paragraphFormat someVar.paragraphFormat()
ReplaceListNoCase someVar.replaceListNocase()
urlDecode someVar.urlDecode()
urlEncodedFormat someVar.urlEncodedFormat()
BinaryDecode someVar.binaryDecode()
BinaryEncode someVar.binaryEnecode()
Canonicalize someVar.canonicalize()
CharsetDecode someVar.charsetDecode()
CharsetEncode someVar.charsetEncode()
CJustify someVar.cJustify()
Compare someVar.compare()
CompareNoCase someVar.compareNocase()
Decrypt someVar.decrypt()
Encrypt someVar.encrypt()
Find someVar.find()
FindNoCase someVar.findNoCase()
FindOneOf someVar.findOneOf()
FormatBaseN someVar.formatBaseN()
GenerateSecretKey someVar.generateSecretKey()
GetToken someVar.getToken()
Hash someVar.hash()
HTMLCodeFormat someVar.htmlCodeFormat()
HTMLEditFormat someVar.htmlEditFormat()
Insert someVar.insert()
JSStringFormat someVar.jssStringFormat()
LCase someVar.lCase()
Left someVar.left()
Len someVar.len()
LJustify someVar.lJustify()
LSIsCurrency someVar.lsIsCurrency()
LSIsDate someVar.lsIsDate()
LSIsNumeric someVar.lsIsNumeric()
LSParseCurrency someVar.lsParseCurrency()
LSParseDateTime someVar.lsParseDateTime()
LSParseEuroCurrency someVar.lsParseEuroCurrency()
LSParseNumber someVar.lsParseNumber()
Mid someVar.mid()
ParagraphFormat someVar.paragraphFormat()
ParseDateTime someVar.parseDateTime()
REFind someVar.reFind()
REFindNoCase someVar.reFindNoCase()
REMatch someVar.reMatch()
REMatchNoCase someVar.reMatchNoCase()
RemoveChars someVar.removeChars()
RepeatString someVar.repeatString()
Replace someVar.replace()
ReplaceList someVar.replaceList()
ReplaceList someVar.replaceList()
ReplaceNoCase someVar.replaceNocase()
REReplace someVar.reReplace()
REReplaceNoCase someVar.reReplaceNoCase()
Reverse someVar.reverse()
Right someVar.right()
RJustify someVar.rJustify()
RTrim someVar.trim()
SpanExcluding someVar.spanExcluding()
SpanIncluding someVar.spanIncluding()
StripCR someVar.stripCR()
StringSort someVar.sort()
StringSome someVar.some()
StringReduce somevar.reduce()
StringReduceRight someVar.reduceRight()
StringEach someVar.each()
StringMap someVar.map()
StringFilter somevar.filter()
StringEvery someVar.every()
ToBase64 someVar.toBase64()
ToBinary someVar.toBinary()
ToString someVar.toString()
Trim someVar.trim()
UCase someVar.uCase()
URLDecode someVar.urlDecode()
URLEncodedFormat someVar.urlEncodedFormat()
Val someVar.val()
Wrap someVar.wrap()
XmlFormat someVar.xmlFormat()

Supported List member functions

The following List member functions are supported:

ListAppend someVar.listAppend()
ListChangeDelims someVar.listChangeDelims()
ListContains someVar.listContains()
ListContainsNoCase someVar.listContainsNoCase()
ListDeleteAt someVar.listDeleteAt()
ListEach someVar.listEach()
ListFind someVar.listFind()
ListFindNoCase someVar.listFindNoCase()
ListFirst someVar.listFirst()
ListGetAt someVar.listGetAt()
ListInsertAt someVar.listInsertAt()
ListLast someVar.listLast()
ListLen someVar.listLen()
ListMap someVar.listMap()
ListPrepend someVar.listPrepend()
ListQualify someVar.listQualify()
ListReduce someVar.listReduce()
ListReduceRight someVar.listReduceRight()
ListRemoveDuplicates someVar.listRemoveDuplicates()
ListRest someVar.listRest()
ListSetAt someVar.listSetAt()
ListSort someVar.listSort()
ListToArray someVar.listToArray()
ListValueCount someVar.listValueCount()
ListValueCountNoCase someVar.listValueCountNoCase()
ToJSON someVar.toJSON()

Supported Struct member functions

The following Struct member functions are supported:

StructIsEmpty someVar.isEmpty()
StructAppend someVar.append()
StructClear someVar.clear()
StructCopy someVar.copy()
StructCount someVar.count()
StructDelete someVar.delete()
StructEvery someVar.every()
StructFind someVar.find()
StructFindValue someVar.findValue()
StructGet someVar.get()
StructGetMetadata someVar.getMetadata()
StructUpdate someVar.update()
StructSort someVar.sort()
StructSetMetadata someVar.setMetadata()
StructInsert someVar.insert()
StructIsCaseSensitive someVar.isCaseSensitive()
# StructIsOrdered someVar.isOrdered()
StructEach someVar.each()
StructKeyArray someVar.keyArray()
StructKeyExists someVar.keyExists()
StructKeyList someVar.keyList()
StructMap someVar.map()
StructReduce someVar.reduce()
StructFindKey someVar.findkey()
StructFilter someVar.filter()
StructSome someVar.some()
StructToSorted someVar.tosorted()

# New in Adobe ColdFusion (2018 release)

Supported Date member functions

The following Date member functions are supported:

CreateODBCDate someVar.createODBCDate()
CreateODBCDateTime someVar.createODBCDateTime()
DateDiff someVar.diff()
CreateODBCTime someVar.createODBCTime()
* LSDateFormat someVar.lsDateFormat()
DatePart someVar.datepart()
DaysInYear someVar.daysIn
Second someVar.second()
Minute someVar.minute()
Hour someVar.hour()
Day someVar.day()
Week someVar.week()
Month someVar.month()
* setSecond <DateObject>.setSecond(second)
* setMinute <DateObject>.setMinute(minute)
* setHour <DateObject>.setHour(hour)
* setDay <DateObject>.setDay(day)
* setMonth <DateObject>.setMonth(month)
* setYear <DateObject>.setYear(year)
Quarter someVar.quarter()
Year someVar.year()
DaysInMonth someVar.daysInMonth()
DayOfWeek someVar.dayOfweek()
DayOfYear someVar.dayOfYear()
FirstDayOfMonth someVar.firstDayOfMonth()
DateTimeFormat someVar.dateTimeFormat()
TimeFormat someVar.timeFormat()
DateFormat someVar.dateFormat()
DateAdd someVar.add()
DateConvert someVar.convert()
LSTimeFormat someVar.lsTimeFormat()
# Format

someVar.format()

# New in Adobe ColdFusion (2018 release)

* New in Adobe ColdFusion (2016 release)

Supported Image member functions

The following Image member functions are supported:

ImageGetWidth someVar.getWidth()
ImageSetDrawingColor someVar.setDrawingColor()
ImageGetBufferedImage someVar.getBufferedImage()
ImageTranslateDrawingAxis someVar.translateDrawingAxis()
ImageSetDrawingStroke someVar.setDrawingStroke()
ImageNegative someVar.negative()
ImageCopy someVar.copy()
ImageDrawRect someVar.drawRect()
ImageCrop someVar.crop()
ImageGetHeight someVar.getHeight()
ImageGetIPTCTag someVar.getIPTCTag()
ImageDrawOval someVar.drawOval()
ImageSharpen someVar.sharpen()
ImageOverlay someVar.overlay()
ImageGetEXIFTag someVar.getEXIFTag()
ImageDrawBeveledRect someVar.drawBeveledRect()
ImageAddBorder someVar.addBorder()
ImageShear someVar.shear()
ImageInfo someVar.info()
ImagePaste someVar.paste()
ImageDrawArc someVar.drawArc()
ImageShearDrawingAxis someVar.shearDrawingAxis()
ImageDrawRoundRect someVar.drawRoundRect()  
ImageGrayscale someVar.grayscale()
ImageSetDrawingTransparency someVar.setDrawingTransparency()
ImageScaleToFit someVar.scaleToFit()
ImageClearRect someVar.clearRect()
ImageTranslate someVar.translate()
ImageFlip someVar.flip()
ImageWriteBase64 someVar.writeBase64()
ImageSetBackgroundColor someVar.setBackgroundColor()
ImageDrawLine someVar.drawLine()
ImageDrawQuadraticCurve someVar.drawQuadraticCurve()
ImageRotate someVar.rotate()
ImageGetBlob someVar.getBlob()
ImageWrite someVar.write()
ImageBlur someVar.blur()
ImageRotateDrawingAxis someVar.rotateDrawingAxis()
ImageSetAntialiasing someVar.setAntialiasing()
ImageDrawPoint someVar.drawPoint()
ImageDrawCubicCurve someVar.drawCubicCurve()
ImageXORDrawingMode someVar.xorDrawingMode()
ImageDrawText someVar.drawText()
ImageDrawLines someVar.drawLines()
ImageResize someVar.resize()
ImageGetExifMetadata someVar.getExifMetadata()
ImageGetIptcMetadata someVar.getIptcMetadata()

Supported Spreadsheet member functions

The following Spreadsheet member functions are supported:

SpreadsheetDeleteRow someVar.deleteRow()
SpreadsheetFormatColumn someVar.formatColumn()
SpreadsheetShiftRows someVar.shiftRows()
SpreadsheetCreateSheet someVar.createSheet()
SpreadsheetReadBinary someVar.readBinary()
SpreadsheetWrite someVar.write()
SpreadsheetAddRow someVar.addRow()
SpreadsheetShiftColumns someVar.shiftColumns()
SpreadsheetGetCellFormula someVar.getCellFormula()
SpreadsheetDeleteColumns someVar.deleteColumns()
SpreadsheetAddFreezePane someVar.addFreezePane()
SpreadsheetDeleteColumn someVar.deleteColumn()
SpreadsheetSetCellComment someVar.setCellComment()
SpreadsheetSetActiveSheetNumber someVar.setActiveSheetNumber()
SpreadsheetSetHeader someVar.setHeader()
SpreadsheetAddSplitPane someVar.addSplitPane()
SpreadsheetMergeCells someVar.mergeCells()
SpreadsheetFormatRows someVar.formatRows()
SpreadsheetGetCellComment someVar.getCellComment()
SpreadsheetGetCellValue someVar.getCellValue()
SpreadsheetGetColumnCount someVar.getColumnCount()
SpreadsheetAddInfo someVar.addInfo()
SpreadsheetSetCellValue someVar.setCellValue()
SpreadsheetSetFooter someVar.setFooter()
SpreadsheetRemoveSheet someVar.removeSheet()
SpreadsheetSetRowHeight someVar.setRowHeight()
SpreadsheetSetActiveSheet someVar.setActiveSheet()
SpreadsheetFormatCellRange someVar.formatCellRange()
SpreadsheetFormatCell someVar.formatCell()
SpreadsheetAddRows someVar.addRows()
SpreadsheetFormatColumns someVar.formatColumns()
SpreadsheetAddImage someVar.addImage()
SpreadsheetSetCellFormula someVar.setCellFormula()
SpreadsheetAddColumn someVar.addColumn()
SpreadsheetDeleteRows someVar.deleteRows()
SpreadsheetSetColumnWidth someVar.setColumnWidth()
SpreadsheetFormatRow someVar.formatRow()
SpreadsheetInfo someVar.info()
SpreadsheetAddAutoFilter someVar.addAutoFilter()
SpreadsheetAddPageBreaks someVar.addPageBreaks()

Supported XML member functions

The following XML member functions are supported:

# XmlAppend someVar.append()
XmlChildPos someVar.childPos()
# XmlCount someVar.count()
Duplicate someVar.duplicate()
XmlElemNew someVar.elemNew()
XmlGetNodeType someVar.getNodeType()
# XmlHasChild someVar.hasChild()
XmlLen someVar.len()
# XmlKeyArray someVar.keyArray()
# XmlKeyList someVar.keyList()
XmlSearch someVar.search()
# ToString someVar.toString()
XmlTransform someVar.transform()
# XmlUpdate someVar.update()

# New in Adobe ColdFusion (2018 release)

Supported Query member functions

The following Query member functions are supported:

QueryAddColumn someVar.addColumn()
# QueryDeleteColumn someVar.deleteColumn()
# QueryDeleteRow someVar.deleteRow()
* QueryEach someVar.Each()
QueryGetRow someVar.getRow()
QueryConvertForGrid someVar.convertForGrid()
* QueryKeyExists someVar.keyExists()
* QueryFilter someVar.Filter()
* QueryMap someVar.Map()
* QueryReduce someVar.Reduce()
QuerySetCell someVar.setCell()
* QuerySort someVar.Sort()
QueryAddRow someVar.addRow()
* QueryGetResult someVar.getResult()
* ValueArray someVar.valueArray()
QueryRecordCount someVar.recordCount()
Len someVar.len()
QueryClear someVar.clear()
QueryAppend someVar.append()
QueryPrepend someVar.prepend()
QueryRowSwap someVar.rowswap()
QuerySlice someVar.slice()
QueryInsertAt someVar.insertAt()
QueryDeleteAt someVar.deleteAt()
QuerySome someVar.some()
QueryEvery someVar.every()

# New in Adobe ColdFusion (2018 release)

* New in Adobe ColdFusion (2016 release)

Supported Display and formatting member functions

The following Display and formatting member functions are supported:

* BooleanFormat

someVal.booleanFormat()

* YesNoFormat

someVal.yesNoFormat()

* New in Adobe ColdFusion (2016 release)

Supported Numeric member functions

Abs

someVar.abs()

ACos

someVar.aCos()

ASin

someVar.aSin()

Atn

someVar.atn()

BitAnd

someVar.bitAnd(number2)

BitMaskClear

someVar.bitMaskClear(start, length)

BitMaskRead

someVar.bitMaskRead(start, length)

BitMaskSet

someVar.bitMaskSet(mask, start, length)

BitNOT

someVar.bitNot()

BitOR

someVar.bitOr(number2)

BitSHLN

someVar.bitSHLN(count)

BitXOR

someVar.bitXor(number2)

Ceiling

someVar.ceiling()

Cos

someVar.cos()

DecrementValue

someVar.decrementValue()

Exp

someVar.exp()

Fix

someVar.fix()

Floor

someVar.floor()

FormatBaseN

someVar.formatBaseN(radix)

IncrementValue

someVar.incrementValue()

InputBaseN

someVar.inputbasen()

Log

someVar.log()

Log10

someVar.log10()

Max

someVar.max(number2)

Min

someVar.min(number2)

Round

someVar.round()

Sgn

someVar.sgn()

Sin

someVar.sin()

Sqr

someVar.sqr()

Tan

someVar.tan()

BitSHRN

someVar.bitSHRN(count)

PrecisionEvaluate

someVar.precisionEvaluate()

Randomize

someVar.randomize([algorithm])

RandRange

someVar.randRange(number2[, algorithm])

All numeric functions: New in Adobe ColdFusion (2018 release)

Supported Future member functions

then

FutureObject.then(UDFMethod method)

then

FutureObject.then((UDFMethod method, long timeout)

error

FutureObject.error(UDFMethod method)

error

FutureObject.then((UDFMethod method, long timeout)

get

FutureObject.get()

get

FutureObject.get(long timeout)

get

FutureObject.get(long timeout, String timeUnit)

cancel

FutureObject.cancel()

isCancelled

FutureObject.isCancelled()

isDone

FutureObject.isDone()

All Future member functions: New in Adobe ColdFusion (2018 release)

Supported Empty Future member functions

complete

EmptyFutureObject.complete(Object val)

cancel

EmptyFutureObject.cancel()

isCancelled

EmptyFutureObject.isCancelled()

isDone

EmptyFutureObject.isDone()

get

EmptyFutureObject.get()

All empty Future member functions: New in Adobe ColdFusion (2018 release)

 Adobe

Ottieni supporto in modo più facile e veloce

Nuovo utente?

Adobe MAX 2024

Adobe MAX
La conferenza sulla creatività

14-16 ottobre Miami Beach e online

Adobe MAX

La conferenza sulla creatività

14-16 ottobre Miami Beach e online

Adobe MAX 2024

Adobe MAX
La conferenza sulla creatività

14-16 ottobre Miami Beach e online

Adobe MAX

La conferenza sulla creatività

14-16 ottobre Miami Beach e online